From 4ebf42f8290d39dd32e32040f62bdf2655dfda0c Mon Sep 17 00:00:00 2001 From: Bradley Dice Date: Sun, 23 Apr 2023 16:12:41 -0500 Subject: [PATCH 1/6] Expect failures due to numerical precision in miniball. --- tests/test_polyhedron.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_polyhedron.py b/tests/test_polyhedron.py index 7a2adcc5..5ed2b5e4 100644 --- a/tests/test_polyhedron.py +++ b/tests/test_polyhedron.py @@ -712,6 +712,7 @@ def test_form_factor(cube): named_prismantiprism_mark, named_pyramiddipyramid_mark, ) +@pytest.mark.xfail(reason="Numerical precision problems with miniball. See https://github.com/glotzerlab/coxeter/issues/179") def test_get_set_minimal_bounding_sphere_radius(poly): _test_get_set_minimal_bounding_sphere_radius(poly) From 4191cc4bf92a4e168436595513cc31fdffaf6515 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 23 Apr 2023 21:14:32 +0000 Subject: [PATCH 2/6] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- tests/test_polyhedron.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/test_polyhedron.py b/tests/test_polyhedron.py index 5ed2b5e4..5bf4f179 100644 --- a/tests/test_polyhedron.py +++ b/tests/test_polyhedron.py @@ -712,7 +712,9 @@ def test_form_factor(cube): named_prismantiprism_mark, named_pyramiddipyramid_mark, ) -@pytest.mark.xfail(reason="Numerical precision problems with miniball. See https://github.com/glotzerlab/coxeter/issues/179") +@pytest.mark.xfail( + reason="Numerical precision problems with miniball. See https://github.com/glotzerlab/coxeter/issues/179" +) def test_get_set_minimal_bounding_sphere_radius(poly): _test_get_set_minimal_bounding_sphere_radius(poly) From ae61cc1762745b0d8d199e8f2c672921ec391181 Mon Sep 17 00:00:00 2001 From: Bradley Dice Date: Sun, 23 Apr 2023 14:16:43 -0700 Subject: [PATCH 3/6] Wrap reason message. --- tests/test_polyhedron.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/test_polyhedron.py b/tests/test_polyhedron.py index 5bf4f179..73b26c77 100644 --- a/tests/test_polyhedron.py +++ b/tests/test_polyhedron.py @@ -713,7 +713,10 @@ def test_form_factor(cube): named_pyramiddipyramid_mark, ) @pytest.mark.xfail( - reason="Numerical precision problems with miniball. See https://github.com/glotzerlab/coxeter/issues/179" + reason=( + "Numerical precision problems with miniball. " + "See https://github.com/glotzerlab/coxeter/issues/179" + ) ) def test_get_set_minimal_bounding_sphere_radius(poly): _test_get_set_minimal_bounding_sphere_radius(poly) From 93068fa2e5b898c30fafcf0cd8cd88d983c26820 Mon Sep 17 00:00:00 2001 From: Bradley Dice Date: Sun, 23 Apr 2023 14:41:27 -0700 Subject: [PATCH 4/6] Add longer deadlines to some tests. --- tests/test_spheropolygon.py | 1 + tests/test_spheropolyhedron.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/test_spheropolygon.py b/tests/test_spheropolygon.py index a1d34b6e..224b17e3 100644 --- a/tests/test_spheropolygon.py +++ b/tests/test_spheropolygon.py @@ -192,6 +192,7 @@ def testfun(perimeter): testfun() +@settings(deadline=1000) @pytest.mark.parametrize("shape", regular_polygons()) def test_distance_to_surface_regular_ngons(shape): """Make sure shape distance works for regular ngons.""" diff --git a/tests/test_spheropolyhedron.py b/tests/test_spheropolyhedron.py index b3c33bcb..c744c22e 100644 --- a/tests/test_spheropolyhedron.py +++ b/tests/test_spheropolyhedron.py @@ -3,7 +3,7 @@ # This software is licensed under the BSD 3-Clause License. import numpy as np import pytest -from hypothesis import given +from hypothesis import given, settings from hypothesis.strategies import floats from pytest import approx @@ -33,6 +33,7 @@ def test_set_volume(value): assert sphero_cube.volume == approx(value) +@settings(deadline=1000) @given(radius=floats(0.1, 1)) def test_surface_area(radius): sphero_cube = make_sphero_cube(radius=radius) @@ -69,6 +70,7 @@ def test_invalid_radius(r): make_sphero_cube(radius=r) +@settings(deadline=1000) @given(r=floats(-1000, -1)) def test_invalid_radius_setter(r): sphero_cube = make_sphero_cube(1) From 5b5d5e5df8d3797167c20f92c34b7048adaa0c03 Mon Sep 17 00:00:00 2001 From: Bradley Dice Date: Sun, 23 Apr 2023 15:34:41 -0700 Subject: [PATCH 5/6] Remove deadline on non-hypothesis test. --- tests/test_spheropolygon.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/test_spheropolygon.py b/tests/test_spheropolygon.py index 224b17e3..a1d34b6e 100644 --- a/tests/test_spheropolygon.py +++ b/tests/test_spheropolygon.py @@ -192,7 +192,6 @@ def testfun(perimeter): testfun() -@settings(deadline=1000) @pytest.mark.parametrize("shape", regular_polygons()) def test_distance_to_surface_regular_ngons(shape): """Make sure shape distance works for regular ngons.""" From 0177e7f79073dfc3eac105392dfb1767a4b14bf2 Mon Sep 17 00:00:00 2001 From: Bradley Dice Date: Sun, 23 Apr 2023 15:52:12 -0700 Subject: [PATCH 6/6] Extend deadline for test_insphere_catalan. --- tests/test_polyhedron.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_polyhedron.py b/tests/test_polyhedron.py index 73b26c77..6bd919e4 100644 --- a/tests/test_polyhedron.py +++ b/tests/test_polyhedron.py @@ -553,7 +553,7 @@ def test_insphere_catalan(poly): ) # The insphere of a catalan solid should be rotation invariant. - @settings(deadline=1200) + @settings(deadline=5000) @given(Random3DRotationStrategy) def check_rotation_invariance(quat): rotated_poly = ConvexPolyhedron(rowan.rotate(quat, poly.vertices))