Skip to content

Commit 578f6ba

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

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

tests/unit/test_config.py

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

13+
import os
14+
1315
from unittest import mock
1416

1517
import pretend
@@ -176,8 +178,17 @@ def test_configure(monkeypatch, settings, environment):
176178
xmlrpc_renderer_cls = pretend.call_recorder(lambda **kw: xmlrpc_renderer_obj)
177179
monkeypatch.setattr(config, "XMLRPCRenderer", xmlrpc_renderer_cls)
178180

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

182193
class FakeRegistry(dict):
183194
def __init__(self):

0 commit comments

Comments
 (0)