Set up environment variables at the beginning of the test session.
(session)
| 67 | |
| 68 | @hookimpl(tryfirst=True) |
| 69 | def pytest_sessionstart(session): |
| 70 | """Set up environment variables at the beginning of the test session.""" |
| 71 | if not ENV_SETUPS: |
| 72 | return |
| 73 | # Use the first env setup to initialize environment for module-level imports |
| 74 | env_name = next(iter(ENV_SETUPS.keys())) |
| 75 | envs = ENV_SETUPS[env_name] |
| 76 | global _original_env |
| 77 | _original_env = {key: os.environ.get(key) for key in envs} |
| 78 | os.environ.update(envs) |
| 79 | |
| 80 | |
| 81 | @hookimpl(trylast=True) |