Speed up pytest collection by ignoring certain folders

This commit is contained in:
Michael Mintz 2023-02-17 23:40:48 -05:00
parent ab5c4129a5
commit bd5513043f
6 changed files with 65 additions and 12 deletions

View File

@ -1,7 +1,10 @@
[pytest] [pytest]
# Display console output, disable cacheprovider: # Display console output, disable cacheprovider, don't collect recordings:
addopts = --capture=no -p no:cacheprovider addopts = --capture=no -p no:cacheprovider --ignore=recordings
# Skip looking in these directories for tests:
norecursedirs = .* build dist recordings temp
# Ignore warnings such as DeprecationWarning and PytestUnknownMarkWarning # Ignore warnings such as DeprecationWarning and PytestUnknownMarkWarning
filterwarnings = filterwarnings =
@ -18,7 +21,8 @@ python_files = test_*.py *_test.py *_tests.py *_suite.py *_test_*.py
python_classes = Test* *Test* *Test *Tests *Suite python_classes = Test* *Test* *Test *Tests *Suite
python_functions = test_* python_functions = test_*
# Here are the pytest markers used in the example tests: # Here are some common pytest markers:
# (Some are used in the example tests.)
# (pytest v4.5.0 and newer requires marker registration to prevent warnings.) # (pytest v4.5.0 and newer requires marker registration to prevent warnings.)
# (Future versions of pytest may turn those marker warnings into errors.) # (Future versions of pytest may turn those marker warnings into errors.)
markers = markers =
@ -32,7 +36,11 @@ markers =
offline: custom marker offline: custom marker
develop: custom marker develop: custom marker
qa: custom marker qa: custom marker
ci: custom marker
e2e: custom marker
ready: custom marker ready: custom marker
smoke: custom marker
deploy: custom marker
active: custom marker active: custom marker
master: custom marker master: custom marker
release: custom marker release: custom marker

View File

@ -1,15 +1,48 @@
[pytest] [pytest]
# Display console output, disable cacheprovider: # Display console output, disable cacheprovider, don't collect recordings:
addopts = --capture=no -p no:cacheprovider addopts = --capture=no -p no:cacheprovider --ignore=recordings
# Skip looking in these directories for tests:
norecursedirs = .* build dist recordings temp
# Ignore warnings such as DeprecationWarning and PytestUnknownMarkWarning # Ignore warnings such as DeprecationWarning and PytestUnknownMarkWarning
filterwarnings = filterwarnings =
ignore::pytest.PytestWarning ignore::pytest.PytestWarning
ignore:.*U.*mode is deprecated:DeprecationWarning ignore:.*U.*mode is deprecated:DeprecationWarning
# Configure the junit_family option explicitly:
junit_family = legacy
# Set pytest discovery rules: # Set pytest discovery rules:
# (Most of the rules here are similar to the default rules.) # (Most of the rules here are similar to the default rules.)
# (unittest.TestCase rules override the rules here for classes and functions.) # (unittest.TestCase rules override the rules here for classes and functions.)
python_files = *.py python_files = *.py
python_classes = Test* *Test* *Test *Tests *Suite
python_functions = test_* python_functions = test_*
# Here are some common pytest markers:
# (Some are used in the example tests.)
# (pytest v4.5.0 and newer requires marker registration to prevent warnings.)
# (Future versions of pytest may turn those marker warnings into errors.)
markers =
marker1: custom marker
marker2: custom marker
marker3: custom marker
marker_test_suite: custom marker
expected_failure: custom marker
local: custom marker
remote: custom marker
offline: custom marker
develop: custom marker
qa: custom marker
ci: custom marker
e2e: custom marker
ready: custom marker
smoke: custom marker
deploy: custom marker
active: custom marker
master: custom marker
release: custom marker
staging: custom marker
production: custom marker

View File

@ -1,7 +1,10 @@
[pytest] [pytest]
# Display console output, disable cacheprovider: # Display console output, disable cacheprovider, don't collect recordings:
addopts = --capture=no -p no:cacheprovider addopts = --capture=no -p no:cacheprovider --ignore=recordings
# Skip looking in these directories for tests:
norecursedirs = .* build dist recordings temp
# Ignore warnings such as DeprecationWarning and PytestUnknownMarkWarning # Ignore warnings such as DeprecationWarning and PytestUnknownMarkWarning
filterwarnings = filterwarnings =

View File

@ -1,7 +1,10 @@
[pytest] [pytest]
# Display console output, disable cacheprovider: # Display console output, disable cacheprovider, don't collect recordings:
addopts = --capture=no -p no:cacheprovider addopts = --capture=no -p no:cacheprovider --ignore=recordings
# Skip looking in these directories for tests:
norecursedirs = .* build dist recordings temp
# Ignore warnings such as DeprecationWarning and PytestUnknownMarkWarning # Ignore warnings such as DeprecationWarning and PytestUnknownMarkWarning
filterwarnings = filterwarnings =

View File

@ -1,7 +1,10 @@
[pytest] [pytest]
# Display console output, disable cacheprovider: # Display console output, disable cacheprovider, don't collect recordings:
addopts = --capture=no -p no:cacheprovider addopts = --capture=no -p no:cacheprovider --ignore=recordings
# Skip looking in these directories for tests:
norecursedirs = .* build dist recordings temp
# Ignore warnings such as DeprecationWarning and PytestUnknownMarkWarning # Ignore warnings such as DeprecationWarning and PytestUnknownMarkWarning
filterwarnings = filterwarnings =

View File

@ -121,7 +121,10 @@ def main():
data = [] data = []
data.append("[pytest]") data.append("[pytest]")
data.append("addopts = --capture=no -p no:cacheprovider") data.append(
"addopts = --capture=no -p no:cacheprovider --ignore=recordings"
)
data.append("norecursedirs = .* build dist recordings temp")
data.append("filterwarnings =") data.append("filterwarnings =")
data.append(" ignore::pytest.PytestWarning") data.append(" ignore::pytest.PytestWarning")
data.append(" ignore:.*U.*mode is deprecated:DeprecationWarning") data.append(" ignore:.*U.*mode is deprecated:DeprecationWarning")