0

I have test_a.py and test_b.py files. In test_a.py file I have context manager with patch.dict like below:

with patch.dict("os.environ", {"AWS_REGION": "us-east-1"}):
    code...

In test_b.py file I have AWS_REGION = os.environ["AWS_REGION"] .

The problem: when I commented out the context manager in test_a.py file, the test_b.py file failed because os.environ doesn't have "AWS_REGION" .

My question:

  1. Why are the two files interdependent?
  2. Acknowledging that they're interdependent, why the patch.dict that only applies in the context manager will have an effect on test_b.py file?
Gang Fang
  • 1
  • 1

0 Answers0