diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index e4e2f49a..183c3b08 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -5,7 +5,6 @@ jobs: timeout-minutes: 20 runs-on: ${{ matrix.os }} env: - PYTEST_ADDOPTS: --verbose CFLAGS: -Wall -Wpedantic -Werror -std=c17 -Wconversion strategy: matrix: diff --git a/pyproject.toml b/pyproject.toml index 3ebe6015..fdaac951 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -52,7 +52,6 @@ develop = ["python-gmp[tests,docs]", "pre-commit", "pyperf"] compile = ["--verbose"] [tool.pytest.ini_options] -addopts = "--durations=7 --capture=no" xfail_strict = true [tool.ruff] @@ -73,7 +72,7 @@ test-command = "pytest {package}" [tool.cibuildwheel.environment] LD_LIBRARY_PATH = "$(pwd)/.local/lib:$LD_LIBRARY_PATH" PKG_CONFIG_PATH = "$(pwd)/.local/lib/pkgconfig" -PYTEST_ADDOPTS = "--verbose -n 2" +PYTEST_ADDOPTS = "-n 2" CFLAGS = "-Wall -Wpedantic -Werror -Wconversion" [tool.cibuildwheel.windows] @@ -84,5 +83,5 @@ repair-wheel-command = """delvewheel repair -w {dest_dir} {wheel} \ --add-path .local/bin""" [tool.cibuildwheel.windows.environment] -PYTEST_ADDOPTS = "--verbose -n 2" +PYTEST_ADDOPTS = "-n 2" CFLAGS = "" diff --git a/tests/conftest.py b/tests/conftest.py index d25d6a30..b125f199 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,23 +1,22 @@ -import os -import platform -from datetime import timedelta +def pytest_configure(config): + if "no:hypothesispytest" not in config.getoption("-p"): + import platform -import gmp -from hypothesis import settings + from hypothesis import settings -default = settings.get_profile("default") -settings.register_profile("default", - settings(default, - deadline=timedelta(seconds=300))) -ci = settings.get_profile("ci") -if platform.python_implementation() != "GraalVM": - ci = settings(ci, max_examples=10000) -else: - ci = settings(ci, max_examples=1000) -settings.register_profile("ci", ci) + default = settings.get_profile("default") + settings.register_profile("default", settings(default, deadline=700)) + ci = settings.get_profile("ci") + if platform.python_implementation() != "GraalVM": + ci = settings(ci, max_examples=10000) + else: + ci = settings(ci, max_examples=1000) + settings.register_profile("ci", ci) def pytest_report_header(config): + import gmp + print(f""" Using the ZZ library v{gmp._zz_version} @@ -28,4 +27,6 @@ def pytest_report_header(config): def pytest_sessionstart(session): + import os + os.environ["MPMATH_NOGMPY"] = "Y" diff --git a/tests/test_memory.py b/tests/test_memory.py index 890affc4..fa95da63 100644 --- a/tests/test_memory.py +++ b/tests/test_memory.py @@ -14,14 +14,15 @@ pytest.skip("XXX: module 'resource' has no attribute 'setrlimit'", allow_module_level=True) if platform.python_implementation() == "PyPy": - pytest.skip("XXX: diofant/python-gmp#73", allow_module_level=True) + pytest.skip("See pypy/pypy#5147 and pypy/pypy#5325", + allow_module_level=True) VMEM_LIMIT = 64*1000**2 resource = pytest.importorskip("resource") def test_fac_outofmem(): - for _ in range(100): + for _ in range(20): x = random.randint(12811, 24984) soft, hard = resource.getrlimit(resource.RLIMIT_AS) resource.setrlimit(resource.RLIMIT_AS, (VMEM_LIMIT, hard)) @@ -38,7 +39,7 @@ def test_fac_outofmem(): def test_square_outofmem(): - for _ in range(100): + for _ in range(20): x = random.randint(49846727467293, 249846727467293) soft, hard = resource.getrlimit(resource.RLIMIT_AS) resource.setrlimit(resource.RLIMIT_AS, (VMEM_LIMIT, hard)) @@ -56,8 +57,6 @@ def test_square_outofmem(): resource.setrlimit(resource.RLIMIT_AS, (soft, hard)) -@pytest.mark.skipif(platform.python_implementation() == "PyPy", - reason="XXX: pypy/pypy#5325") def test_square_with_threads(): soft, hard = resource.getrlimit(resource.RLIMIT_AS) def f(n, barrier):