-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add check to verify deprecated envar message
Signed-off-by: Daniel Diblik <[email protected]>
- Loading branch information
Showing
6 changed files
with
58 additions
and
22 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import os | ||
import re | ||
|
||
import pytest | ||
|
||
from test_helpers.common_functions import get_log_file_data as log_file_data | ||
|
||
|
||
@pytest.fixture(autouse=True) | ||
def check_validate_deprecated_envar_message(): | ||
""" | ||
Check fixture. | ||
Validate that the warning message for deprecated environment variables is present, | ||
if the respective environment variable is used. | ||
""" | ||
|
||
yield | ||
|
||
if "C2R_TESTS_NONDESTRUCTIVE" in os.environ: | ||
missing_envar_messages = [] | ||
for key in os.environ.keys(): | ||
if re.match("CONVERT2RHEL_", key): | ||
if not re.search(f"The environment variable {key} is deprecated", log_file_data): | ||
missing_envar_messages.append(key) | ||
if missing_envar_messages: | ||
pytest.fail(f"The warning message for deprecated envars {missing_envar_messages} is not not present.") |
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