Skip to content
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
1 change: 0 additions & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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]
Expand All @@ -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 = ""
31 changes: 16 additions & 15 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -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}

Expand All @@ -28,4 +27,6 @@ def pytest_report_header(config):


def pytest_sessionstart(session):
import os

os.environ["MPMATH_NOGMPY"] = "Y"
9 changes: 4 additions & 5 deletions tests/test_memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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))
Expand All @@ -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):
Expand Down