Skip to content

Commit c5f1af7

Browse files
authored
Move tests out of installable distribution (#829)
* Move tests out of installable distribution * Add release note
1 parent eab1742 commit c5f1af7

45 files changed

Lines changed: 63 additions & 79 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/codecov.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ coverage:
88
default:
99
target: 100
1010
ignore:
11-
- "numcodecs/tests/**"
11+
- "tests/**"
1212
comment:
1313
layout: "diff, files"
1414
behavior: default

MANIFEST.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
recursive-include c-blosc *
22
recursive-include numcodecs *.pyx
33
recursive-include numcodecs *.pxd
4-
include numcodecs/tests/package_with_entrypoint-0.1.dist-info/entry_points.txt

docs/release.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ Release notes
1717
Unreleased
1818
----------
1919

20+
Maintenance
21+
~~~~~~~~~~~
22+
23+
* Move tests out of installable package into top-level ``tests/`` directory.
24+
By :user:`Max Jones <maxrjones>`, :issue:`829`
25+
2026
.. _release_0.16.5:
2127

2228
0.16.5

notebooks/benchmark_vlen.ipynb

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,10 @@
6363
},
6464
{
6565
"cell_type": "code",
66-
"execution_count": 3,
66+
"execution_count": null,
6767
"metadata": {},
6868
"outputs": [],
69-
"source": [
70-
"from numcodecs.tests.common import greetings\n",
71-
"\n",
72-
"msgpack_codec = numcodecs.MsgPack()\n",
73-
"json_codec = numcodecs.JSON()\n",
74-
"pickle_codec = numcodecs.Pickle()\n",
75-
"cat_codec = numcodecs.Categorize(greetings, dtype=object, astype='u1')\n",
76-
"vlen_codec = numcodecs.VLenUTF8()"
77-
]
69+
"source": "from tests.common import greetings\n\nmsgpack_codec = numcodecs.MsgPack()\njson_codec = numcodecs.JSON()\npickle_codec = numcodecs.Pickle()\ncat_codec = numcodecs.Categorize(greetings, dtype=object, astype='u1')\nvlen_codec = numcodecs.VLenUTF8()"
7870
},
7971
{
8072
"cell_type": "markdown",
@@ -677,4 +669,4 @@
677669
},
678670
"nbformat": 4,
679671
"nbformat_minor": 2
680-
}
672+
}

numcodecs/tests/__init__.py

Lines changed: 0 additions & 3 deletions
This file was deleted.

pyproject.toml

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,11 @@ test-zarr-main = [
101101

102102
[tool.setuptools]
103103
package-dir = {"" = "."}
104-
packages = ["numcodecs", "numcodecs.tests"]
104+
packages = ["numcodecs"]
105105
zip-safe = false
106106

107107
[tool.setuptools.package-data]
108-
numcodecs = [
109-
"tests/package_with_entrypoint/__init__.py",
110-
"tests/package_with_entrypoint-0.1.dist-info/entry_points.txt"
111-
]
108+
numcodecs = []
112109

113110
[tool.setuptools_scm]
114111
version_scheme = "guess-next-dev"
@@ -120,7 +117,7 @@ skip = "./.git,fixture"
120117
ignore-words-list = "ba, compiletime, hist, nd, unparseable"
121118

122119
[tool.coverage.run]
123-
omit = ["numcodecs/tests/*"]
120+
omit = ["tests/*"]
124121

125122
[tool.coverage.report]
126123
exclude_lines = [
@@ -139,7 +136,7 @@ doctest_optionflags = [
139136
"IGNORE_EXCEPTION_DETAIL",
140137
]
141138
testpaths = [
142-
"numcodecs/tests",
139+
"tests",
143140
]
144141
norecursedirs = [
145142
".git",
@@ -230,7 +227,7 @@ ignore = [
230227
]
231228

232229
[tool.ruff.lint.extend-per-file-ignores]
233-
"numcodecs/tests/**" = ["SIM201", "SIM202", "SIM300", "TRY002"]
230+
"tests/**" = ["SIM201", "SIM202", "SIM300", "TRY002"]
234231
"notebooks/**" = ["W391"] # https://github.com/astral-sh/ruff/issues/13763
235232

236233
[tool.ruff.format]
@@ -287,9 +284,9 @@ test-google-crc32c = ["test", "test-google-crc32c"]
287284
ls-deps-312 = "uv run --group test-zarr-312 uv pip freeze"
288285
ls-deps-313 = "uv run --group test-zarr-313 uv pip freeze"
289286
ls-deps-main = "uv run --group test-zarr-main uv pip freeze"
290-
test-zarr-312 = "uv run --group test-zarr-312 pytest --cov=numcodecs --cov-report=xml --cov-report=term numcodecs/tests/test_zarr3.py numcodecs/tests/test_zarr3_import.py"
291-
test-zarr-313 = "uv run --group test-zarr-313 pytest --cov=numcodecs --cov-report=xml --cov-report=term numcodecs/tests/test_zarr3.py numcodecs/tests/test_zarr3_import.py"
292-
test-zarr-main = "uv run --group test-zarr-main pytest --cov=numcodecs --cov-report=xml --cov-report=term numcodecs/tests/test_zarr3.py numcodecs/tests/test_zarr3_import.py"
287+
test-zarr-312 = "uv run --group test-zarr-312 pytest --cov=numcodecs --cov-report=xml --cov-report=term tests/test_zarr3.py tests/test_zarr3_import.py"
288+
test-zarr-313 = "uv run --group test-zarr-313 pytest --cov=numcodecs --cov-report=xml --cov-report=term tests/test_zarr3.py tests/test_zarr3_import.py"
289+
test-zarr-main = "uv run --group test-zarr-main pytest --cov=numcodecs --cov-report=xml --cov-report=term tests/test_zarr3.py tests/test_zarr3_import.py"
293290

294291
[tool.pixi.feature.test.tasks]
295292
run-tests = "pytest -v"

tests/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import pytest
2+
3+
pytest.register_assert_rewrite('tests.common')
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@
66

77
import numpy as np
88
import pytest
9-
from numpy.testing import assert_array_almost_equal, assert_array_equal
10-
119
from numcodecs import * # noqa: F403 # for eval to find names in repr tests
1210
from numcodecs.compat import ensure_bytes, ensure_ndarray
1311
from numcodecs.registry import get_codec
12+
from numpy.testing import assert_array_almost_equal, assert_array_equal
1413

1514
greetings = [
1615
'¡Hola mundo!',

numcodecs/tests/package_with_entrypoint-0.1.dist-info/entry_points.txt renamed to tests/package_with_entrypoint-0.1.dist-info/entry_points.txt

File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)