-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce test-specific environment variables
This commit adds two new functions to the integration tests utilities: get_test_env_value(varname: str, default_value: str) -> str get_test_env_value_int(varname: str, default_value: int) -> int This allows to set and get test-specific environment variables easily. Use case: Say we have an integration test, in which we want to assign a value for a variable WAIT_TIMEOUT externally from the environment, but we don't want to create a new fixture for it, as this value would be used only in this specific test. The expected environment variable name would be assembled from the prefix `TEST_`, test name (i.e. the directory name in which the test script is located) and the provided suffix, e.g. in test named `bluechi-generic-test`, the expected environment variable would be `TEST_BLUECHI_GENERIC_TEST_WAIT_TIMEOUT` Thus, using `WAIT_TIMEOUT = get_test_env_value_int("WAIT_TIMEOUT", 1000)` in the test named `bluechi-generic-test` will set WAIT_TIMEOUT the value of 1000, unless `TEST_BLUECHI_GENERIC_TEST_WAIT_TIMEOUT` environment variable is set with an integer value, which in that case would be assigned to `WAIT_TIMEOUT` Signed-off-by: Mark Kemel <[email protected]>
- Loading branch information
Showing
3 changed files
with
60 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters