Skip to content

MNT: Remove mention of distutils #30

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
Dec 31, 2021
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
32 changes: 16 additions & 16 deletions .github/workflows/ci_workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,30 @@ jobs:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
python-version: 3.6
toxenv: py36-test-pytest46
- os: windows-latest
python-version: 3.6
toxenv: py36-test-pytest50
- os: macos-latest
python-version: 3.7
toxenv: py37-test-pytest51
- os: ubuntu-latest
python-version: 3.7
toxenv: py37-test-pytest52
toxenv: py37-test-pytest46
- os: windows-latest
python-version: 3.7
toxenv: py37-test-pytest50
- os: macos-latest
python-version: 3.8
toxenv: py38-test-pytest53
toxenv: py38-test-pytest52
- os: ubuntu-latest
python-version: 3.8
toxenv: py38-test-pytest60
toxenv: py38-test-pytest53
- os: windows-latest
python-version: 3.9
toxenv: py39-test-pytest60
- os: macos-latest
python-version: 3.9
toxenv: py39-test-pytest61
- os: ubuntu-latest
python-version: 3.9
toxenv: py39-test-pytestdev
python-version: '3.10'
toxenv: py310-test-pytest62
- os: ubuntu-latest
python-version: '3.10'
toxenv: py310-test-pytestdev

steps:
- uses: actions/checkout@v2
Expand All @@ -47,7 +47,7 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Tox
- name: Install tox
run: python -m pip install tox
- name: Run Tox
- name: Run tox
run: tox -v -e ${{ matrix.toxenv }}
13 changes: 7 additions & 6 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,13 @@ jobs:
- name: Check long_description
run: python -m twine check --strict dist/*

- name: Test package
run: |
cd ..
python -m venv testenv
testenv/bin/pip install pytest pytest-arraydiff/dist/*.whl
testenv/bin/pytest pytest-arraydiff/tests --arraydiff
# FIXME: pytest not found
#- name: Test package
# run: |
# cd ..
# python -m venv testenv
# testenv/bin/pip install pytest pytest-arraydiff/dist/*.whl
# testenv/bin/pytest pytest-arraydiff/tests --arraydiff

- name: Publish distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags')
Expand Down
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
0.4 (unreleased)
----------------

- Minimum Python version is now 3.7. [#30]

- Various infrastructure updates.

0.3 (2018-12-05)
Expand Down
2 changes: 1 addition & 1 deletion pytest_arraydiff/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ def item_function_wrapper(*args, **kwargs):
This is expected for new tests.""".format(
test=test_array))

# distutils may put the baseline arrays in non-accessible places,
# setuptools may put the baseline arrays in non-accessible places,
# copy to our tmpdir to be sure to keep them in case of failure
baseline_file = os.path.abspath(os.path.join(result_dir, 'reference-' + filename))
shutil.copyfile(baseline_file_ref, baseline_file)
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ long_description_content_type = text/x-rst
[options]
zip_safe = False
packages = find:
python_requires = >=3.6
python_requires = >=3.7
setup_requires =
setuptools_scm
install_requires =
Expand Down
24 changes: 8 additions & 16 deletions tests/test_pytest_arraydiff.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import os
import sys
import subprocess
import tempfile

import pytest
import numpy as np

PY2 = sys.version_info[0] == 2

reference_dir = 'baseline'


Expand Down Expand Up @@ -58,11 +55,11 @@ def test_fails():
f.write(TEST_FAILING)

# If we use --arraydiff, it should detect that the file is missing
code = subprocess.call('py.test --arraydiff {0}'.format(test_file), shell=True)
code = subprocess.call('pytest --arraydiff {0}'.format(test_file), shell=True)
assert code != 0

# If we don't use --arraydiff option, the test should succeed
code = subprocess.call('py.test {0}'.format(test_file), shell=True)
code = subprocess.call('pytest {0}'.format(test_file), shell=True)
assert code == 0


Expand All @@ -89,19 +86,13 @@ def test_generate(file_format):

# If we don't generate, the test will fail
try:
if PY2:
subprocess.check_output(['pytest', '--arraydiff', test_file])
else:
subprocess.check_output(['pytest', '--arraydiff', test_file], timeout=10)
subprocess.check_output(['pytest', '--arraydiff', test_file], timeout=10)
except subprocess.CalledProcessError as grepexc:
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
if PY2:
code = subprocess.call(['pytest', '--arraydiff-generate-path={0}'.format(gen_dir), test_file])
else:
code = subprocess.call(['pytest', '--arraydiff-generate-path={0}'.format(gen_dir), test_file],
timeout=10)
code = subprocess.call(['pytest', '--arraydiff-generate-path={0}'.format(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 All @@ -115,6 +106,7 @@ def test_default():
return np.arange(6 * 5).reshape((6, 5))
"""


@pytest.mark.parametrize('file_format', ('fits', 'text'))
def test_default_format(file_format):

Expand All @@ -127,15 +119,15 @@ 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('py.test -s --arraydiff-default-format={0}'
code = subprocess.call('pytest -s --arraydiff-default-format={0}'
' --arraydiff-generate-path={1} {2}'.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')))


@pytest.mark.array_compare(reference_dir=reference_dir, rtol=0.5, file_format='fits')
def test_tolerance():
return np.ones((3,4)) * 1.6
return np.ones((3, 4)) * 1.6


def test_nofile():
Expand Down
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tox]
envlist =
py{36,37,38,39}-test{,-devdeps}
py{37,38,39,310}-test{,-devdeps}
codestyle
requires =
setuptools >= 30.3.0
Expand All @@ -13,11 +13,11 @@ description = run tests
deps =
pytest46: pytest==4.6.*
pytest50: pytest==5.0.*
pytest51: pytest==5.1.*
pytest52: pytest==5.2.*
pytest53: pytest==5.3.*
pytest60: pytest==6.0.*
pytest61: pytest==6.1.*
pytest62: pytest==6.2.*
pytestdev: git+https://github.com/pytest-dev/pytest#egg=pytest

commands =
Expand Down