Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ coverage:
default:
target: 100
ignore:
- "numcodecs/tests/**"
- "tests/**"
comment:
layout: "diff, files"
behavior: default
Expand Down
1 change: 0 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
recursive-include c-blosc *
recursive-include numcodecs *.pyx
recursive-include numcodecs *.pxd
include numcodecs/tests/package_with_entrypoint-0.1.dist-info/entry_points.txt
6 changes: 6 additions & 0 deletions docs/release.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ Release notes
Unreleased
----------

Maintenance
~~~~~~~~~~~

* Move tests out of installable package into top-level ``tests/`` directory.
By :user:`Max Jones <maxrjones>`, :issue:`829`

.. _release_0.16.5:

0.16.5
Expand Down
14 changes: 3 additions & 11 deletions notebooks/benchmark_vlen.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -63,18 +63,10 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from numcodecs.tests.common import greetings\n",
"\n",
"msgpack_codec = numcodecs.MsgPack()\n",
"json_codec = numcodecs.JSON()\n",
"pickle_codec = numcodecs.Pickle()\n",
"cat_codec = numcodecs.Categorize(greetings, dtype=object, astype='u1')\n",
"vlen_codec = numcodecs.VLenUTF8()"
]
"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()"
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -677,4 +669,4 @@
},
"nbformat": 4,
"nbformat_minor": 2
}
}
3 changes: 0 additions & 3 deletions numcodecs/tests/__init__.py

This file was deleted.

