Skip to content

Commit d63a583

Browse files
committed
Ignore all environment variables in the test env
Except for WAREHOUSE_ENV
1 parent b808440 commit d63a583

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

tests/unit/test_config.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
# See the License for the specific language governing permissions and
1111
# limitations under the License.
1212

13+
import os
1314
from unittest import mock
1415

1516
import pretend
@@ -176,8 +177,17 @@ def test_configure(monkeypatch, settings, environment):
176177
xmlrpc_renderer_cls = pretend.call_recorder(lambda **kw: xmlrpc_renderer_obj)
177178
monkeypatch.setattr(config, "XMLRPCRenderer", xmlrpc_renderer_cls)
178179

179-
if environment == config.Environment.development:
180-
monkeypatch.setenv("WAREHOUSE_ENV", "development")
180+
# Ignore all environment variables in the test environment, except for WAREHOUSE_ENV
181+
monkeypatch.setattr(
182+
os,
183+
"environ",
184+
{
185+
"WAREHOUSE_ENV": {
186+
config.Environment.development: "development",
187+
config.Environment.production: "production",
188+
}[environment],
189+
},
190+
)
181191

182192
class FakeRegistry(dict):
183193
def __init__(self):

0 commit comments

Comments
 (0)