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

Resolve pytest warnings about the deprecated --strict flag #2862

Closed
Closed
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
8 changes: 6 additions & 2 deletions hypothesis-python/tests/pytest/test_mark.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ def test_bar():

def test_can_select_mark(testdir):
script = testdir.makepyfile(TESTSUITE)
result = testdir.runpytest(script, "--verbose", "--strict", "-m", "hypothesis")
result = testdir.runpytest(
script, "--verbose", "--strict-markers", "-m", "hypothesis"
)
out = "\n".join(result.stdout.lines)
assert "1 passed, 1 deselected" in out

Expand All @@ -53,6 +55,8 @@ def test_bar(self):

def test_can_select_mark_on_unittest(testdir):
script = testdir.makepyfile(UNITTEST_TESTSUITE)
result = testdir.runpytest(script, "--verbose", "--strict", "-m", "hypothesis")
result = testdir.runpytest(
script, "--verbose", "--strict-markers", "-m", "hypothesis"
)
out = "\n".join(result.stdout.lines)
assert "1 passed, 1 deselected" in out
10 changes: 6 additions & 4 deletions hypothesis-python/tests/pytest/test_seeding.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def test_runs_repeatably_when_seed_is_set(seed, testdir):

results = [
testdir.runpytest(
script, "--verbose", "--strict", "--hypothesis-seed", str(seed)
script, "--verbose", "--strict-markers", "--hypothesis-seed", str(seed)
)
for _ in range(2)
]
Expand Down Expand Up @@ -94,20 +94,22 @@ def test_repeats_healthcheck_when_following_seed_instruction(testdir, tmpdir):

script = testdir.makepyfile(health_check_test)

initial = testdir.runpytest(script, "--verbose", "--strict")
initial = testdir.runpytest(script, "--verbose", "--strict-markers")

match = CONTAINS_SEED_INSTRUCTION.search("\n".join(initial.stdout.lines))
initial_output = "\n".join(initial.stdout.lines)

match = CONTAINS_SEED_INSTRUCTION.search(initial_output)
assert match is not None

rerun = testdir.runpytest(script, "--verbose", "--strict", match.group(0))
rerun = testdir.runpytest(script, "--verbose", "--strict-markers", match.group(0))
rerun_output = "\n".join(rerun.stdout.lines)

assert "FailedHealthCheck" in rerun_output
assert "--hypothesis-seed" not in rerun_output

rerun2 = testdir.runpytest(script, "--verbose", "--strict", "--hypothesis-seed=10")
rerun2 = testdir.runpytest(
script, "--verbose", "--strict-markers", "--hypothesis-seed=10"
)
rerun2_output = "\n".join(rerun2.stdout.lines)
assert "FailedHealthCheck" not in rerun2_output
4 changes: 3 additions & 1 deletion hypothesis-python/tests/pytest/test_skipping.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ def test_no_falsifying_example_if_pytest_skip(testdir):
continue running the test and shrink process, nor should it print anything
about falsifying examples."""
script = testdir.makepyfile(PYTEST_TESTSUITE)
result = testdir.runpytest(script, "--verbose", "--strict", "-m", "hypothesis")
result = testdir.runpytest(
script, "--verbose", "--strict-markers", "-m", "hypothesis"
)
out = "\n".join(result.stdout.lines)
assert "Falsifying example" not in out
4 changes: 2 additions & 2 deletions hypothesis-python/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ commands =
pip install .[zoneinfo]
python -m coverage --version
python -m coverage debug sys
python -m coverage run --rcfile=.coveragerc -m pytest -n0 --strict tests/cover tests/conjecture tests/datetime tests/numpy tests/pandas tests/lark --ff {posargs}
python -m coverage run --rcfile=.coveragerc -m pytest -n0 --strict-markers tests/cover tests/conjecture tests/datetime tests/numpy tests/pandas tests/lark --ff {posargs}
python -m coverage report -m --fail-under=100 --show-missing --skip-covered
python scripts/validate_branch_check.py

Expand All @@ -106,7 +106,7 @@ whitelist_externals=
setenv=
HYPOTHESIS_INTERNAL_COVERAGE=true
commands =
python -m coverage run --rcfile=.coveragerc --source=hypothesis.internal.conjecture -m pytest -n0 --strict tests/conjecture
python -m coverage run --rcfile=.coveragerc --source=hypothesis.internal.conjecture -m pytest -n0 --strict-markers tests/conjecture
python -m coverage report -m --fail-under=100 --show-missing --skip-covered


Expand Down
2 changes: 1 addition & 1 deletion pytest.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[pytest]

addopts=--strict --tb=native -p pytester --runpytest=subprocess --durations=20
addopts=--strict-markers --tb=native -p pytester --runpytest=subprocess --durations=20
filterwarnings =
ignore::hypothesis.errors.NonInteractiveExampleWarning