I have some pytest tests that connect to a test Postgres DB. These work well locally. However, on GitHub actions, there's no Postgres DB, so I have to disable the entire module that has these tests.
According to the docs, CI Always set to true.
So all I have to do is check for the CI env-var, and disable the tests module if it's present and set:
if os.getenv('CI'):
pytest.skip("No PostgreSQL on GH Actions CI/CD", allow_module_level=True)
Doesn't work.
I have tried setting it manually, setting other env-vars manually via env:
, but none of them are visible to Python. Disabling the module locally by negating the above test not os.getenv('CI')
works as expected.
What could be the problem?