From 3fdb37258136a07dc439c9d8bf9b25a707d180b1 Mon Sep 17 00:00:00 2001 From: mj-will Date: Mon, 11 Mar 2024 09:12:58 -0500 Subject: [PATCH 1/4] CI: add 3.12 --- .github/workflows/integration-tests.yml | 2 +- .github/workflows/tests.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 6a92fd3e..eac58ba7 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -18,7 +18,7 @@ jobs: fail-fast: false matrix: os: [macOS, Ubuntu, Windows] - python-version: ["3.8", "3.9", "3.10", "3.11"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] runs-on: ${{ matrix.os }}-latest steps: diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ee37a72b..33b6b281 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -18,7 +18,7 @@ jobs: fail-fast: false matrix: os: [macOS, Ubuntu, Windows] - python-version: ["3.8", "3.9", "3.10", "3.11"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] runs-on: ${{ matrix.os }}-latest steps: From 37d1640b8debb4ca3ad1095d50657089879eb710 Mon Sep 17 00:00:00 2001 From: mj-will Date: Mon, 11 Mar 2024 15:44:47 -0500 Subject: [PATCH 2/4] BLD: do not install ray on 3.12 --- pyproject.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 6f05da90..40507d5c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -55,7 +55,7 @@ gw = [ ] dev = [ "pre-commit", - "ray[default]", + "ray[default]; sys_platform != 'win32' or (sys_platform == 'win32' and python_version < '3.12')", "corner", "black>=24.0", ] @@ -99,6 +99,7 @@ target-version = [ "py39", "py310", "py311", + "py312", ] [tool.flake8] From 9845dce10e35babd9a7f87718b8b9613ad62d8ca Mon Sep 17 00:00:00 2001 From: mj-will Date: Mon, 11 Mar 2024 16:37:43 -0500 Subject: [PATCH 3/4] BLD: tweak ray dependency --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 40507d5c..1ab42013 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -55,7 +55,7 @@ gw = [ ] dev = [ "pre-commit", - "ray[default]; sys_platform != 'win32' or (sys_platform == 'win32' and python_version < '3.12')", + "ray[default]; sys_platform != 'win32' and python_version < '3.12'", "corner", "black>=24.0", ] From 093d3eb8a33d5daa91a21d70df6421a66757bf64 Mon Sep 17 00:00:00 2001 From: mj-will Date: Mon, 11 Mar 2024 17:01:36 -0500 Subject: [PATCH 4/4] TST: change asserts for Python 3.12 --- tests/test_flows/test_base_flow.py | 4 +--- tests/test_flowsampler.py | 2 +- tests/test_gw/test_distance_converters.py | 5 +---- tests/test_proposal/test_base_proposal.py | 2 +- 4 files changed, 4 insertions(+), 9 deletions(-) diff --git a/tests/test_flows/test_base_flow.py b/tests/test_flows/test_base_flow.py index 601f4424..3fa071b2 100644 --- a/tests/test_flows/test_base_flow.py +++ b/tests/test_flows/test_base_flow.py @@ -28,9 +28,7 @@ def test_base_flow_abstract_methods(): """Assert an error is raised if the methods are not implemented.""" with pytest.raises(TypeError) as excinfo: BaseFlow() - assert "instantiate abstract class BaseFlow with abstract method" in str( - excinfo.value - ) + assert "instantiate abstract class BaseFlow" in str(excinfo.value) @pytest.mark.parametrize( diff --git a/tests/test_flowsampler.py b/tests/test_flowsampler.py index 140a1010..75828a0c 100644 --- a/tests/test_flowsampler.py +++ b/tests/test_flowsampler.py @@ -830,7 +830,7 @@ def test_run_ins_redraw(flow_sampler): compute_initial_posterior=True, ) - assert ns.draw_posterior_samples.has_calls( + ns.draw_posterior_samples.assert_has_calls( [ call( sampling_method="importance_sampling", use_final_samples=False diff --git a/tests/test_gw/test_distance_converters.py b/tests/test_gw/test_distance_converters.py index 378e46ae..1a7bb070 100644 --- a/tests/test_gw/test_distance_converters.py +++ b/tests/test_gw/test_distance_converters.py @@ -56,10 +56,7 @@ def test_converter_error(): """Assert an error is raised if the methods are not implemented""" with pytest.raises(TypeError) as excinfo: DistanceConverter() - assert ( - "abstract methods from_uniform_parameter, to_uniform_parameter" - in str(excinfo.value) - ) + assert "abstract methods" in str(excinfo.value) def test_converter_to_uniform_parameter_error(base_converter): diff --git a/tests/test_proposal/test_base_proposal.py b/tests/test_proposal/test_base_proposal.py index 1d99b07b..33d178e1 100644 --- a/tests/test_proposal/test_base_proposal.py +++ b/tests/test_proposal/test_base_proposal.py @@ -37,7 +37,7 @@ def test_init_with_draw(): model = Mock() with pytest.raises(TypeError) as excinfo: Proposal(model) - assert "class Proposal with abstract method" in str(excinfo.value) + assert "class Proposal with" in str(excinfo.value) def test_initialised(proposal):