Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-pytest-arraydiff for openSUSE:Factory checked in at 2022-11-08 10:54:54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-pytest-arraydiff (Old) and /work/SRC/openSUSE:Factory/.python-pytest-arraydiff.new.1597 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pytest-arraydiff" Tue Nov 8 10:54:54 2022 rev:4 rq:1034429 version:0.5.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-pytest-arraydiff/python-pytest-arraydiff.changes 2021-04-27 21:34:26.859962603 +0200 +++ /work/SRC/openSUSE:Factory/.python-pytest-arraydiff.new.1597/python-pytest-arraydiff.changes 2022-11-08 10:55:15.117811801 +0100 @@ -1,0 +2,10 @@ +Mon Nov 7 19:03:45 UTC 2022 - Ben Greiner <c...@bnavigator.de> + +- Update to v0.5.0 + * Remove astropy dependency by @olebole in #31 + * Register array_compare as pytest marker. +- Release v0.4.0 + * Minimum Python version is now 3.7. [#30] + * Various infrastructure updates. + +------------------------------------------------------------------- Old: ---- pytest-arraydiff-0.3.tar.gz New: ---- pytest-arraydiff-0.5.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-pytest-arraydiff.spec ++++++ --- /var/tmp/diff_new_pack.PBSU4R/_old 2022-11-08 10:55:15.681813129 +0100 +++ /var/tmp/diff_new_pack.PBSU4R/_new 2022-11-08 10:55:15.689813148 +0100 @@ -1,7 +1,7 @@ # -# spec file for package python-pytest-arraydiff-test +# spec file # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -25,27 +25,27 @@ %bcond_with test %endif -%{?!python_module:%define python_module() python-%{**} python3-%{**}} -%define skip_python36 1 Name: python-pytest-arraydiff%{psuffix} -Version: 0.3 +Version: 0.5.0 Release: 0 Summary: Pytest plugin to help with comparing array output from tests License: BSD-2-Clause URL: https://github.com/astropy/pytest-arraydiff Source: https://files.pythonhosted.org/packages/source/p/pytest-arraydiff/pytest-arraydiff-%{version}.tar.gz +BuildRequires: %{python_module base >= 3.7} +BuildRequires: %{python_module pip} +BuildRequires: %{python_module setuptools_scm} BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module wheel} BuildRequires: fdupes BuildRequires: python-rpm-macros Requires: python-numpy -Requires: python-pytest -Requires: python-six +Requires: python-pytest >= 4.6 BuildArch: noarch %if %{with test} -BuildRequires: %{python_module astropy if %python-base > 3} +BuildRequires: %{python_module astropy} BuildRequires: %{python_module numpy} -BuildRequires: %{python_module pytest} -BuildRequires: %{python_module six} +BuildRequires: %{python_module pytest >= 4.6} %endif %python_subpackages @@ -68,27 +68,20 @@ %prep %setup -q -n pytest-arraydiff-%{version} +%if !%{with test} %build -%python_build +%pyproject_wheel %install -%if !%{with test} -%python_install +%pyproject_install %python_expand %fdupes %{buildroot}%{$python_sitelib} %endif %if %{with test} %check -%{python_expand # u-a controlled pytest executable for nested pytest calls within tests -mkdir -p build/bin -ln -sf %{_bindir}/pytest-%{$python_bin_suffix} build/bin/pytest -} -export PATH="$PWD/build/bin:$PATH" # not installed in :test multiflavor export PYTHONPATH="$PWD" -# generate, default_format, test_fails, test_succeeds_func_fits_hdu tests need astropy that is python3 only, so skip -python2_donttest=" or test_generate or test_default_format or test_fails or test_succeeds_func_fits_hdu" -%pytest -k "not (donttestdummyprefix ${$python_donttest})" +%pytest %endif %if !%{with test} ++++++ pytest-arraydiff-0.3.tar.gz -> pytest-arraydiff-0.5.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-arraydiff-0.3/.github/workflows/ci_workflows.yml new/pytest-arraydiff-0.5.0/.github/workflows/ci_workflows.yml --- old/pytest-arraydiff-0.3/.github/workflows/ci_workflows.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/pytest-arraydiff-0.5.0/.github/workflows/ci_workflows.yml 2022-01-13 03:27:37.000000000 +0100 @@ -0,0 +1,53 @@ +name: CI + +on: + pull_request: + push: + schedule: + # Run every Sunday at 06:53 UTC + - cron: 53 6 * * 0 + +jobs: + tests: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-latest + python-version: 3.7 + 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-pytest52 + - os: ubuntu-latest + python-version: 3.8 + 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.10' + toxenv: py310-test-pytest62 + - os: ubuntu-latest + python-version: '3.10' + toxenv: py310-test-pytestdev + + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install tox + run: python -m pip install tox + - name: Run tox + run: tox -v -e ${{ matrix.toxenv }} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-arraydiff-0.3/.github/workflows/publish.yml new/pytest-arraydiff-0.5.0/.github/workflows/publish.yml --- old/pytest-arraydiff-0.3/.github/workflows/publish.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/pytest-arraydiff-0.5.0/.github/workflows/publish.yml 2022-01-13 03:27:37.000000000 +0100 @@ -0,0 +1,48 @@ +name: Release + +on: + pull_request: + push: + tags: + - '*' + +jobs: + build-n-publish: + name: Build and publish Python ???? distributions ???? to PyPI + runs-on: ubuntu-latest + if: ((github.event_name == 'push' && startsWith(github.ref, 'refs/tags')) || contains(github.event.pull_request.labels.*.name, 'Build wheels')) + + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - uses: actions/setup-python@v2 + with: + python-version: 3.8 + + - name: Install python-build and twine + run: python -m pip install pip build "twine>=3.3" -U + + - name: Build package + run: python -m build --sdist --wheel . + + - name: List result + run: ls -l dist + + - name: Check long_description + run: python -m twine check --strict dist/* + + # 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') + uses: pypa/gh-action-pypi-publish@release/v1 + with: + user: __token__ + password: ${{ secrets.pypi_password }} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-arraydiff-0.3/.gitignore new/pytest-arraydiff-0.5.0/.gitignore --- old/pytest-arraydiff-0.3/.gitignore 1970-01-01 01:00:00.000000000 +0100 +++ new/pytest-arraydiff-0.5.0/.gitignore 2022-01-13 03:27:37.000000000 +0100 @@ -0,0 +1,63 @@ +# Compiled files +*.py[cod] +*.a +*.o +*.so +*.pyd +__pycache__ + +# Ignore .c files by default to avoid including generated code. If you want to +# add a non-generated .c extension, use `git add -f filename.c`. +*.c + +# Other generated files +MANIFEST + +# Sphinx +_build +_generated +docs/api +docs/generated + +# Packages/installer info +*.egg +*.egg-info +dist +build +eggs +.eggs +parts +bin +var +sdist +develop-eggs +.installed.cfg +distribute-*.tar.gz + +# Other +.cache +.tox +.*.swp +.*.swo +*~ +.project +.pydevproject +.settings +.coverage +cover +htmlcov +.pytest_cache + +# Env +.venv +venv +.env + +# Mac OSX +.DS_Store + +# PyCharm +.idea + +*/version.py +pip-wheel-metadata/ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-arraydiff-0.3/CHANGES.md new/pytest-arraydiff-0.5.0/CHANGES.md --- old/pytest-arraydiff-0.3/CHANGES.md 2018-12-06 05:29:14.000000000 +0100 +++ new/pytest-arraydiff-0.5.0/CHANGES.md 2022-01-13 03:27:37.000000000 +0100 @@ -1,3 +1,17 @@ +0.5 (2022-01-12) +---------------- + +- Removed `astropy` as required dependency. [#31] + +- Formally register `array_compare` as marker. + +0.4 (2021-12-31) +---------------- + +- Minimum Python version is now 3.7. [#30] + +- Various infrastructure updates. + 0.3 (2018-12-05) ---------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-arraydiff-0.3/MANIFEST.in new/pytest-arraydiff-0.5.0/MANIFEST.in --- old/pytest-arraydiff-0.3/MANIFEST.in 2018-01-29 11:12:14.000000000 +0100 +++ new/pytest-arraydiff-0.5.0/MANIFEST.in 2022-01-13 03:27:37.000000000 +0100 @@ -2,5 +2,8 @@ include README.rst include CHANGES.md include tox.ini +include pyproject.toml +include setup.cfg +include setup.py recursive-include tests *.py *.fits *.txt diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-arraydiff-0.3/PKG-INFO new/pytest-arraydiff-0.5.0/PKG-INFO --- old/pytest-arraydiff-0.3/PKG-INFO 2018-12-06 05:30:04.000000000 +0100 +++ new/pytest-arraydiff-0.5.0/PKG-INFO 2022-01-13 03:27:51.915473700 +0100 @@ -1,214 +1,224 @@ -Metadata-Version: 1.1 +Metadata-Version: 2.1 Name: pytest-arraydiff -Version: 0.3 +Version: 0.5.0 Summary: pytest plugin to help with comparing array output from tests -Home-page: https://github.com/astrofrog/pytest-arraydiff -Author: Thomas Robitaille -Author-email: thomas.robitai...@gmail.com +Home-page: https://github.com/astropy/pytest-arraydiff +Author: The Astropy Developers +Author-email: astropy.t...@gmail.com License: BSD -Description: |Travis Build Status| |AppVeyor Build status| |Coverage| - - About - ----- - - This is a `py.test <http://pytest.org>`__ plugin to facilitate the - generation and comparison of data arrays produced during tests, in particular - in cases where the arrays are too large to conveniently hard-code them - in the tests (e.g. ``np.testing.assert_allclose(x, [1, 2, 3])``). - - The basic idea is that you can write a test that generates a Numpy array (or - other related objects depending on the format). You can then either run the - tests in a mode to **generate** reference files from the arrays, or you can run - the tests in **comparison** mode, which will compare the results of the tests to - the reference ones within some tolerance. - - At the moment, the supported file formats for the reference files are: - - - A plain text-based format (baed on Numpy ``loadtxt`` output) - - The FITS format (requires `astropy <http://www.astropy.org>`__). With this - format, tests can return either a Numpy array for a FITS HDU object. - - For more information on how to write tests to do this, see the **Using** - section below. - - Installing - ---------- - - This plugin is compatible with Python 2.7, and 3.5 and later, and - requires `pytest <http://pytest.org>`__ and - `numpy <http://www.numpy.org>`__ to be installed. - - To install, you can do:: - - pip install pytest-arraydiff - - You can check that the plugin is registered with pytest by doing:: - - py.test --version - - which will show a list of plugins:: - - This is pytest version 2.7.1, imported from ... - setuptools registered plugins: - pytest-arraydiff-0.1 at ... - - Using - ----- - - To use, you simply need to mark the function where you want to compare - arrays using ``@pytest.mark.array_compare``, and make sure that the - function returns a plain Numpy array:: - - python - import pytest - import numpy as np - - @pytest.mark.array_compare - def test_succeeds(): - return np.arange(3 * 5 * 4).reshape((3, 5, 4)) - - To generate the reference data files, run the tests with the - ``--arraydiff-generate-path`` option with the name of the directory - where the generated files should be placed:: - - py.test --arraydiff-generate-path=reference - - If the directory does not exist, it will be created. The directory will - be interpreted as being relative to where you are running ``py.test``. - Make sure you manually check the reference arrays to ensure they are - correct. - - Once you are happy with the generated data files, you should move them - to a sub-directory called ``reference`` relative to the test files (this - name is configurable, see below). You can also generate the baseline - arrays directly in the right directory. - - You can then run the tests simply with:: - - py.test --arraydiff - - and the tests will pass if the arrays are the same. If you omit the - ``--arraydiff`` option, the tests will run but will only check that the - code runs without checking the output arrays. - - Options - ------- - - The ``@pytest.mark.array_compare`` marker take an argument to specify - the format to use for the reference files: - - .. code:: python - - @pytest.mark.array_compare(file_format='text') - def test_array(): - ... - - The default file format can also be specified using the - ``--arraydiff-default-format=<format>`` flag when running ``py.test``, - and ``<format>`` should be either ``fits`` or ``text``. - - The supported formats at this time are ``text`` and ``fits``, and - contributions for other formats are welcome. The default format is - ``text``. - - Another argument is the relative tolerance for floating point values - (which defaults to 1e-7): - - .. code:: python - - @pytest.mark.array_compare(rtol=20) - def test_array(): - ... - - You can also pass keyword arguments to the writers using the - ``write_kwargs``. For the ``text`` format, these arguments are passed to - ``savetxt`` while for the ``fits`` format they are passed to Astropy's - ``fits.writeto`` function. - - .. code:: python - - @pytest.mark.array_compare(file_format='fits', write_kwargs={'output_verify': 'silentfix'}) - def test_array(): - ... - - Other options include the name of the reference directory (which - defaults to ``reference`` ) and the filename for the reference file - (which defaults to the name of the test with a format-dependent - extension). - - .. code:: python - - @pytest.mark.array_compare(reference_dir='baseline_arrays', - filename='other_name.fits') - def test_array(): - ... - - The reference directory in the decorator above will be interpreted as - being relative to the test file. Note that the baseline directory can - also be a URL (which should start with ``http://`` or ``https://`` and - end in a slash). - - Finally, you can also set a custom baseline directory globally when - running tests by running ``py.test`` with:: - - py.test --arraydiff --arraydiff-reference-path=baseline_arrays - - This directory will be interpreted as being relative to where the tests - are run. In addition, if both this option and the ``reference_dir`` - option in the ``array_compare`` decorator are used, the one in the - decorator takes precedence. - - Test failure example - -------------------- - - If the arrays produced by the tests are correct, then the test will - pass, but if they are not, the test will fail with a message similar to - the following:: - - E AssertionError: - E - E a: /var/folders/zy/t1l3sx310d3d6p0kyxqzlrnr0000gr/T/tmpbvjkzt_q/test_to_mask_rect-mode_subpixels-subpixels_18.txt - E b: /var/folders/zy/t1l3sx310d3d6p0kyxqzlrnr0000gr/T/tmpbvjkzt_q/reference-test_to_mask_rect-mode_subpixels-subpixels_18.txt - E - E Not equal to tolerance rtol=1e-07, atol=0 - E - E (mismatch 47.22222222222222%) - E x: array([[ 0. , 0. , 0. , 0. , 0.404012, 0.55 , - E 0.023765, 0. , 0. ], - E [ 0. , 0. , 0. , 0.112037, 1.028704, 1.1 ,... - E y: array([[ 0. , 0. , 0. , 0. , 0.367284, 0.5 , - E 0.021605, 0. , 0. ], - E [ 0. , 0. , 0. , 0.101852, 0.935185, 1. ,... - - The file paths included in the exception are then available for - inspection. - - Running the tests for pytest-arraydiff - -------------------------------------- - - If you are contributing some changes and want to run the tests, first - install the latest version of the plugin then do:: - - cd tests - py.test --arraydiff - - The reason for having to install the plugin first is to ensure that the - plugin is correctly loaded as part of the test suite. - - .. |Travis Build Status| image:: https://travis-ci.org/astrofrog/pytest-arraydiff.svg?branch=master - :target: https://travis-ci.org/astrofrog/pytest-arraydiff - .. |AppVeyor Build status| image:: https://ci.appveyor.com/api/projects/status/0nech6qgp8jlabjp/branch/master?svg=true - :target: https://ci.appveyor.com/project/astropy/pytest-arraydiff - .. |Coverage| image:: https://codecov.io/gh/astropy/pytest-arraydiff/branch/master/graph/badge.svg - :target: https://codecov.io/gh/astropy/pytest-arraydiff - Platform: UNKNOWN Classifier: Development Status :: 4 - Beta Classifier: Framework :: Pytest Classifier: Intended Audience :: Developers -Classifier: Topic :: Software Development :: Testing +Classifier: License :: OSI Approved :: BSD License +Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 3 -Classifier: Operating System :: OS Independent -Classifier: License :: OSI Approved :: BSD License +Classifier: Programming Language :: Python :: 3 :: Only +Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: Implementation :: CPython +Classifier: Topic :: Software Development :: Testing +Classifier: Topic :: Utilities +Requires-Python: >=3.7 +Description-Content-Type: text/x-rst +Provides-Extra: test +License-File: LICENSE + +.. image:: https://zenodo.org/badge/DOI/10.5281/zenodo.5811772.svg + :target: https://doi.org/10.5281/zenodo.5811772 + :alt: 10.5281/zenodo.5811772 + +.. image:: https://github.com/astropy/pytest-arraydiff/workflows/CI/badge.svg + :target: https://github.com/astropy/pytest-arraydiff/actions + :alt: CI Status + +About +----- + +This is a `py.test <http://pytest.org>`__ plugin to facilitate the +generation and comparison of data arrays produced during tests, in particular +in cases where the arrays are too large to conveniently hard-code them +in the tests (e.g. ``np.testing.assert_allclose(x, [1, 2, 3])``). + +The basic idea is that you can write a test that generates a Numpy array (or +other related objects depending on the format). You can then either run the +tests in a mode to **generate** reference files from the arrays, or you can run +the tests in **comparison** mode, which will compare the results of the tests to +the reference ones within some tolerance. + +At the moment, the supported file formats for the reference files are: + +- A plain text-based format (based on Numpy ``loadtxt`` output) +- The FITS format (requires `astropy <http://www.astropy.org>`__). With this + format, tests can return either a Numpy array for a FITS HDU object. + +For more information on how to write tests to do this, see the **Using** +section below. + +Installing +---------- + +This plugin is compatible with Python 2.7, and 3.5 and later, and +requires `pytest <http://pytest.org>`__ and +`numpy <http://www.numpy.org>`__ to be installed. + +To install, you can do:: + + pip install pytest-arraydiff + +You can check that the plugin is registered with pytest by doing:: + + py.test --version + +which will show a list of plugins:: + + This is pytest version 2.7.1, imported from ... + setuptools registered plugins: + pytest-arraydiff-0.1 at ... + +Using +----- + +To use, you simply need to mark the function where you want to compare +arrays using ``@pytest.mark.array_compare``, and make sure that the +function returns a plain Numpy array:: + + python + import pytest + import numpy as np + + @pytest.mark.array_compare + def test_succeeds(): + return np.arange(3 * 5 * 4).reshape((3, 5, 4)) + +To generate the reference data files, run the tests with the +``--arraydiff-generate-path`` option with the name of the directory +where the generated files should be placed:: + + py.test --arraydiff-generate-path=reference + +If the directory does not exist, it will be created. The directory will +be interpreted as being relative to where you are running ``py.test``. +Make sure you manually check the reference arrays to ensure they are +correct. + +Once you are happy with the generated data files, you should move them +to a sub-directory called ``reference`` relative to the test files (this +name is configurable, see below). You can also generate the baseline +arrays directly in the right directory. + +You can then run the tests simply with:: + + py.test --arraydiff + +and the tests will pass if the arrays are the same. If you omit the +``--arraydiff`` option, the tests will run but will only check that the +code runs without checking the output arrays. + +Options +------- + +The ``@pytest.mark.array_compare`` marker take an argument to specify +the format to use for the reference files: + +.. code:: python + + @pytest.mark.array_compare(file_format='text') + def test_array(): + ... + +The default file format can also be specified using the +``--arraydiff-default-format=<format>`` flag when running ``py.test``, +and ``<format>`` should be either ``fits`` or ``text``. + +The supported formats at this time are ``text`` and ``fits``, and +contributions for other formats are welcome. The default format is +``text``. + +Another argument is the relative tolerance for floating point values +(which defaults to 1e-7): + +.. code:: python + + @pytest.mark.array_compare(rtol=20) + def test_array(): + ... + +You can also pass keyword arguments to the writers using the +``write_kwargs``. For the ``text`` format, these arguments are passed to +``savetxt`` while for the ``fits`` format they are passed to Astropy's +``fits.writeto`` function. + +.. code:: python + + @pytest.mark.array_compare(file_format='fits', write_kwargs={'output_verify': 'silentfix'}) + def test_array(): + ... + +Other options include the name of the reference directory (which +defaults to ``reference`` ) and the filename for the reference file +(which defaults to the name of the test with a format-dependent +extension). + +.. code:: python + + @pytest.mark.array_compare(reference_dir='baseline_arrays', + filename='other_name.fits') + def test_array(): + ... + +The reference directory in the decorator above will be interpreted as +being relative to the test file. Note that the baseline directory can +also be a URL (which should start with ``http://`` or ``https://`` and +end in a slash). + +Finally, you can also set a custom baseline directory globally when +running tests by running ``py.test`` with:: + + py.test --arraydiff --arraydiff-reference-path=baseline_arrays + +This directory will be interpreted as being relative to where the tests +are run. In addition, if both this option and the ``reference_dir`` +option in the ``array_compare`` decorator are used, the one in the +decorator takes precedence. + +Test failure example +-------------------- + +If the arrays produced by the tests are correct, then the test will +pass, but if they are not, the test will fail with a message similar to +the following:: + + E AssertionError: + E + E a: /var/folders/zy/t1l3sx310d3d6p0kyxqzlrnr0000gr/T/tmpbvjkzt_q/test_to_mask_rect-mode_subpixels-subpixels_18.txt + E b: /var/folders/zy/t1l3sx310d3d6p0kyxqzlrnr0000gr/T/tmpbvjkzt_q/reference-test_to_mask_rect-mode_subpixels-subpixels_18.txt + E + E Not equal to tolerance rtol=1e-07, atol=0 + E + E (mismatch 47.22222222222222%) + E x: array([[ 0. , 0. , 0. , 0. , 0.404012, 0.55 , + E 0.023765, 0. , 0. ], + E [ 0. , 0. , 0. , 0.112037, 1.028704, 1.1 ,... + E y: array([[ 0. , 0. , 0. , 0. , 0.367284, 0.5 , + E 0.021605, 0. , 0. ], + E [ 0. , 0. , 0. , 0.101852, 0.935185, 1. ,... + +The file paths included in the exception are then available for +inspection. + +Running the tests for pytest-arraydiff +-------------------------------------- + +If you are contributing some changes and want to run the tests, first +install the latest version of the plugin then do:: + + cd tests + py.test --arraydiff + +The reason for having to install the plugin first is to ensure that the +plugin is correctly loaded as part of the test suite. + + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-arraydiff-0.3/README.rst new/pytest-arraydiff-0.5.0/README.rst --- old/pytest-arraydiff-0.3/README.rst 2018-12-05 19:49:54.000000000 +0100 +++ new/pytest-arraydiff-0.5.0/README.rst 2022-01-13 03:27:37.000000000 +0100 @@ -1,4 +1,10 @@ -|Travis Build Status| |AppVeyor Build status| |Coverage| +.. image:: https://zenodo.org/badge/DOI/10.5281/zenodo.5811772.svg + :target: https://doi.org/10.5281/zenodo.5811772 + :alt: 10.5281/zenodo.5811772 + +.. image:: https://github.com/astropy/pytest-arraydiff/workflows/CI/badge.svg + :target: https://github.com/astropy/pytest-arraydiff/actions + :alt: CI Status About ----- @@ -16,7 +22,7 @@ At the moment, the supported file formats for the reference files are: -- A plain text-based format (baed on Numpy ``loadtxt`` output) +- A plain text-based format (based on Numpy ``loadtxt`` output) - The FITS format (requires `astropy <http://www.astropy.org>`__). With this format, tests can return either a Numpy array for a FITS HDU object. @@ -186,10 +192,3 @@ The reason for having to install the plugin first is to ensure that the plugin is correctly loaded as part of the test suite. - -.. |Travis Build Status| image:: https://travis-ci.org/astrofrog/pytest-arraydiff.svg?branch=master - :target: https://travis-ci.org/astrofrog/pytest-arraydiff -.. |AppVeyor Build status| image:: https://ci.appveyor.com/api/projects/status/0nech6qgp8jlabjp/branch/master?svg=true - :target: https://ci.appveyor.com/project/astropy/pytest-arraydiff -.. |Coverage| image:: https://codecov.io/gh/astropy/pytest-arraydiff/branch/master/graph/badge.svg - :target: https://codecov.io/gh/astropy/pytest-arraydiff diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-arraydiff-0.3/pyproject.toml new/pytest-arraydiff-0.5.0/pyproject.toml --- old/pytest-arraydiff-0.3/pyproject.toml 1970-01-01 01:00:00.000000000 +0100 +++ new/pytest-arraydiff-0.5.0/pyproject.toml 2022-01-13 03:27:37.000000000 +0100 @@ -0,0 +1,5 @@ +[build-system] +requires = ["setuptools>=30.3.0", + "setuptools_scm", + "wheel"] +build-backend = 'setuptools.build_meta' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-arraydiff-0.3/pytest_arraydiff/__init__.py new/pytest-arraydiff-0.5.0/pytest_arraydiff/__init__.py --- old/pytest-arraydiff-0.3/pytest_arraydiff/__init__.py 2018-12-06 05:29:24.000000000 +0100 +++ new/pytest-arraydiff-0.5.0/pytest_arraydiff/__init__.py 2022-01-13 03:27:37.000000000 +0100 @@ -1 +1,3 @@ -__version__ = '0.3' +# Licensed under a 3-clause BSD style license - see LICENSE.rst + +from .version import version as __version__ # noqa diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-arraydiff-0.3/pytest_arraydiff/plugin.py new/pytest-arraydiff-0.5.0/pytest_arraydiff/plugin.py --- old/pytest-arraydiff-0.3/pytest_arraydiff/plugin.py 2018-12-05 19:49:54.000000000 +0100 +++ new/pytest-arraydiff-0.5.0/pytest_arraydiff/plugin.py 2022-01-13 03:27:37.000000000 +0100 @@ -36,27 +36,17 @@ import shutil import tempfile import warnings -from distutils.version import StrictVersion - -import six -from six.moves.urllib.request import urlopen +from urllib.request import urlopen import pytest import numpy as np -if six.PY2: - def abstractstaticmethod(func): - return func - def abstractclassmethod(func): - return func -else: - abstractstaticmethod = abc.abstractstaticmethod - abstractclassmethod = abc.abstractclassmethod +abstractstaticmethod = abc.abstractstaticmethod +abstractclassmethod = abc.abstractclassmethod -@six.add_metaclass(abc.ABCMeta) -class BaseDiff(object): +class BaseDiff(object, metaclass=abc.ABCMeta): @abstractstaticmethod def read(filename): @@ -143,14 +133,7 @@ @staticmethod def write(filename, data, **kwargs): fmt = kwargs.get('fmt', '%g') - # Workaround for a known issue in `numpy.savetxt` for the `fmt` argument: - # https://github.com/numpy/numpy/pull/4053#issuecomment-263808221 - # Convert `unicode` to `str` (i.e. bytes) on Python 2 - if six.PY2 and isinstance(fmt, six.text_type): - fmt = fmt.encode('ascii') - kwargs['fmt'] = fmt - return np.savetxt(filename, data, **kwargs) @@ -181,7 +164,9 @@ def pytest_configure(config): - + config.getini('markers').append( + 'array_compare: for functions using array comparison') + if config.getoption("--arraydiff") or config.getoption("--arraydiff-generate-path") is not None: reference_dir = config.getoption("--arraydiff-reference-path") @@ -213,10 +198,7 @@ def pytest_runtest_setup(self, item): - if StrictVersion(pytest.__version__) < StrictVersion("3.6"): - compare = item.get_marker('array_compare') - else: - compare = item.get_closest_marker('array_compare') + compare = item.get_closest_marker('array_compare') if compare is None: return @@ -295,7 +277,7 @@ 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) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-arraydiff-0.3/pytest_arraydiff/version.py new/pytest-arraydiff-0.5.0/pytest_arraydiff/version.py --- old/pytest-arraydiff-0.3/pytest_arraydiff/version.py 1970-01-01 01:00:00.000000000 +0100 +++ new/pytest-arraydiff-0.5.0/pytest_arraydiff/version.py 2022-01-13 03:27:51.000000000 +0100 @@ -0,0 +1,5 @@ +# coding: utf-8 +# file generated by setuptools_scm +# don't change, don't track in version control +version = '0.5.0' +version_tuple = (0, 5, 0) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-arraydiff-0.3/pytest_arraydiff.egg-info/PKG-INFO new/pytest-arraydiff-0.5.0/pytest_arraydiff.egg-info/PKG-INFO --- old/pytest-arraydiff-0.3/pytest_arraydiff.egg-info/PKG-INFO 2018-12-06 05:30:04.000000000 +0100 +++ new/pytest-arraydiff-0.5.0/pytest_arraydiff.egg-info/PKG-INFO 2022-01-13 03:27:51.000000000 +0100 @@ -1,214 +1,224 @@ -Metadata-Version: 1.1 +Metadata-Version: 2.1 Name: pytest-arraydiff -Version: 0.3 +Version: 0.5.0 Summary: pytest plugin to help with comparing array output from tests -Home-page: https://github.com/astrofrog/pytest-arraydiff -Author: Thomas Robitaille -Author-email: thomas.robitai...@gmail.com +Home-page: https://github.com/astropy/pytest-arraydiff +Author: The Astropy Developers +Author-email: astropy.t...@gmail.com License: BSD -Description: |Travis Build Status| |AppVeyor Build status| |Coverage| - - About - ----- - - This is a `py.test <http://pytest.org>`__ plugin to facilitate the - generation and comparison of data arrays produced during tests, in particular - in cases where the arrays are too large to conveniently hard-code them - in the tests (e.g. ``np.testing.assert_allclose(x, [1, 2, 3])``). - - The basic idea is that you can write a test that generates a Numpy array (or - other related objects depending on the format). You can then either run the - tests in a mode to **generate** reference files from the arrays, or you can run - the tests in **comparison** mode, which will compare the results of the tests to - the reference ones within some tolerance. - - At the moment, the supported file formats for the reference files are: - - - A plain text-based format (baed on Numpy ``loadtxt`` output) - - The FITS format (requires `astropy <http://www.astropy.org>`__). With this - format, tests can return either a Numpy array for a FITS HDU object. - - For more information on how to write tests to do this, see the **Using** - section below. - - Installing - ---------- - - This plugin is compatible with Python 2.7, and 3.5 and later, and - requires `pytest <http://pytest.org>`__ and - `numpy <http://www.numpy.org>`__ to be installed. - - To install, you can do:: - - pip install pytest-arraydiff - - You can check that the plugin is registered with pytest by doing:: - - py.test --version - - which will show a list of plugins:: - - This is pytest version 2.7.1, imported from ... - setuptools registered plugins: - pytest-arraydiff-0.1 at ... - - Using - ----- - - To use, you simply need to mark the function where you want to compare - arrays using ``@pytest.mark.array_compare``, and make sure that the - function returns a plain Numpy array:: - - python - import pytest - import numpy as np - - @pytest.mark.array_compare - def test_succeeds(): - return np.arange(3 * 5 * 4).reshape((3, 5, 4)) - - To generate the reference data files, run the tests with the - ``--arraydiff-generate-path`` option with the name of the directory - where the generated files should be placed:: - - py.test --arraydiff-generate-path=reference - - If the directory does not exist, it will be created. The directory will - be interpreted as being relative to where you are running ``py.test``. - Make sure you manually check the reference arrays to ensure they are - correct. - - Once you are happy with the generated data files, you should move them - to a sub-directory called ``reference`` relative to the test files (this - name is configurable, see below). You can also generate the baseline - arrays directly in the right directory. - - You can then run the tests simply with:: - - py.test --arraydiff - - and the tests will pass if the arrays are the same. If you omit the - ``--arraydiff`` option, the tests will run but will only check that the - code runs without checking the output arrays. - - Options - ------- - - The ``@pytest.mark.array_compare`` marker take an argument to specify - the format to use for the reference files: - - .. code:: python - - @pytest.mark.array_compare(file_format='text') - def test_array(): - ... - - The default file format can also be specified using the - ``--arraydiff-default-format=<format>`` flag when running ``py.test``, - and ``<format>`` should be either ``fits`` or ``text``. - - The supported formats at this time are ``text`` and ``fits``, and - contributions for other formats are welcome. The default format is - ``text``. - - Another argument is the relative tolerance for floating point values - (which defaults to 1e-7): - - .. code:: python - - @pytest.mark.array_compare(rtol=20) - def test_array(): - ... - - You can also pass keyword arguments to the writers using the - ``write_kwargs``. For the ``text`` format, these arguments are passed to - ``savetxt`` while for the ``fits`` format they are passed to Astropy's - ``fits.writeto`` function. - - .. code:: python - - @pytest.mark.array_compare(file_format='fits', write_kwargs={'output_verify': 'silentfix'}) - def test_array(): - ... - - Other options include the name of the reference directory (which - defaults to ``reference`` ) and the filename for the reference file - (which defaults to the name of the test with a format-dependent - extension). - - .. code:: python - - @pytest.mark.array_compare(reference_dir='baseline_arrays', - filename='other_name.fits') - def test_array(): - ... - - The reference directory in the decorator above will be interpreted as - being relative to the test file. Note that the baseline directory can - also be a URL (which should start with ``http://`` or ``https://`` and - end in a slash). - - Finally, you can also set a custom baseline directory globally when - running tests by running ``py.test`` with:: - - py.test --arraydiff --arraydiff-reference-path=baseline_arrays - - This directory will be interpreted as being relative to where the tests - are run. In addition, if both this option and the ``reference_dir`` - option in the ``array_compare`` decorator are used, the one in the - decorator takes precedence. - - Test failure example - -------------------- - - If the arrays produced by the tests are correct, then the test will - pass, but if they are not, the test will fail with a message similar to - the following:: - - E AssertionError: - E - E a: /var/folders/zy/t1l3sx310d3d6p0kyxqzlrnr0000gr/T/tmpbvjkzt_q/test_to_mask_rect-mode_subpixels-subpixels_18.txt - E b: /var/folders/zy/t1l3sx310d3d6p0kyxqzlrnr0000gr/T/tmpbvjkzt_q/reference-test_to_mask_rect-mode_subpixels-subpixels_18.txt - E - E Not equal to tolerance rtol=1e-07, atol=0 - E - E (mismatch 47.22222222222222%) - E x: array([[ 0. , 0. , 0. , 0. , 0.404012, 0.55 , - E 0.023765, 0. , 0. ], - E [ 0. , 0. , 0. , 0.112037, 1.028704, 1.1 ,... - E y: array([[ 0. , 0. , 0. , 0. , 0.367284, 0.5 , - E 0.021605, 0. , 0. ], - E [ 0. , 0. , 0. , 0.101852, 0.935185, 1. ,... - - The file paths included in the exception are then available for - inspection. - - Running the tests for pytest-arraydiff - -------------------------------------- - - If you are contributing some changes and want to run the tests, first - install the latest version of the plugin then do:: - - cd tests - py.test --arraydiff - - The reason for having to install the plugin first is to ensure that the - plugin is correctly loaded as part of the test suite. - - .. |Travis Build Status| image:: https://travis-ci.org/astrofrog/pytest-arraydiff.svg?branch=master - :target: https://travis-ci.org/astrofrog/pytest-arraydiff - .. |AppVeyor Build status| image:: https://ci.appveyor.com/api/projects/status/0nech6qgp8jlabjp/branch/master?svg=true - :target: https://ci.appveyor.com/project/astropy/pytest-arraydiff - .. |Coverage| image:: https://codecov.io/gh/astropy/pytest-arraydiff/branch/master/graph/badge.svg - :target: https://codecov.io/gh/astropy/pytest-arraydiff - Platform: UNKNOWN Classifier: Development Status :: 4 - Beta Classifier: Framework :: Pytest Classifier: Intended Audience :: Developers -Classifier: Topic :: Software Development :: Testing +Classifier: License :: OSI Approved :: BSD License +Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 3 -Classifier: Operating System :: OS Independent -Classifier: License :: OSI Approved :: BSD License +Classifier: Programming Language :: Python :: 3 :: Only +Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: Implementation :: CPython +Classifier: Topic :: Software Development :: Testing +Classifier: Topic :: Utilities +Requires-Python: >=3.7 +Description-Content-Type: text/x-rst +Provides-Extra: test +License-File: LICENSE + +.. image:: https://zenodo.org/badge/DOI/10.5281/zenodo.5811772.svg + :target: https://doi.org/10.5281/zenodo.5811772 + :alt: 10.5281/zenodo.5811772 + +.. image:: https://github.com/astropy/pytest-arraydiff/workflows/CI/badge.svg + :target: https://github.com/astropy/pytest-arraydiff/actions + :alt: CI Status + +About +----- + +This is a `py.test <http://pytest.org>`__ plugin to facilitate the +generation and comparison of data arrays produced during tests, in particular +in cases where the arrays are too large to conveniently hard-code them +in the tests (e.g. ``np.testing.assert_allclose(x, [1, 2, 3])``). + +The basic idea is that you can write a test that generates a Numpy array (or +other related objects depending on the format). You can then either run the +tests in a mode to **generate** reference files from the arrays, or you can run +the tests in **comparison** mode, which will compare the results of the tests to +the reference ones within some tolerance. + +At the moment, the supported file formats for the reference files are: + +- A plain text-based format (based on Numpy ``loadtxt`` output) +- The FITS format (requires `astropy <http://www.astropy.org>`__). With this + format, tests can return either a Numpy array for a FITS HDU object. + +For more information on how to write tests to do this, see the **Using** +section below. + +Installing +---------- + +This plugin is compatible with Python 2.7, and 3.5 and later, and +requires `pytest <http://pytest.org>`__ and +`numpy <http://www.numpy.org>`__ to be installed. + +To install, you can do:: + + pip install pytest-arraydiff + +You can check that the plugin is registered with pytest by doing:: + + py.test --version + +which will show a list of plugins:: + + This is pytest version 2.7.1, imported from ... + setuptools registered plugins: + pytest-arraydiff-0.1 at ... + +Using +----- + +To use, you simply need to mark the function where you want to compare +arrays using ``@pytest.mark.array_compare``, and make sure that the +function returns a plain Numpy array:: + + python + import pytest + import numpy as np + + @pytest.mark.array_compare + def test_succeeds(): + return np.arange(3 * 5 * 4).reshape((3, 5, 4)) + +To generate the reference data files, run the tests with the +``--arraydiff-generate-path`` option with the name of the directory +where the generated files should be placed:: + + py.test --arraydiff-generate-path=reference + +If the directory does not exist, it will be created. The directory will +be interpreted as being relative to where you are running ``py.test``. +Make sure you manually check the reference arrays to ensure they are +correct. + +Once you are happy with the generated data files, you should move them +to a sub-directory called ``reference`` relative to the test files (this +name is configurable, see below). You can also generate the baseline +arrays directly in the right directory. + +You can then run the tests simply with:: + + py.test --arraydiff + +and the tests will pass if the arrays are the same. If you omit the +``--arraydiff`` option, the tests will run but will only check that the +code runs without checking the output arrays. + +Options +------- + +The ``@pytest.mark.array_compare`` marker take an argument to specify +the format to use for the reference files: + +.. code:: python + + @pytest.mark.array_compare(file_format='text') + def test_array(): + ... + +The default file format can also be specified using the +``--arraydiff-default-format=<format>`` flag when running ``py.test``, +and ``<format>`` should be either ``fits`` or ``text``. + +The supported formats at this time are ``text`` and ``fits``, and +contributions for other formats are welcome. The default format is +``text``. + +Another argument is the relative tolerance for floating point values +(which defaults to 1e-7): + +.. code:: python + + @pytest.mark.array_compare(rtol=20) + def test_array(): + ... + +You can also pass keyword arguments to the writers using the +``write_kwargs``. For the ``text`` format, these arguments are passed to +``savetxt`` while for the ``fits`` format they are passed to Astropy's +``fits.writeto`` function. + +.. code:: python + + @pytest.mark.array_compare(file_format='fits', write_kwargs={'output_verify': 'silentfix'}) + def test_array(): + ... + +Other options include the name of the reference directory (which +defaults to ``reference`` ) and the filename for the reference file +(which defaults to the name of the test with a format-dependent +extension). + +.. code:: python + + @pytest.mark.array_compare(reference_dir='baseline_arrays', + filename='other_name.fits') + def test_array(): + ... + +The reference directory in the decorator above will be interpreted as +being relative to the test file. Note that the baseline directory can +also be a URL (which should start with ``http://`` or ``https://`` and +end in a slash). + +Finally, you can also set a custom baseline directory globally when +running tests by running ``py.test`` with:: + + py.test --arraydiff --arraydiff-reference-path=baseline_arrays + +This directory will be interpreted as being relative to where the tests +are run. In addition, if both this option and the ``reference_dir`` +option in the ``array_compare`` decorator are used, the one in the +decorator takes precedence. + +Test failure example +-------------------- + +If the arrays produced by the tests are correct, then the test will +pass, but if they are not, the test will fail with a message similar to +the following:: + + E AssertionError: + E + E a: /var/folders/zy/t1l3sx310d3d6p0kyxqzlrnr0000gr/T/tmpbvjkzt_q/test_to_mask_rect-mode_subpixels-subpixels_18.txt + E b: /var/folders/zy/t1l3sx310d3d6p0kyxqzlrnr0000gr/T/tmpbvjkzt_q/reference-test_to_mask_rect-mode_subpixels-subpixels_18.txt + E + E Not equal to tolerance rtol=1e-07, atol=0 + E + E (mismatch 47.22222222222222%) + E x: array([[ 0. , 0. , 0. , 0. , 0.404012, 0.55 , + E 0.023765, 0. , 0. ], + E [ 0. , 0. , 0. , 0.112037, 1.028704, 1.1 ,... + E y: array([[ 0. , 0. , 0. , 0. , 0.367284, 0.5 , + E 0.021605, 0. , 0. ], + E [ 0. , 0. , 0. , 0.101852, 0.935185, 1. ,... + +The file paths included in the exception are then available for +inspection. + +Running the tests for pytest-arraydiff +-------------------------------------- + +If you are contributing some changes and want to run the tests, first +install the latest version of the plugin then do:: + + cd tests + py.test --arraydiff + +The reason for having to install the plugin first is to ensure that the +plugin is correctly loaded as part of the test suite. + + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-arraydiff-0.3/pytest_arraydiff.egg-info/SOURCES.txt new/pytest-arraydiff-0.5.0/pytest_arraydiff.egg-info/SOURCES.txt --- old/pytest-arraydiff-0.3/pytest_arraydiff.egg-info/SOURCES.txt 2018-12-06 05:30:04.000000000 +0100 +++ new/pytest-arraydiff-0.5.0/pytest_arraydiff.egg-info/SOURCES.txt 2022-01-13 03:27:51.000000000 +0100 @@ -1,10 +1,17 @@ +.gitignore CHANGES.md LICENSE MANIFEST.in README.rst +pyproject.toml +setup.cfg setup.py +tox.ini +.github/workflows/ci_workflows.yml +.github/workflows/publish.yml pytest_arraydiff/__init__.py pytest_arraydiff/plugin.py +pytest_arraydiff/version.py pytest_arraydiff.egg-info/PKG-INFO pytest_arraydiff.egg-info/SOURCES.txt pytest_arraydiff.egg-info/dependency_links.txt diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-arraydiff-0.3/pytest_arraydiff.egg-info/requires.txt new/pytest-arraydiff-0.5.0/pytest_arraydiff.egg-info/requires.txt --- old/pytest-arraydiff-0.3/pytest_arraydiff.egg-info/requires.txt 2018-12-06 05:30:04.000000000 +0100 +++ new/pytest-arraydiff-0.5.0/pytest_arraydiff.egg-info/requires.txt 2022-01-13 03:27:51.000000000 +0100 @@ -1,3 +1,5 @@ +pytest>=4.6 numpy -six -pytest + +[test] +astropy diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-arraydiff-0.3/setup.cfg new/pytest-arraydiff-0.5.0/setup.cfg --- old/pytest-arraydiff-0.3/setup.cfg 2018-12-06 05:30:04.000000000 +0100 +++ new/pytest-arraydiff-0.5.0/setup.cfg 2022-01-13 03:27:51.919473600 +0100 @@ -1,3 +1,56 @@ +[metadata] +name = pytest-arraydiff +url = https://github.com/astropy/pytest-arraydiff +author = The Astropy Developers +author_email = astropy.t...@gmail.com +classifiers = + Development Status :: 4 - Beta + Framework :: Pytest + Intended Audience :: Developers + License :: OSI Approved :: BSD License + Operating System :: OS Independent + Programming Language :: Python + Programming Language :: Python :: 3 + Programming Language :: Python :: 3 :: Only + Programming Language :: Python :: 3.6 + Programming Language :: Python :: 3.7 + Programming Language :: Python :: 3.8 + Programming Language :: Python :: Implementation :: CPython + Topic :: Software Development :: Testing + Topic :: Utilities +license = BSD +description = pytest plugin to help with comparing array output from tests +long_description = file: README.rst +long_description_content_type = text/x-rst + +[options] +zip_safe = False +packages = find: +python_requires = >=3.7 +setup_requires = + setuptools_scm +install_requires = + pytest>=4.6 + numpy + +[options.extras_require] +test = + astropy + +[options.entry_points] +pytest11 = + pytest_arraydiff = pytest_arraydiff.plugin + +[tool:pytest] +minversion = 4.6 +testpaths = tests +xfail_strict = true +markers = + array_compare: for functions using array comparison + +[flake8] +max-line-length = 150 + [egg_info] tag_build = tag_date = 0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-arraydiff-0.3/setup.py new/pytest-arraydiff-0.5.0/setup.py --- old/pytest-arraydiff-0.3/setup.py 2018-12-05 19:49:54.000000000 +0100 +++ new/pytest-arraydiff-0.5.0/setup.py 2022-01-13 03:27:37.000000000 +0100 @@ -1,37 +1,6 @@ -from setuptools import setup - -from pytest_arraydiff import __version__ +#!/usr/bin/env python -# IMPORTANT: we deliberately use rst here instead of markdown because long_description -# needs to be in rst, and requiring pandoc to be installed to convert markdown to rst -# on-the-fly is over-complicated and sometimes the generated rst has warnings that -# cause PyPI to not display it correctly. - -with open('README.rst') as infile: - long_description = infile.read() +import os +from setuptools import setup -setup( - version=__version__, - url="https://github.com/astrofrog/pytest-arraydiff", - name="pytest-arraydiff", - description='pytest plugin to help with comparing array output from tests', - long_description=long_description, - packages=['pytest_arraydiff'], - install_requires=['numpy', 'six', 'pytest'], - license='BSD', - author='Thomas Robitaille', - author_email='thomas.robitai...@gmail.com', - entry_points={'pytest11': ['pytest_arraydiff = pytest_arraydiff.plugin']}, - zip_safe=False, - classifiers=[ - 'Development Status :: 4 - Beta', - 'Framework :: Pytest', - 'Intended Audience :: Developers', - 'Topic :: Software Development :: Testing', - 'Programming Language :: Python', - 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 3', - 'Operating System :: OS Independent', - 'License :: OSI Approved :: BSD License', - ], -) +setup(use_scm_version={'write_to': os.path.join('pytest_arraydiff', 'version.py')}) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-arraydiff-0.3/tests/test_pytest_arraydiff.py new/pytest-arraydiff-0.5.0/tests/test_pytest_arraydiff.py --- old/pytest-arraydiff-0.3/tests/test_pytest_arraydiff.py 2018-01-29 09:47:37.000000000 +0100 +++ new/pytest-arraydiff-0.5.0/tests/test_pytest_arraydiff.py 2022-01-13 03:27:37.000000000 +0100 @@ -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' @@ -58,11 +55,11 @@ 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 @@ -89,19 +86,13 @@ # 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'))) @@ -115,6 +106,7 @@ return np.arange(6 * 5).reshape((6, 5)) """ + @pytest.mark.parametrize('file_format', ('fits', 'text')) def test_default_format(file_format): @@ -127,7 +119,7 @@ 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'))) @@ -135,7 +127,7 @@ @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(): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-arraydiff-0.3/tox.ini new/pytest-arraydiff-0.5.0/tox.ini --- old/pytest-arraydiff-0.3/tox.ini 1970-01-01 01:00:00.000000000 +0100 +++ new/pytest-arraydiff-0.5.0/tox.ini 2022-01-13 03:27:37.000000000 +0100 @@ -0,0 +1,33 @@ +[tox] +envlist = + py{37,38,39,310}-test{,-devdeps} + codestyle +requires = + setuptools >= 30.3.0 + pip >= 19.3.1 +isolated_build = true + +[testenv] +changedir = .tmp/{envname} +description = run tests +deps = + pytest46: pytest==4.6.* + pytest50: pytest==5.0.* + 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 +extras = + test +commands = + pip freeze + pytest {toxinidir}/tests {posargs} + pytest {toxinidir}/tests --arraydiff {posargs} + +[testenv:codestyle] +skip_install = true +description = check code style, e.g. with flake8 +deps = flake8 +commands = flake8 pytest_arraydiff --count