diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..ec8a646 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,10 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: ".github/workflows" + schedule: + interval: "monthly" + groups: + actions: + patterns: + - "*" diff --git a/.github/workflows/ci_workflows.yml b/.github/workflows/ci_workflows.yml index 179eb53..c1d298c 100644 --- a/.github/workflows/ci_workflows.yml +++ b/.github/workflows/ci_workflows.yml @@ -6,6 +6,7 @@ on: schedule: # Run every Sunday at 06:53 UTC - cron: 53 6 * * 0 + workflow_dispatch: concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -13,13 +14,11 @@ concurrency: jobs: tests: - uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@v1 + uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@8c0fde6f7e926df6ed7057255d29afa9c1ad5320 # v1.16.0 with: envs: | - linux: codestyle - - linux: py37-test-pytestoldest - - macos: py37-test-pytest50 - - windows: py38-test-pytest52 + - windows: py38-test-pytestoldest - linux: py38-test-pytest53 - macos: py39-test-pytest60 - windows: py39-test-pytest61 @@ -32,7 +31,7 @@ jobs: - linux: py312-test-devdeps publish: needs: tests - uses: OpenAstronomy/github-actions-workflows/.github/workflows/publish_pure_python.yml@v1 + uses: OpenAstronomy/github-actions-workflows/.github/workflows/publish_pure_python.yml@8c0fde6f7e926df6ed7057255d29afa9c1ad5320 # v1.16.0 with: test_extras: test test_command: pytest $GITHUB_WORKSPACE/tests; pytest --arraydiff $GITHUB_WORKSPACE/tests diff --git a/CHANGES.md b/CHANGES.md index e9643bc..fd4df99 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,8 @@ +0.7 (unreleased) +---------------- + +- Minimum Python version is now 3.8. [#49] + 0.6.1 (2023-11-27) ------------------ diff --git a/pytest_arraydiff/plugin.py b/pytest_arraydiff/plugin.py index 825c9b6..0801570 100755 --- a/pytest_arraydiff/plugin.py +++ b/pytest_arraydiff/plugin.py @@ -43,7 +43,7 @@ abstractclassmethod = abc.abstractclassmethod -class BaseDiff(object, metaclass=abc.ABCMeta): +class BaseDiff(metaclass=abc.ABCMeta): @abstractstaticmethod def read(filename): @@ -83,8 +83,8 @@ def compare(cls, reference_file, test_file, atol=None, rtol=None): try: np.testing.assert_allclose(array_ref, array_new, atol=atol, rtol=rtol) except AssertionError as exc: - message = "\n\na: {0}".format(test_file) + '\n' - message += "b: {0}".format(reference_file) + '\n' + message = f"\n\na: {test_file}" + '\n' + message += f"b: {reference_file}" + '\n' message += exc.args[0] return False, message else: @@ -160,8 +160,8 @@ def compare(cls, reference_file, test_file, atol=None, rtol=None): try: pdt.assert_frame_equal(ref_data, test_data) except AssertionError as exc: - message = "\n\na: {0}".format(test_file) + '\n' - message += "b: {0}".format(reference_file) + '\n' + message = f"\n\na: {test_file}" + '\n' + message += f"b: {reference_file}" + '\n' message += exc.args[0] return False, message else: @@ -251,7 +251,7 @@ def wrapper(*args, **kwargs): item.obj = array_interceptor(plugin, item.obj) -class ArrayComparison(object): +class ArrayComparison: def __init__(self, config, reference_dir=None, generate_dir=None, default_format='text'): self.config = config @@ -272,7 +272,7 @@ def pytest_runtest_call(self, item): file_format = compare.kwargs.get('file_format', self.default_format) if file_format not in FORMATS: - raise ValueError("Unknown format: {0}".format(file_format)) + raise ValueError(f"Unknown format: {file_format}") if 'extension' in compare.kwargs: extension = compare.kwargs['extension'] diff --git a/setup.cfg b/setup.cfg index 68f7426..e7c6878 100644 --- a/setup.cfg +++ b/setup.cfg @@ -12,7 +12,6 @@ classifiers = Programming Language :: Python Programming Language :: Python :: 3 Programming Language :: Python :: 3 :: Only - Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 @@ -29,25 +28,26 @@ long_description_content_type = text/x-rst [options] zip_safe = False packages = find: -python_requires = >=3.7 +python_requires = >=3.8 setup_requires = setuptools_scm install_requires = - pytest>=4.6 + pytest>=5.0 numpy +# tables limitation is until 3.9.3 is out as that supports ARM OSX. [options.extras_require] test = astropy pandas - tables + tables;platform_machine!='arm64' [options.entry_points] pytest11 = pytest_arraydiff = pytest_arraydiff.plugin [tool:pytest] -minversion = 4.6 +minversion = 5.0 testpaths = tests xfail_strict = true markers = diff --git a/tests/test_pytest_arraydiff.py b/tests/test_pytest_arraydiff.py index da603fa..31c12cb 100644 --- a/tests/test_pytest_arraydiff.py +++ b/tests/test_pytest_arraydiff.py @@ -40,7 +40,7 @@ def test_succeeds_func_fits_hdu(): return fits.PrimaryHDU(np.arange(3 * 5).reshape((3, 5)).astype(np.int64)) -class TestClass(object): +class TestClass: @pytest.mark.array_compare(file_format='fits', reference_dir=reference_dir) def test_succeeds_class(self): @@ -66,11 +66,11 @@ def test_fails(): f.write(TEST_FAILING) # If we use --arraydiff, it should detect that the file is missing - code = subprocess.call('pytest --arraydiff {0}'.format(test_file), shell=True) + code = subprocess.call(f'pytest --arraydiff {test_file}', shell=True) assert code != 0 # If we don't use --arraydiff option, the test should succeed - code = subprocess.call('pytest {0}'.format(test_file), shell=True) + code = subprocess.call(f'pytest {test_file}', shell=True) assert code == 0 @@ -102,7 +102,7 @@ def test_generate(file_format): assert b'File not found for comparison test' in grepexc.output # If we do generate, the test should succeed and a new file will appear - code = subprocess.call(['pytest', '--arraydiff-generate-path={0}'.format(gen_dir), test_file], + code = subprocess.call(['pytest', f'--arraydiff-generate-path={gen_dir}', test_file], timeout=10) assert code == 0 assert os.path.exists(os.path.join(gen_dir, 'test_gen.' + ('fits' if file_format == 'fits' else 'txt'))) @@ -130,8 +130,8 @@ def test_default_format(file_format): gen_dir = os.path.join(tmpdir, 'spam', 'egg') # If we do generate, the test should succeed and a new file will appear - code = subprocess.call('pytest -s --arraydiff-default-format={0}' - ' --arraydiff-generate-path={1} {2}'.format(file_format, gen_dir, test_file), shell=True) + code = subprocess.call('pytest -s --arraydiff-default-format={}' + ' --arraydiff-generate-path={} {}'.format(file_format, gen_dir, test_file), shell=True) assert code == 0 assert os.path.exists(os.path.join(gen_dir, 'test_default.' + ('fits' if file_format == 'fits' else 'txt'))) diff --git a/tox.ini b/tox.ini index 7fda9f0..f944009 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] envlist = - py{37,38,39,310,311,312}-test{,-pytestoldest,-pytest50,-pytest52,-pytest53,-pytest60,-pytest61,-pytest62,-pytest70,-pytest71,-pytest72,-pytest73,-pytest74,-devdeps} + py{38,39,310,311,312}-test{,-pytestoldest,-pytest52,-pytest53,-pytest60,-pytest61,-pytest62,-pytest70,-pytest71,-pytest72,-pytest73,-pytest74,-devdeps} codestyle requires = setuptools >= 30.3.0 @@ -13,8 +13,7 @@ setenv = 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 description = run tests deps = - pytestoldest: pytest==4.6.0 - pytest50: pytest==5.0.* + pytestoldest: pytest==5.0.0 pytest52: pytest==5.2.* pytest53: pytest==5.3.* pytest60: pytest==6.0.*