Skip to content

setting environment variables which are accessed at import time #10027

Answered by wimglenn
wimglenn asked this question in Ideas
Discussion options

You must be logged in to vote

The concern of interacting with default or externally configured services is mitigated by using the required_plugins setting mentioned in the comments.

[pytest]
required_plugins = pytest-env
env = 
    FOO_URL = https://test-foo-url.org

That makes the test session abort early if pytest-env wasn't installed, rather than just print a warning about unrecognized config options.

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
4 replies
@RonnyPfannschmidt
Comment options

@The-Compiler
Comment options

@wimglenn
Comment options

wimglenn Jun 8, 2022
Collaborator Author

@nicoddemus
Comment options

Comment options

wimglenn
Jun 8, 2022
Collaborator Author

You must be logged in to vote
0 replies
Answer selected by wimglenn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
4 participants