Skip to content

Commit 3da098b

Browse files
Apply ruff/flake8-pytest-style preview rules (PT) (#606)
* Enforce ruff/flake8-pytest-style rule PT001 PT001 Use `@pytest.fixture` over `@pytest.fixture()` * Enforce ruff/flake8-pytest-style rule PT012 PT012 `pytest.raises()` block should contain a single simple statement
1 parent 8576fef commit 3da098b

File tree

4 files changed

+4
-5
lines changed

4 files changed

+4
-5
lines changed

numcodecs/tests/test_entrypoints.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
here = os.path.abspath(os.path.dirname(__file__))
99

1010

11-
@pytest.fixture()
11+
@pytest.fixture
1212
def set_path():
1313
sys.path.append(here)
1414
numcodecs.registry.run_entrypoints()

numcodecs/tests/test_pcodec.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ def test_config():
5757

5858

5959
def test_invalid_config_error():
60+
codec = PCodec(mode_spec='bogus')
6061
with pytest.raises(ValueError):
61-
codec = PCodec(mode_spec='bogus')
6262
check_encode_decode_array_to_bytes(arrays[0], codec)
6363

6464

numcodecs/tests/test_shuffle.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ def test_expected_result():
162162

163163

164164
def test_incompatible_elementsize():
165+
arr = np.arange(1001, dtype='u1')
166+
codec = Shuffle(elementsize=4)
165167
with pytest.raises(ValueError):
166-
arr = np.arange(1001, dtype='u1')
167-
codec = Shuffle(elementsize=4)
168168
codec.encode(arr)

pyproject.toml

-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,6 @@ ignore = [
162162
"PT004", # deprecated
163163
"PT005", # deprecated
164164
"PT011",
165-
"PT012",
166165
"RUF001",
167166
"UP007",
168167
"UP027", # deprecated

0 commit comments

Comments
 (0)