pytest-arraydiff 0.6.1__tar.gz → 0.7.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pytest_arraydiff-0.7.0/.github/dependabot.yml +10 -0
- {pytest-arraydiff-0.6.1 → pytest_arraydiff-0.7.0}/.github/workflows/ci_workflows.yml +11 -9
- {pytest-arraydiff-0.6.1 → pytest_arraydiff-0.7.0}/CHANGES.md +7 -0
- {pytest-arraydiff-0.6.1 → pytest_arraydiff-0.7.0}/MANIFEST.in +0 -1
- {pytest-arraydiff-0.6.1 → pytest_arraydiff-0.7.0}/PKG-INFO +9 -9
- {pytest-arraydiff-0.6.1 → pytest_arraydiff-0.7.0}/pyproject.toml +2 -2
- {pytest-arraydiff-0.6.1 → pytest_arraydiff-0.7.0}/pytest_arraydiff/plugin.py +19 -16
- pytest_arraydiff-0.7.0/pytest_arraydiff/version.py +34 -0
- {pytest-arraydiff-0.6.1 → pytest_arraydiff-0.7.0}/pytest_arraydiff.egg-info/PKG-INFO +9 -9
- {pytest-arraydiff-0.6.1 → pytest_arraydiff-0.7.0}/pytest_arraydiff.egg-info/SOURCES.txt +2 -0
- pytest_arraydiff-0.7.0/pytest_arraydiff.egg-info/requires.txt +11 -0
- {pytest-arraydiff-0.6.1 → pytest_arraydiff-0.7.0}/setup.cfg +8 -9
- pytest_arraydiff-0.7.0/tests/conftest.py +1 -0
- {pytest-arraydiff-0.6.1 → pytest_arraydiff-0.7.0}/tests/test_pytest_arraydiff.py +36 -6
- {pytest-arraydiff-0.6.1 → pytest_arraydiff-0.7.0}/tox.ini +11 -10
- pytest-arraydiff-0.6.1/pytest_arraydiff/version.py +0 -16
- pytest-arraydiff-0.6.1/pytest_arraydiff.egg-info/requires.txt +0 -7
- {pytest-arraydiff-0.6.1 → pytest_arraydiff-0.7.0}/.gitignore +0 -0
- {pytest-arraydiff-0.6.1 → pytest_arraydiff-0.7.0}/LICENSE +0 -0
- {pytest-arraydiff-0.6.1 → pytest_arraydiff-0.7.0}/README.rst +0 -0
- {pytest-arraydiff-0.6.1 → pytest_arraydiff-0.7.0}/pytest_arraydiff/__init__.py +0 -0
- {pytest-arraydiff-0.6.1 → pytest_arraydiff-0.7.0}/pytest_arraydiff.egg-info/dependency_links.txt +0 -0
- {pytest-arraydiff-0.6.1 → pytest_arraydiff-0.7.0}/pytest_arraydiff.egg-info/entry_points.txt +0 -0
- {pytest-arraydiff-0.6.1 → pytest_arraydiff-0.7.0}/pytest_arraydiff.egg-info/not-zip-safe +0 -0
- {pytest-arraydiff-0.6.1 → pytest_arraydiff-0.7.0}/pytest_arraydiff.egg-info/top_level.txt +0 -0
- {pytest-arraydiff-0.6.1 → pytest_arraydiff-0.7.0}/setup.py +0 -0
- {pytest-arraydiff-0.6.1 → pytest_arraydiff-0.7.0}/tests/baseline/test_absolute_tolerance.fits +0 -0
- {pytest-arraydiff-0.6.1 → pytest_arraydiff-0.7.0}/tests/baseline/test_relative_tolerance.fits +0 -0
- {pytest-arraydiff-0.6.1 → pytest_arraydiff-0.7.0}/tests/baseline/test_single_reference.fits +0 -0
- {pytest-arraydiff-0.6.1 → pytest_arraydiff-0.7.0}/tests/baseline/test_succeeds_class.fits +0 -0
- {pytest-arraydiff-0.6.1 → pytest_arraydiff-0.7.0}/tests/baseline/test_succeeds_func_default.txt +0 -0
- {pytest-arraydiff-0.6.1 → pytest_arraydiff-0.7.0}/tests/baseline/test_succeeds_func_fits.fits +0 -0
- {pytest-arraydiff-0.6.1 → pytest_arraydiff-0.7.0}/tests/baseline/test_succeeds_func_fits_hdu.fits +0 -0
- {pytest-arraydiff-0.6.1 → pytest_arraydiff-0.7.0}/tests/baseline/test_succeeds_func_pdhdf.h5 +0 -0
- {pytest-arraydiff-0.6.1 → pytest_arraydiff-0.7.0}/tests/baseline/test_succeeds_func_text.txt +0 -0
|
@@ -6,6 +6,7 @@ on:
|
|
|
6
6
|
schedule:
|
|
7
7
|
# Run every Sunday at 06:53 UTC
|
|
8
8
|
- cron: 53 6 * * 0
|
|
9
|
+
workflow_dispatch:
|
|
9
10
|
|
|
10
11
|
concurrency:
|
|
11
12
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
@@ -13,28 +14,29 @@ concurrency:
|
|
|
13
14
|
|
|
14
15
|
jobs:
|
|
15
16
|
tests:
|
|
16
|
-
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@
|
|
17
|
+
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@2835f0cacddf3f8de198db9afdb5354a5cebe0ef # v2.6.3
|
|
17
18
|
with:
|
|
18
19
|
envs: |
|
|
19
20
|
- linux: codestyle
|
|
20
|
-
-
|
|
21
|
-
- macos: py37-test-pytest50
|
|
22
|
-
- windows: py38-test-pytest52
|
|
23
|
-
- linux: py38-test-pytest53
|
|
24
|
-
- macos: py39-test-pytest60
|
|
25
|
-
- windows: py39-test-pytest61
|
|
21
|
+
- windows: py39-test-pytest62
|
|
26
22
|
- linux: py310-test-pytest62
|
|
27
23
|
- macos: py310-test-pytest70
|
|
28
24
|
- windows: py310-test-pytest71
|
|
29
25
|
- linux: py311-test-pytest72
|
|
30
26
|
- macos: py311-test-pytest73
|
|
31
27
|
- windows: py312-test-pytest74
|
|
32
|
-
- linux:
|
|
28
|
+
- linux: py313-test-pytest83
|
|
29
|
+
- linux: py313-test-pytest90
|
|
30
|
+
- linux: py313-test-parallel
|
|
31
|
+
- linux: py314t-test
|
|
32
|
+
- linux: py314t-test-parallel
|
|
33
|
+
- linux: py313-test-devdeps
|
|
33
34
|
publish:
|
|
34
35
|
needs: tests
|
|
35
|
-
uses: OpenAstronomy/github-actions-workflows/.github/workflows/publish_pure_python.yml@
|
|
36
|
+
uses: OpenAstronomy/github-actions-workflows/.github/workflows/publish_pure_python.yml@2835f0cacddf3f8de198db9afdb5354a5cebe0ef # v2.6.3
|
|
36
37
|
with:
|
|
37
38
|
test_extras: test
|
|
38
39
|
test_command: pytest $GITHUB_WORKSPACE/tests; pytest --arraydiff $GITHUB_WORKSPACE/tests
|
|
40
|
+
python-version: '3.9'
|
|
39
41
|
secrets:
|
|
40
42
|
pypi_token: ${{ secrets.pypi_password }}
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: pytest-arraydiff
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.7.0
|
|
4
4
|
Summary: pytest plugin to help with comparing array output from tests
|
|
5
5
|
Home-page: https://github.com/astropy/pytest-arraydiff
|
|
6
6
|
Author: The Astropy Developers
|
|
7
7
|
Author-email: astropy.team@gmail.com
|
|
8
|
-
License: BSD
|
|
8
|
+
License: BSD-3-Clause
|
|
9
9
|
Classifier: Development Status :: 4 - Beta
|
|
10
10
|
Classifier: Framework :: Pytest
|
|
11
11
|
Classifier: Intended Audience :: Developers
|
|
12
|
-
Classifier: License :: OSI Approved :: BSD License
|
|
13
12
|
Classifier: Operating System :: OS Independent
|
|
14
13
|
Classifier: Programming Language :: Python
|
|
15
14
|
Classifier: Programming Language :: Python :: 3
|
|
16
15
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.7
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
19
16
|
Classifier: Programming Language :: Python :: 3.9
|
|
20
17
|
Classifier: Programming Language :: Python :: 3.10
|
|
21
18
|
Classifier: Programming Language :: Python :: 3.11
|
|
22
19
|
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
23
21
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
24
22
|
Classifier: Topic :: Software Development :: Testing
|
|
25
23
|
Classifier: Topic :: Utilities
|
|
26
|
-
Requires-Python: >=3.
|
|
24
|
+
Requires-Python: >=3.9
|
|
27
25
|
Description-Content-Type: text/x-rst
|
|
28
26
|
License-File: LICENSE
|
|
29
|
-
Requires-Dist: pytest>=
|
|
27
|
+
Requires-Dist: pytest>=6.2
|
|
30
28
|
Requires-Dist: numpy
|
|
31
29
|
Provides-Extra: test
|
|
32
30
|
Requires-Dist: astropy; extra == "test"
|
|
33
31
|
Requires-Dist: pandas; extra == "test"
|
|
34
|
-
|
|
32
|
+
Provides-Extra: test-hdf5
|
|
33
|
+
Requires-Dist: tables; platform_machine != "arm64" and extra == "test-hdf5"
|
|
34
|
+
Dynamic: license-file
|
|
35
35
|
|
|
36
36
|
.. image:: https://zenodo.org/badge/DOI/10.5281/zenodo.5811772.svg
|
|
37
37
|
:target: https://doi.org/10.5281/zenodo.5811772
|
|
@@ -43,7 +43,7 @@ abstractstaticmethod = abc.abstractstaticmethod
|
|
|
43
43
|
abstractclassmethod = abc.abstractclassmethod
|
|
44
44
|
|
|
45
45
|
|
|
46
|
-
class BaseDiff(
|
|
46
|
+
class BaseDiff(metaclass=abc.ABCMeta):
|
|
47
47
|
|
|
48
48
|
@abstractstaticmethod
|
|
49
49
|
def read(filename):
|
|
@@ -83,8 +83,8 @@ class SimpleArrayDiff(BaseDiff):
|
|
|
83
83
|
try:
|
|
84
84
|
np.testing.assert_allclose(array_ref, array_new, atol=atol, rtol=rtol)
|
|
85
85
|
except AssertionError as exc:
|
|
86
|
-
message = "\n\na: {
|
|
87
|
-
message += "b: {
|
|
86
|
+
message = f"\n\na: {test_file}" + '\n'
|
|
87
|
+
message += f"b: {reference_file}" + '\n'
|
|
88
88
|
message += exc.args[0]
|
|
89
89
|
return False, message
|
|
90
90
|
else:
|
|
@@ -160,8 +160,8 @@ class PDHDFDiff(BaseDiff):
|
|
|
160
160
|
try:
|
|
161
161
|
pdt.assert_frame_equal(ref_data, test_data)
|
|
162
162
|
except AssertionError as exc:
|
|
163
|
-
message = "\n\na: {
|
|
164
|
-
message += "b: {
|
|
163
|
+
message = f"\n\na: {test_file}" + '\n'
|
|
164
|
+
message += f"b: {reference_file}" + '\n'
|
|
165
165
|
message += exc.args[0]
|
|
166
166
|
return False, message
|
|
167
167
|
else:
|
|
@@ -240,18 +240,24 @@ def wrap_array_interceptor(plugin, item):
|
|
|
240
240
|
# Only intercept array on marked array tests
|
|
241
241
|
if item.get_closest_marker('array_compare') is not None:
|
|
242
242
|
|
|
243
|
+
# Guard against wrapping more than once (e.g. when pytest-run-parallel
|
|
244
|
+
# runs the same item multiple times).
|
|
245
|
+
if getattr(item.obj, '_arraydiff_wrapped', False):
|
|
246
|
+
return
|
|
247
|
+
|
|
243
248
|
# Use the full test name as a key to ensure correct array is being retrieved
|
|
244
249
|
test_name = generate_test_name(item)
|
|
245
250
|
|
|
246
251
|
def array_interceptor(store, obj):
|
|
247
252
|
def wrapper(*args, **kwargs):
|
|
248
253
|
store.return_value[test_name] = obj(*args, **kwargs)
|
|
254
|
+
wrapper._arraydiff_wrapped = True
|
|
249
255
|
return wrapper
|
|
250
256
|
|
|
251
257
|
item.obj = array_interceptor(plugin, item.obj)
|
|
252
258
|
|
|
253
259
|
|
|
254
|
-
class ArrayComparison
|
|
260
|
+
class ArrayComparison:
|
|
255
261
|
|
|
256
262
|
def __init__(self, config, reference_dir=None, generate_dir=None, default_format='text'):
|
|
257
263
|
self.config = config
|
|
@@ -260,6 +266,10 @@ class ArrayComparison(object):
|
|
|
260
266
|
self.default_format = default_format
|
|
261
267
|
self.return_value = {}
|
|
262
268
|
|
|
269
|
+
def pytest_collection_modifyitems(self, items):
|
|
270
|
+
for item in items:
|
|
271
|
+
wrap_array_interceptor(self, item)
|
|
272
|
+
|
|
263
273
|
@pytest.hookimpl(hookwrapper=True)
|
|
264
274
|
def pytest_runtest_call(self, item):
|
|
265
275
|
|
|
@@ -272,7 +282,7 @@ class ArrayComparison(object):
|
|
|
272
282
|
file_format = compare.kwargs.get('file_format', self.default_format)
|
|
273
283
|
|
|
274
284
|
if file_format not in FORMATS:
|
|
275
|
-
raise ValueError("Unknown format: {
|
|
285
|
+
raise ValueError(f"Unknown format: {file_format}")
|
|
276
286
|
|
|
277
287
|
if 'extension' in compare.kwargs:
|
|
278
288
|
extension = compare.kwargs['extension']
|
|
@@ -298,8 +308,6 @@ class ArrayComparison(object):
|
|
|
298
308
|
|
|
299
309
|
baseline_remote = reference_dir.startswith('http')
|
|
300
310
|
|
|
301
|
-
# Run test and get array object
|
|
302
|
-
wrap_array_interceptor(self, item)
|
|
303
311
|
yield
|
|
304
312
|
test_name = generate_test_name(item)
|
|
305
313
|
if test_name not in self.return_value:
|
|
@@ -372,11 +380,6 @@ class ArrayInterceptor:
|
|
|
372
380
|
self.config = config
|
|
373
381
|
self.return_value = {}
|
|
374
382
|
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
if item.get_closest_marker('array_compare') is not None:
|
|
383
|
+
def pytest_collection_modifyitems(self, items):
|
|
384
|
+
for item in items:
|
|
379
385
|
wrap_array_interceptor(self, item)
|
|
380
|
-
|
|
381
|
-
yield
|
|
382
|
-
return
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# file generated by setuptools-scm
|
|
2
|
+
# don't change, don't track in version control
|
|
3
|
+
|
|
4
|
+
__all__ = [
|
|
5
|
+
"__version__",
|
|
6
|
+
"__version_tuple__",
|
|
7
|
+
"version",
|
|
8
|
+
"version_tuple",
|
|
9
|
+
"__commit_id__",
|
|
10
|
+
"commit_id",
|
|
11
|
+
]
|
|
12
|
+
|
|
13
|
+
TYPE_CHECKING = False
|
|
14
|
+
if TYPE_CHECKING:
|
|
15
|
+
from typing import Tuple
|
|
16
|
+
from typing import Union
|
|
17
|
+
|
|
18
|
+
VERSION_TUPLE = Tuple[Union[int, str], ...]
|
|
19
|
+
COMMIT_ID = Union[str, None]
|
|
20
|
+
else:
|
|
21
|
+
VERSION_TUPLE = object
|
|
22
|
+
COMMIT_ID = object
|
|
23
|
+
|
|
24
|
+
version: str
|
|
25
|
+
__version__: str
|
|
26
|
+
__version_tuple__: VERSION_TUPLE
|
|
27
|
+
version_tuple: VERSION_TUPLE
|
|
28
|
+
commit_id: COMMIT_ID
|
|
29
|
+
__commit_id__: COMMIT_ID
|
|
30
|
+
|
|
31
|
+
__version__ = version = '0.7.0'
|
|
32
|
+
__version_tuple__ = version_tuple = (0, 7, 0)
|
|
33
|
+
|
|
34
|
+
__commit_id__ = commit_id = 'gfa97f5625'
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: pytest-arraydiff
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.7.0
|
|
4
4
|
Summary: pytest plugin to help with comparing array output from tests
|
|
5
5
|
Home-page: https://github.com/astropy/pytest-arraydiff
|
|
6
6
|
Author: The Astropy Developers
|
|
7
7
|
Author-email: astropy.team@gmail.com
|
|
8
|
-
License: BSD
|
|
8
|
+
License: BSD-3-Clause
|
|
9
9
|
Classifier: Development Status :: 4 - Beta
|
|
10
10
|
Classifier: Framework :: Pytest
|
|
11
11
|
Classifier: Intended Audience :: Developers
|
|
12
|
-
Classifier: License :: OSI Approved :: BSD License
|
|
13
12
|
Classifier: Operating System :: OS Independent
|
|
14
13
|
Classifier: Programming Language :: Python
|
|
15
14
|
Classifier: Programming Language :: Python :: 3
|
|
16
15
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.7
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
19
16
|
Classifier: Programming Language :: Python :: 3.9
|
|
20
17
|
Classifier: Programming Language :: Python :: 3.10
|
|
21
18
|
Classifier: Programming Language :: Python :: 3.11
|
|
22
19
|
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
23
21
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
24
22
|
Classifier: Topic :: Software Development :: Testing
|
|
25
23
|
Classifier: Topic :: Utilities
|
|
26
|
-
Requires-Python: >=3.
|
|
24
|
+
Requires-Python: >=3.9
|
|
27
25
|
Description-Content-Type: text/x-rst
|
|
28
26
|
License-File: LICENSE
|
|
29
|
-
Requires-Dist: pytest>=
|
|
27
|
+
Requires-Dist: pytest>=6.2
|
|
30
28
|
Requires-Dist: numpy
|
|
31
29
|
Provides-Extra: test
|
|
32
30
|
Requires-Dist: astropy; extra == "test"
|
|
33
31
|
Requires-Dist: pandas; extra == "test"
|
|
34
|
-
|
|
32
|
+
Provides-Extra: test-hdf5
|
|
33
|
+
Requires-Dist: tables; platform_machine != "arm64" and extra == "test-hdf5"
|
|
34
|
+
Dynamic: license-file
|
|
35
35
|
|
|
36
36
|
.. image:: https://zenodo.org/badge/DOI/10.5281/zenodo.5811772.svg
|
|
37
37
|
:target: https://doi.org/10.5281/zenodo.5811772
|
|
@@ -7,6 +7,7 @@ pyproject.toml
|
|
|
7
7
|
setup.cfg
|
|
8
8
|
setup.py
|
|
9
9
|
tox.ini
|
|
10
|
+
.github/dependabot.yml
|
|
10
11
|
.github/workflows/ci_workflows.yml
|
|
11
12
|
pytest_arraydiff/__init__.py
|
|
12
13
|
pytest_arraydiff/plugin.py
|
|
@@ -18,6 +19,7 @@ pytest_arraydiff.egg-info/entry_points.txt
|
|
|
18
19
|
pytest_arraydiff.egg-info/not-zip-safe
|
|
19
20
|
pytest_arraydiff.egg-info/requires.txt
|
|
20
21
|
pytest_arraydiff.egg-info/top_level.txt
|
|
22
|
+
tests/conftest.py
|
|
21
23
|
tests/test_pytest_arraydiff.py
|
|
22
24
|
tests/baseline/test_absolute_tolerance.fits
|
|
23
25
|
tests/baseline/test_relative_tolerance.fits
|
|
@@ -3,25 +3,24 @@ name = pytest-arraydiff
|
|
|
3
3
|
url = https://github.com/astropy/pytest-arraydiff
|
|
4
4
|
author = The Astropy Developers
|
|
5
5
|
author_email = astropy.team@gmail.com
|
|
6
|
+
license = BSD-3-Clause
|
|
7
|
+
license_files = LICENSE
|
|
6
8
|
classifiers =
|
|
7
9
|
Development Status :: 4 - Beta
|
|
8
10
|
Framework :: Pytest
|
|
9
11
|
Intended Audience :: Developers
|
|
10
|
-
License :: OSI Approved :: BSD License
|
|
11
12
|
Operating System :: OS Independent
|
|
12
13
|
Programming Language :: Python
|
|
13
14
|
Programming Language :: Python :: 3
|
|
14
15
|
Programming Language :: Python :: 3 :: Only
|
|
15
|
-
Programming Language :: Python :: 3.7
|
|
16
|
-
Programming Language :: Python :: 3.8
|
|
17
16
|
Programming Language :: Python :: 3.9
|
|
18
17
|
Programming Language :: Python :: 3.10
|
|
19
18
|
Programming Language :: Python :: 3.11
|
|
20
19
|
Programming Language :: Python :: 3.12
|
|
20
|
+
Programming Language :: Python :: 3.13
|
|
21
21
|
Programming Language :: Python :: Implementation :: CPython
|
|
22
22
|
Topic :: Software Development :: Testing
|
|
23
23
|
Topic :: Utilities
|
|
24
|
-
license = BSD
|
|
25
24
|
description = pytest plugin to help with comparing array output from tests
|
|
26
25
|
long_description = file: README.rst
|
|
27
26
|
long_description_content_type = text/x-rst
|
|
@@ -29,32 +28,32 @@ long_description_content_type = text/x-rst
|
|
|
29
28
|
[options]
|
|
30
29
|
zip_safe = False
|
|
31
30
|
packages = find:
|
|
32
|
-
python_requires = >=3.
|
|
31
|
+
python_requires = >=3.9
|
|
33
32
|
setup_requires =
|
|
34
33
|
setuptools_scm
|
|
35
34
|
install_requires =
|
|
36
|
-
pytest>=
|
|
35
|
+
pytest>=6.2
|
|
37
36
|
numpy
|
|
38
37
|
|
|
39
38
|
[options.extras_require]
|
|
40
39
|
test =
|
|
41
40
|
astropy
|
|
42
41
|
pandas
|
|
43
|
-
|
|
42
|
+
test_hdf5 =
|
|
43
|
+
tables;platform_machine!='arm64'
|
|
44
44
|
|
|
45
45
|
[options.entry_points]
|
|
46
46
|
pytest11 =
|
|
47
47
|
pytest_arraydiff = pytest_arraydiff.plugin
|
|
48
48
|
|
|
49
49
|
[tool:pytest]
|
|
50
|
-
minversion =
|
|
50
|
+
minversion = 6.2
|
|
51
51
|
testpaths = tests
|
|
52
52
|
xfail_strict = true
|
|
53
53
|
markers =
|
|
54
54
|
array_compare: for functions using array comparison
|
|
55
55
|
filterwarnings =
|
|
56
56
|
error
|
|
57
|
-
ignore:distutils Version classes are deprecated
|
|
58
57
|
|
|
59
58
|
[flake8]
|
|
60
59
|
max-line-length = 150
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
pytest_plugins = ["pytester"]
|
|
@@ -24,6 +24,7 @@ def test_succeeds_func_text():
|
|
|
24
24
|
@pytest.mark.skipif(not NUMPY_LT_2_0, reason="AttributeError: `np.unicode_` was removed in the NumPy 2.0 release. Use `np.str_` instead.")
|
|
25
25
|
@pytest.mark.array_compare(file_format='pd_hdf', reference_dir=reference_dir)
|
|
26
26
|
def test_succeeds_func_pdhdf():
|
|
27
|
+
pytest.importorskip('tables') # Need this "optional" dependency
|
|
27
28
|
pd = pytest.importorskip('pandas')
|
|
28
29
|
return pd.DataFrame(data=np.arange(20, dtype='int64'),
|
|
29
30
|
columns=['test_data'])
|
|
@@ -40,7 +41,7 @@ def test_succeeds_func_fits_hdu():
|
|
|
40
41
|
return fits.PrimaryHDU(np.arange(3 * 5).reshape((3, 5)).astype(np.int64))
|
|
41
42
|
|
|
42
43
|
|
|
43
|
-
class TestClass
|
|
44
|
+
class TestClass:
|
|
44
45
|
|
|
45
46
|
@pytest.mark.array_compare(file_format='fits', reference_dir=reference_dir)
|
|
46
47
|
def test_succeeds_class(self):
|
|
@@ -66,11 +67,11 @@ def test_fails():
|
|
|
66
67
|
f.write(TEST_FAILING)
|
|
67
68
|
|
|
68
69
|
# If we use --arraydiff, it should detect that the file is missing
|
|
69
|
-
code = subprocess.call('pytest --arraydiff {
|
|
70
|
+
code = subprocess.call(f'pytest --arraydiff {test_file}', shell=True)
|
|
70
71
|
assert code != 0
|
|
71
72
|
|
|
72
73
|
# If we don't use --arraydiff option, the test should succeed
|
|
73
|
-
code = subprocess.call('pytest {
|
|
74
|
+
code = subprocess.call(f'pytest {test_file}', shell=True)
|
|
74
75
|
assert code == 0
|
|
75
76
|
|
|
76
77
|
|
|
@@ -102,7 +103,7 @@ def test_generate(file_format):
|
|
|
102
103
|
assert b'File not found for comparison test' in grepexc.output
|
|
103
104
|
|
|
104
105
|
# If we do generate, the test should succeed and a new file will appear
|
|
105
|
-
code = subprocess.call(['pytest', '--arraydiff-generate-path={
|
|
106
|
+
code = subprocess.call(['pytest', f'--arraydiff-generate-path={gen_dir}', test_file],
|
|
106
107
|
timeout=10)
|
|
107
108
|
assert code == 0
|
|
108
109
|
assert os.path.exists(os.path.join(gen_dir, 'test_gen.' + ('fits' if file_format == 'fits' else 'txt')))
|
|
@@ -130,8 +131,8 @@ def test_default_format(file_format):
|
|
|
130
131
|
gen_dir = os.path.join(tmpdir, 'spam', 'egg')
|
|
131
132
|
|
|
132
133
|
# If we do generate, the test should succeed and a new file will appear
|
|
133
|
-
code = subprocess.call('pytest -s --arraydiff-default-format={
|
|
134
|
-
' --arraydiff-generate-path={
|
|
134
|
+
code = subprocess.call('pytest -s --arraydiff-default-format={}'
|
|
135
|
+
' --arraydiff-generate-path={} {}'.format(file_format, gen_dir, test_file), shell=True)
|
|
135
136
|
assert code == 0
|
|
136
137
|
assert os.path.exists(os.path.join(gen_dir, 'test_default.' + ('fits' if file_format == 'fits' else 'txt')))
|
|
137
138
|
|
|
@@ -176,3 +177,32 @@ class TestSingleReferenceClass:
|
|
|
176
177
|
|
|
177
178
|
def test_nofile():
|
|
178
179
|
pass
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
TEST_PARALLEL = """
|
|
183
|
+
import pytest
|
|
184
|
+
import numpy as np
|
|
185
|
+
from astropy.io import fits
|
|
186
|
+
@pytest.mark.array_compare(file_format='fits')
|
|
187
|
+
def test_parallel():
|
|
188
|
+
return fits.PrimaryHDU(np.arange(3 * 5).reshape((3, 5)).astype(np.int64))
|
|
189
|
+
"""
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
def test_parallel_iterations(pytester):
|
|
193
|
+
"""Regression test: arraydiff should work with pytest-run-parallel."""
|
|
194
|
+
pytest.importorskip('pytest_run_parallel')
|
|
195
|
+
|
|
196
|
+
pytester.makepyfile(test_parallel=TEST_PARALLEL)
|
|
197
|
+
gen_dir = pytester.path / 'reference'
|
|
198
|
+
|
|
199
|
+
# Generate the reference file first
|
|
200
|
+
result = pytester.runpytest_subprocess(f'--arraydiff-generate-path={gen_dir}')
|
|
201
|
+
assert result.ret == 0
|
|
202
|
+
|
|
203
|
+
# Now run with --arraydiff and multiple iterations
|
|
204
|
+
result = pytester.runpytest_subprocess(
|
|
205
|
+
'--arraydiff', f'--arraydiff-reference-path={gen_dir}',
|
|
206
|
+
'--parallel-threads=2', '--iterations=3',
|
|
207
|
+
)
|
|
208
|
+
assert result.ret == 0
|
|
@@ -1,30 +1,27 @@
|
|
|
1
1
|
[tox]
|
|
2
2
|
envlist =
|
|
3
|
-
py{
|
|
3
|
+
py{39,310,311,312,313,314}-test{,-pytest62,-pytest70,-pytest71,-pytest72,-pytest73,-pytest74,-devdeps}
|
|
4
|
+
py{313t,314t}-test{,-parallel}
|
|
4
5
|
codestyle
|
|
5
|
-
requires =
|
|
6
|
-
setuptools >= 30.3.0
|
|
7
|
-
pip >= 19.3.1
|
|
8
6
|
isolated_build = true
|
|
9
7
|
|
|
10
8
|
[testenv]
|
|
11
9
|
changedir = .tmp/{envname}
|
|
12
10
|
setenv =
|
|
11
|
+
py313t,py314t: PYTHON_GIL = 0
|
|
13
12
|
devdeps: PIP_EXTRA_INDEX_URL = https://pypi.anaconda.org/astropy/simple https://pypi.anaconda.org/liberfa/simple https://pypi.anaconda.org/scientific-python-nightly-wheels/simple
|
|
14
13
|
description = run tests
|
|
15
14
|
deps =
|
|
16
|
-
pytestoldest: pytest==4.6.0
|
|
17
|
-
pytest50: pytest==5.0.*
|
|
18
|
-
pytest52: pytest==5.2.*
|
|
19
|
-
pytest53: pytest==5.3.*
|
|
20
|
-
pytest60: pytest==6.0.*
|
|
21
|
-
pytest61: pytest==6.1.*
|
|
22
15
|
pytest62: pytest==6.2.*
|
|
23
16
|
pytest70: pytest==7.0.*
|
|
24
17
|
pytest71: pytest==7.1.*
|
|
25
18
|
pytest72: pytest==7.2.*
|
|
26
19
|
pytest73: pytest==7.3.*
|
|
27
20
|
pytest74: pytest==7.4.*
|
|
21
|
+
pytest80: pytest==8.0.*
|
|
22
|
+
pytest83: pytest==8.3.*
|
|
23
|
+
pytest90: pytest==9.0.*
|
|
24
|
+
parallel: pytest-run-parallel
|
|
28
25
|
devdeps: git+https://github.com/pytest-dev/pytest#egg=pytest
|
|
29
26
|
devdeps: numpy>=0.0.dev0
|
|
30
27
|
devdeps: pandas>=0.0.dev0
|
|
@@ -32,6 +29,10 @@ deps =
|
|
|
32
29
|
devdeps: astropy>=0.0.dev0
|
|
33
30
|
extras =
|
|
34
31
|
test
|
|
32
|
+
# tables (PyTables) is needed for the pandas/HDF5 file_format, but
|
|
33
|
+
# has no free-threaded wheels and its sdist requires libhdf5-dev,
|
|
34
|
+
# which CI does not install. Only run these test on GIL-enabled builds.
|
|
35
|
+
!py313t-!py314t: test_hdf5
|
|
35
36
|
commands =
|
|
36
37
|
# Force numpy-dev after something in the stack downgrades it
|
|
37
38
|
devdeps: python -m pip install --pre --upgrade --extra-index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple numpy
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
# file generated by setuptools_scm
|
|
2
|
-
# don't change, don't track in version control
|
|
3
|
-
TYPE_CHECKING = False
|
|
4
|
-
if TYPE_CHECKING:
|
|
5
|
-
from typing import Tuple, Union
|
|
6
|
-
VERSION_TUPLE = Tuple[Union[int, str], ...]
|
|
7
|
-
else:
|
|
8
|
-
VERSION_TUPLE = object
|
|
9
|
-
|
|
10
|
-
version: str
|
|
11
|
-
__version__: str
|
|
12
|
-
__version_tuple__: VERSION_TUPLE
|
|
13
|
-
version_tuple: VERSION_TUPLE
|
|
14
|
-
|
|
15
|
-
__version__ = version = '0.6.1'
|
|
16
|
-
__version_tuple__ = version_tuple = (0, 6, 1)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pytest-arraydiff-0.6.1 → pytest_arraydiff-0.7.0}/pytest_arraydiff.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{pytest-arraydiff-0.6.1 → pytest_arraydiff-0.7.0}/pytest_arraydiff.egg-info/entry_points.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pytest-arraydiff-0.6.1 → pytest_arraydiff-0.7.0}/tests/baseline/test_absolute_tolerance.fits
RENAMED
|
File without changes
|
{pytest-arraydiff-0.6.1 → pytest_arraydiff-0.7.0}/tests/baseline/test_relative_tolerance.fits
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pytest-arraydiff-0.6.1 → pytest_arraydiff-0.7.0}/tests/baseline/test_succeeds_func_default.txt
RENAMED
|
File without changes
|
{pytest-arraydiff-0.6.1 → pytest_arraydiff-0.7.0}/tests/baseline/test_succeeds_func_fits.fits
RENAMED
|
File without changes
|
{pytest-arraydiff-0.6.1 → pytest_arraydiff-0.7.0}/tests/baseline/test_succeeds_func_fits_hdu.fits
RENAMED
|
File without changes
|
{pytest-arraydiff-0.6.1 → pytest_arraydiff-0.7.0}/tests/baseline/test_succeeds_func_pdhdf.h5
RENAMED
|
File without changes
|
{pytest-arraydiff-0.6.1 → pytest_arraydiff-0.7.0}/tests/baseline/test_succeeds_func_text.txt
RENAMED
|
File without changes
|