From 8a59c3726c12ddf939c171c75de5f1d8c30b8da8 Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Tue, 15 Oct 2024 15:44:01 +0200 Subject: [PATCH 1/2] Enforce ruff/flake8-pytest-style rule PT001 PT001 Use `@pytest.fixture` over `@pytest.fixture()` --- numcodecs/tests/test_entrypoints.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/numcodecs/tests/test_entrypoints.py b/numcodecs/tests/test_entrypoints.py index 4946c7ae..43503ec3 100644 --- a/numcodecs/tests/test_entrypoints.py +++ b/numcodecs/tests/test_entrypoints.py @@ -8,7 +8,7 @@ here = os.path.abspath(os.path.dirname(__file__)) -@pytest.fixture() +@pytest.fixture def set_path(): sys.path.append(here) numcodecs.registry.run_entrypoints() From 445bcc04c946c82254ed193cec33bccfeb9f8252 Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Sun, 20 Oct 2024 12:21:44 +0200 Subject: [PATCH 2/2] Enforce ruff/flake8-pytest-style rule PT012 PT012 `pytest.raises()` block should contain a single simple statement --- numcodecs/tests/test_pcodec.py | 2 +- numcodecs/tests/test_shuffle.py | 4 ++-- pyproject.toml | 1 - 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/numcodecs/tests/test_pcodec.py b/numcodecs/tests/test_pcodec.py index 6531074a..c10549bd 100644 --- a/numcodecs/tests/test_pcodec.py +++ b/numcodecs/tests/test_pcodec.py @@ -57,8 +57,8 @@ def test_config(): def test_invalid_config_error(): + codec = PCodec(mode_spec='bogus') with pytest.raises(ValueError): - codec = PCodec(mode_spec='bogus') check_encode_decode_array_to_bytes(arrays[0], codec) diff --git a/numcodecs/tests/test_shuffle.py b/numcodecs/tests/test_shuffle.py index 18afcb90..1194e598 100644 --- a/numcodecs/tests/test_shuffle.py +++ b/numcodecs/tests/test_shuffle.py @@ -162,7 +162,7 @@ def test_expected_result(): def test_incompatible_elementsize(): + arr = np.arange(1001, dtype='u1') + codec = Shuffle(elementsize=4) with pytest.raises(ValueError): - arr = np.arange(1001, dtype='u1') - codec = Shuffle(elementsize=4) codec.encode(arr) diff --git a/pyproject.toml b/pyproject.toml index 15bd8f4d..b85cb19f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -162,7 +162,6 @@ ignore = [ "PT004", # deprecated "PT005", # deprecated "PT011", - "PT012", "RUF001", "UP007", "UP027", # deprecated