-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix unknown pytest options warning (#43)
* fix warnings * Fix mypy in tests * Add periods to helps * add test for ini option * fix ini test * fix test run name * Fix tests * Fix CI * Remove useless default * fix tests * Add Changelog Co-authored-by: Guido Schmitz <guido.schmitz@devolo.de> Co-authored-by: Guido Schmitz <guido.schmitz@fedaix.de>
- Loading branch information
1 parent
9731a62
commit 85bb70a
Showing
15 changed files
with
117 additions
and
104 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
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
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
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,56 @@ | ||
"""Test pytest.ini configuration.""" | ||
import pytest | ||
|
||
|
||
@pytest.mark.usefixtures("adaptavist_mock") | ||
class TestIniConfig: | ||
"""Test pytest.ini configuration on unit test level.""" | ||
|
||
@pytest.mark.parametrize( | ||
"option", | ||
[ | ||
"project_key", | ||
"test_case_keys", | ||
"test_case_order", | ||
"test_case_range", | ||
"test_environment", | ||
"test_plan_folder", | ||
"test_plan_suffix", | ||
"test_plan_key", | ||
"test_run_folder", | ||
"test_run_key", | ||
"test_run_suffix", | ||
], | ||
) | ||
def test_ini_config_strings(self, pytester: pytest.Pytester, monkeypatch: pytest.MonkeyPatch, option: str): | ||
"""Test that string values in pytest.ini are correctly used and recognized by pytest.""" | ||
monkeypatch.setenv("PYTEST_DISABLE_PLUGIN_AUTOLOAD", "1") | ||
pytester.makepyfile( | ||
""" | ||
def test_T1(meta_block): | ||
with meta_block(1) as mb_1: | ||
mb_1.check(True) | ||
""" | ||
) | ||
pytester.makeini( | ||
f""" | ||
[pytest] | ||
{option} = C1 | ||
""" | ||
) | ||
|
||
report = pytester.inline_run("--adaptavist", plugins=["adaptavist", "assume"]) | ||
assert getattr(report._pluginmanager.get_plugin("_adaptavist"), option) in ( | ||
"C1", | ||
["C1"], | ||
) # pylint: disable=protected-access | ||
|
||
result = pytester.runpytest("--adaptavist", plugins=["adaptavist", "assume"]) | ||
assert "warnings" not in result.parseoutcomes() | ||
|
||
monkeypatch.setenv(option, "C2") | ||
report = pytester.inline_run("--adaptavist", plugins=["adaptavist", "assume"]) | ||
assert getattr(report._pluginmanager.get_plugin("_adaptavist"), option) in ( | ||
"C2", | ||
["C2"], | ||
) # pylint: disable=protected-access |
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 |
---|---|---|
@@ -1,5 +1,4 @@ | ||
""" Test init file of pytest_adaptavist""" | ||
|
||
import pytest | ||
|
||
|
||
|
Oops, something went wrong.