Skip to content

MAINT: remove py37 #49

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 14, 2024
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
4 changes: 1 addition & 3 deletions .github/workflows/ci_workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ jobs:
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
Expand Down
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
0.7 (unreleased)
----------------

- Minimum Python version is now 3.8. [#49]

0.6.1 (2023-11-27)
------------------

Expand Down
14 changes: 7 additions & 7 deletions pytest_arraydiff/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
abstractclassmethod = abc.abstractclassmethod


class BaseDiff(object, metaclass=abc.ABCMeta):
class BaseDiff(metaclass=abc.ABCMeta):

@abstractstaticmethod
def read(filename):
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -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']
Expand Down
7 changes: 3 additions & 4 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -29,11 +28,11 @@ 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.
Expand All @@ -48,7 +47,7 @@ pytest11 =
pytest_arraydiff = pytest_arraydiff.plugin

[tool:pytest]
minversion = 4.6
minversion = 5.0
testpaths = tests
xfail_strict = true
markers =
Expand Down
12 changes: 6 additions & 6 deletions tests/test_pytest_arraydiff.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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


Expand Down Expand Up @@ -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')))
Expand Down Expand Up @@ -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')))

Expand Down
5 changes: 2 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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.*
Expand Down
Loading