Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't show the coverage report in the tests unless the full test suite is run #132

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ def pytest_addoption(parser):
help="disable the Hypothesis deadline",
)

parser.addoption(
'--force-cov',
action='store_true',
default=False,
help='force coverage to be enabled',
)

def pytest_configure(config):
# Set Hypothesis max_examples.
Expand All @@ -53,6 +59,11 @@ def pytest_configure(config):

hypothesis.settings.load_profile("ndindex-hypothesis-overridden")

if not config.getoption('--force-cov') and getattr(config, 'args', []) not in [[], ['ndindex'], ['ndindex/']]:
cov = config.pluginmanager.get_plugin('_cov')
cov.options.no_cov = True
if cov.cov_controller:
cov.cov_controller.pause()

settings.register_profile('ndindex_hypothesis_profile', deadline=800)
settings.load_profile('ndindex_hypothesis_profile')
2 changes: 1 addition & 1 deletion pytest.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[pytest]
addopts = --cov=ndindex/ --cov-report=term-missing --flakes --full-trace
addopts = --cov=ndindex/ --cov-report=term-missing --no-cov-on-fail --flakes --full-trace
filterwarnings = error