19 changes: 8 additions & 11 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,11 @@ test-zarr-main = [

[tool.setuptools]
package-dir = {"" = "."}
packages = ["numcodecs", "numcodecs.tests"]
packages = ["numcodecs"]
zip-safe = false

[tool.setuptools.package-data]
numcodecs = [
"tests/package_with_entrypoint/__init__.py",
"tests/package_with_entrypoint-0.1.dist-info/entry_points.txt"
]
numcodecs = []

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

[tool.coverage.run]
omit = ["numcodecs/tests/*"]
omit = ["tests/*"]

[tool.coverage.report]
exclude_lines = [
Expand All @@ -139,7 +136,7 @@ doctest_optionflags = [
"IGNORE_EXCEPTION_DETAIL",
]
testpaths = [
"numcodecs/tests",
"tests",
]
norecursedirs = [
".git",
Expand Down Expand Up @@ -230,7 +227,7 @@ ignore = [
]

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

[tool.ruff.format]
Expand Down Expand Up @@ -287,9 +284,9 @@ test-google-crc32c = ["test", "test-google-crc32c"]
ls-deps-312 = "uv run --group test-zarr-312 uv pip freeze"
ls-deps-313 = "uv run --group test-zarr-313 uv pip freeze"
ls-deps-main = "uv run --group test-zarr-main uv pip freeze"
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"
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"
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"
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"
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"
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"

[tool.pixi.feature.test.tasks]
run-tests = "pytest -v"
3 changes: 3 additions & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import pytest

pytest.register_assert_rewrite('tests.common')
3 changes: 1 addition & 2 deletions numcodecs/tests/common.py → tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@

import numpy as np
import pytest
from numpy.testing import assert_array_almost_equal, assert_array_equal

from numcodecs import * # noqa: F403 # for eval to find names in repr tests
from numcodecs.compat import ensure_bytes, ensure_ndarray
from numcodecs.registry import get_codec
from numpy.testing import assert_array_almost_equal, assert_array_equal

greetings = [
'¡Hola mundo!',
Expand Down
4 changes: 2 additions & 2 deletions numcodecs/tests/test_astype.py → tests/test_astype.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import numpy as np
from numcodecs.astype import AsType
from numpy.testing import assert_array_equal

from numcodecs.astype import AsType
from numcodecs.tests.common import (
from tests.common import (
check_backwards_compatibility,
check_config,
check_encode_decode,
Expand Down
4 changes: 2 additions & 2 deletions numcodecs/tests/test_base64.py → tests/test_base64.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import numpy as np
import pytest

from numcodecs.base64 import Base64
from numcodecs.tests.common import (

from tests.common import (
check_backwards_compatibility,
check_encode_decode,
check_err_decode_object_buffer,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import numpy as np
import pytest

from numcodecs.bitround import BitRound, max_bits

# adapted from https://github.com/milankl/BitInformation.jl/blob/main/test/round_nearest.jl
Expand Down
2 changes: 1 addition & 1 deletion numcodecs/tests/test_blosc.py → tests/test_blosc.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
pytest.skip("numcodecs.blosc not available", allow_module_level=True)


from numcodecs.tests.common import (
from tests.common import (
check_backwards_compatibility,
check_config,
check_encode_decode,
Expand Down
4 changes: 2 additions & 2 deletions numcodecs/tests/test_bz2.py → tests/test_bz2.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import itertools

import numpy as np

from numcodecs.bz2 import BZ2
from numcodecs.tests.common import (

from tests.common import (
check_backwards_compatibility,
check_config,
check_encode_decode,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import numpy as np
import pytest
from numcodecs.categorize import Categorize
from numpy.testing import assert_array_equal

from numcodecs.categorize import Categorize
from numcodecs.tests.common import (
from tests.common import (
check_backwards_compatibility,
check_config,
check_encode_decode,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

import numpy as np
import pytest

from numcodecs.checksum32 import CRC32, Adler32
from numcodecs.tests.common import (

from tests.common import (
check_backwards_compatibility,
check_config,
check_encode_decode,
Expand Down
1 change: 0 additions & 1 deletion numcodecs/tests/test_compat.py → tests/test_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

import numpy as np
import pytest

from numcodecs.compat import ensure_bytes, ensure_contiguous_ndarray, ensure_text


Expand Down
4 changes: 2 additions & 2 deletions numcodecs/tests/test_delta.py → tests/test_delta.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import numpy as np
import pytest
from numcodecs.delta import Delta
from numpy.testing import assert_array_equal

from numcodecs.delta import Delta
from numcodecs.tests.common import (
from tests.common import (
check_backwards_compatibility,
check_config,
check_encode_decode,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import os.path
import sys

import pytest

import numcodecs.registry
import pytest

here = os.path.abspath(os.path.dirname(__file__))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
import sys
from multiprocessing import Process

import pytest

import numcodecs.registry
import pytest

importlib_spec = importlib.util.find_spec("importlib_metadata")
if importlib_spec is None or importlib_spec.loader is None: # pragma: no cover
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

import numpy as np
import pytest
from numcodecs.fixedscaleoffset import FixedScaleOffset
from numpy.testing import assert_array_equal

from numcodecs.fixedscaleoffset import FixedScaleOffset
from numcodecs.tests.common import (
from tests.common import (
check_backwards_compatibility,
check_config,
check_encode_decode,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import numpy as np
import pytest

from numcodecs.fletcher32 import Fletcher32


Expand Down
4 changes: 2 additions & 2 deletions numcodecs/tests/test_gzip.py → tests/test_gzip.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import numpy as np
import pytest

from numcodecs.gzip import GZip
from numcodecs.tests.common import (

from tests.common import (
check_backwards_compatibility,
check_config,
check_encode_decode,
Expand Down
1 change: 0 additions & 1 deletion numcodecs/tests/test_jenkins.py → tests/test_jenkins.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import numpy as np
import pytest

from numcodecs.checksum32 import JenkinsLookup3
from numcodecs.jenkins import jenkins_lookup3

Expand Down
4 changes: 2 additions & 2 deletions numcodecs/tests/test_json.py → tests/test_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import numpy as np
import pytest

from numcodecs.json import JSON
from numcodecs.tests.common import (

from tests.common import (
check_backwards_compatibility,
check_config,
check_encode_decode_array,
Expand Down
2 changes: 1 addition & 1 deletion numcodecs/tests/test_lz4.py → tests/test_lz4.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
pytest.skip("numcodecs.lz4 not available", allow_module_level=True)


from numcodecs.tests.common import (
from tests.common import (
check_backwards_compatibility,
check_config,
check_encode_decode,
Expand Down
2 changes: 1 addition & 1 deletion numcodecs/tests/test_lzma.py → tests/test_lzma.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
raise unittest.SkipTest("LZMA not available") from e


from numcodecs.tests.common import (
from tests.common import (
check_backwards_compatibility,
check_config,
check_encode_decode,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
raise unittest.SkipTest("msgpack not available") from e


from numcodecs.tests.common import (
from tests.common import (
check_backwards_compatibility,
check_config,
check_encode_decode_array,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import pytest

from numcodecs.ndarray_like import DType, FlagsObj, NDArrayLike


Expand Down
4 changes: 2 additions & 2 deletions numcodecs/tests/test_packbits.py → tests/test_packbits.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import numpy as np

from numcodecs.packbits import PackBits
from numcodecs.tests.common import (

from tests.common import (
check_backwards_compatibility,
check_config,
check_encode_decode,
Expand Down
2 changes: 1 addition & 1 deletion numcodecs/tests/test_pcodec.py → tests/test_pcodec.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
except ImportError: # pragma: no cover
pytest.skip("pcodec not available", allow_module_level=True)

from numcodecs.tests.common import (
from tests.common import (
check_backwards_compatibility,
check_config,
check_encode_decode_array,
Expand Down
4 changes: 2 additions & 2 deletions numcodecs/tests/test_pickles.py → tests/test_pickles.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

import numpy as np
import pytest

from numcodecs.pickles import Pickle
from numcodecs.tests.common import (

from tests.common import (
check_backwards_compatibility,
check_config,
check_encode_decode_array,
Expand Down
1 change: 0 additions & 1 deletion numcodecs/tests/test_pyzstd.py → tests/test_pyzstd.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import numpy as np
import pytest
import pyzstd

from numcodecs.zstd import Zstd

test_data = [
Expand Down
4 changes: 2 additions & 2 deletions numcodecs/tests/test_quantize.py → tests/test_quantize.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

import numpy as np
import pytest
from numcodecs.quantize import Quantize
from numpy.testing import assert_array_almost_equal, assert_array_equal

from numcodecs.quantize import Quantize
from numcodecs.tests.common import (
from tests.common import (
check_backwards_compatibility,
check_config,
check_encode_decode,
Expand Down
3 changes: 1 addition & 2 deletions numcodecs/tests/test_registry.py → tests/test_registry.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import inspect

import pytest

import numcodecs
import pytest
from numcodecs.errors import UnknownCodecError
from numcodecs.registry import get_codec

Expand Down
Loading
Loading