Skip to content

Commit

Permalink
Skip weird tests on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Zac-HD committed May 30, 2023
1 parent 6049847 commit e7d49e7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
7 changes: 3 additions & 4 deletions hypothesis-python/tests/patching/test_patching.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
# obtain one at https://mozilla.org/MPL/2.0/.

import os
import re
from datetime import datetime
from pathlib import Path
Expand All @@ -22,6 +21,7 @@
indent,
make_patch,
)
from hypothesis.internal.compat import WINDOWS

from .callables import WHERE, Cases, covered, fn
from .toplevel import WHERE_TOP, fn_top
Expand Down Expand Up @@ -188,14 +188,13 @@ def test_failing_pbt(x, y):
"""


@pytest.mark.skipif(WINDOWS, reason="backslash support is tricky")
def test_pytest_reports_patch_file_location(pytester):
script = pytester.makepyfile(TESTSCRIPT_DUMPS_PATCH)
result = pytester.runpytest(script)
result.assert_outcomes(failed=1)

fname_pat = os.sep.join(
[r"\.hypothesis", r"patches", r"\d{4}-\d\d-\d\d--[0-9a-f]{8}.patch"]
)
fname_pat = r"\.hypothesis/patches/\d{4}-\d\d-\d\d--[0-9a-f]{8}.patch"
pattern = f"`git apply ({fname_pat})` to add failing examples to your code\\."
print(f"pattern={pattern!r}")
print(f"result.stdout=\n{indent(str(result.stdout), ' ')}")
Expand Down
2 changes: 2 additions & 0 deletions hypothesis-python/tests/pytest/test_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import pytest

from hypothesis import example, given
from hypothesis.internal.compat import WINDOWS
from hypothesis.strategies import integers

from tests.common.utils import fails
Expand Down Expand Up @@ -188,6 +189,7 @@ def test(x):
"""


@pytest.mark.skipif(WINDOWS, reason="mysterious pytest parse failure???")
def test_given_fails_if_already_decorated_with_fixture(testdir):
script = testdir.makepyfile(TESTSCRIPT_FIXTURE_THEN_GIVEN)
testdir.runpytest(script).assert_outcomes(failed=1)
Expand Down
5 changes: 5 additions & 0 deletions hypothesis-python/tests/pytest/test_parametrized_db_keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
# obtain one at https://mozilla.org/MPL/2.0/.

import pytest

from hypothesis.internal.compat import WINDOWS

DB_KEY_TESTCASE = """
from hypothesis import settings, given
from hypothesis.database import InMemoryExampleDatabase
Expand All @@ -30,6 +34,7 @@ def test_DB_keys_for_parametrized_test():
"""


@pytest.mark.skipif(WINDOWS, reason="mysterious pytest parse failure???")
def test_db_keys_for_parametrized_tests_are_unique(testdir):
script = testdir.makepyfile(DB_KEY_TESTCASE)
testdir.runpytest(script).assert_outcomes(xfailed=3, passed=1)

0 comments on commit e7d49e7

Please sign in to comment.