summaryrefslogtreecommitdiff
path: root/tests/conftest.py
diff options
context:
space:
mode:
authorDaniƫl van Noord <13665637+DanielNoord@users.noreply.github.com>2021-11-25 14:06:29 +0100
committerGitHub <noreply@github.com>2021-11-25 14:06:29 +0100
commitaa048f7787dc1f16938e4ddefd2a7f2b0af98651 (patch)
treecb6cf1b11fef5b39f704e84f60578acdf5d45c39 /tests/conftest.py
parentfa7a84fa712915fde725cda63a5bfbf4ed5cd22a (diff)
downloadpylint-git-aa048f7787dc1f16938e4ddefd2a7f2b0af98651.tar.gz
Add documentation for primer and convert to command line option (#5387)
* Add documentation for primer and convert to command line option Co-authored-by: Jacob Walls <jacobtylerwalls@gmail.com>
Diffstat (limited to 'tests/conftest.py')
-rw-r--r--tests/conftest.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/conftest.py b/tests/conftest.py
index 7a9c062db..406e93efd 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -56,3 +56,39 @@ def disable():
@pytest.fixture(scope="module")
def reporter():
return MinimalTestReporter
+
+
+def pytest_addoption(parser) -> None:
+ parser.addoption(
+ "--primer-stdlib",
+ action="store_true",
+ default=False,
+ help="Run primer stdlib tests",
+ )
+ parser.addoption(
+ "--primer-external",
+ action="store_true",
+ default=False,
+ help="Run primer external tests",
+ )
+
+
+def pytest_collection_modifyitems(config, items) -> None:
+ """Convert command line options to markers"""
+ # Add skip_primer_stdlib mark
+ if not config.getoption("--primer-external"):
+ skip_primer_external = pytest.mark.skip(
+ reason="need --primer-external option to run"
+ )
+ for item in items:
+ if "primer_external" in item.keywords:
+ item.add_marker(skip_primer_external)
+
+ # Add skip_primer_stdlib mark
+ if not config.getoption("--primer-stdlib"):
+ skip_primer_stdlib = pytest.mark.skip(
+ reason="need --primer-stdlib option to run"
+ )
+ for item in items:
+ if "primer_stdlib" in item.keywords:
+ item.add_marker(skip_primer_stdlib)