Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-pytest-astropy-header for
openSUSE:Factory checked in at 2021-12-29 21:10:58
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-pytest-astropy-header (Old)
and /work/SRC/openSUSE:Factory/.python-pytest-astropy-header.new.2520
(New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pytest-astropy-header"
Wed Dec 29 21:10:58 2021 rev:6 rq:943003 version:0.2.0
Changes:
--------
---
/work/SRC/openSUSE:Factory/python-pytest-astropy-header/python-pytest-astropy-header.changes
2020-12-09 22:22:05.655716327 +0100
+++
/work/SRC/openSUSE:Factory/.python-pytest-astropy-header.new.2520/python-pytest-astropy-header.changes
2021-12-29 21:11:29.422311855 +0100
@@ -1,0 +2,16 @@
+Tue Dec 28 17:37:12 UTC 2021 - Ben Greiner <[email protected]>
+
+- Update to v0.2
+ * Suppressed PytestAssertRewriteWarning. [#4]
+ * Do not show astropy-helpers version in packages that don't use
+ it. [#16]
+ * Removed compatibility code for astropy < 4.0, and for
+ astropy-helpers. [#32]
+ * Removed astropy dependency. [#19, #34]
+ * Bumped minimum supported Python version to 3.7 and various
+ infrastructure updates. [#23, #39]
+- Drop patches
+ * pytest-astropy-header-pr16-no-helper-version.patch
+ * pytest-astropy-header-pr29-nohelpers.patch
+
+-------------------------------------------------------------------
Old:
----
pytest-astropy-header-0.1.2.tar.gz
pytest-astropy-header-pr16-no-helper-version.patch
pytest-astropy-header-pr29-nohelpers.patch
New:
----
pytest-astropy-header-0.2.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-pytest-astropy-header.spec ++++++
--- /var/tmp/diff_new_pack.NkMuIm/_old 2021-12-29 21:11:29.942312282 +0100
+++ /var/tmp/diff_new_pack.NkMuIm/_new 2021-12-29 21:11:29.950312289 +0100
@@ -1,7 +1,7 @@
#
-# spec file for package python-pytest-astropy-header
+# spec file
#
-# Copyright (c) 2020 SUSE LLC
+# Copyright (c) 2021 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -16,38 +16,36 @@
#
-%define modname pytest-astropy-header
-%define skip_python2 1
-%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%global flavor @BUILD_FLAVOR@%{nil}
%if "%{flavor}" == "test"
%define psuffix -test
-# current astropy in TW requires python >= 3.7
-%define skip_python36 1
%bcond_without test
%else
%define psuffix %{nil}
%bcond_with test
%endif
+%define modname pytest-astropy-header
+%{?!python_module:%define python_module() python3-%{**}}
+%define skip_python2 1
+%define skip_python36 1
Name: python-%{modname}%{psuffix}
-Version: 0.1.2
+Version: 0.2.0
Release: 0
Summary: Pytest plugin to add diagnostic information to the header of
the test output
License: BSD-3-Clause
Group: Productivity/Scientific/Astronomy
URL: https://github.com/astropy/pytest-astropy-header
Source:
https://files.pythonhosted.org/packages/source/p/%{modname}/%{modname}-%{version}.tar.gz
-Patch0:
https://github.com/astropy/pytest-astropy-header/pull/16.patch#/pytest-astropy-header-pr16-no-helper-version.patch
-Patch1:
https://github.com/astropy/pytest-astropy-header/pull/29.patch#/pytest-astropy-header-pr29-nohelpers.patch
+BuildRequires: %{python_module base >= 3.7}
BuildRequires: %{python_module setuptools >= 30.3.0}
+BuildRequires: %{python_module setuptools_scm}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
-Requires: python-pytest >= 2.8
+Requires: python-pytest >= 4.6
%if %{with test}
-# Patch0 and Patch1: helpers got removed in astropy 4
BuildRequires: %{python_module astropy >= 4.0}
BuildRequires: %{python_module numpy}
-BuildRequires: %{python_module pytest >= 2.8}
+BuildRequires: %{python_module pytest >= 4.6}
%endif
%python_subpackages
@@ -81,7 +79,7 @@
%doc CHANGES.rst README.rst
%license LICENSE.rst
%{python_sitelib}/pytest_astropy_header
-%{python_sitelib}/pytest_astropy_header-%{version}-py*.egg-info
+%{python_sitelib}/pytest_astropy_header-%{version}*-info
%endif
%changelog
++++++ pytest-astropy-header-0.1.2.tar.gz -> pytest-astropy-header-0.2.0.tar.gz
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/pytest-astropy-header-0.1.2/.github/workflows/ci_workflows.yml
new/pytest-astropy-header-0.2.0/.github/workflows/ci_workflows.yml
--- old/pytest-astropy-header-0.1.2/.github/workflows/ci_workflows.yml
1970-01-01 01:00:00.000000000 +0100
+++ new/pytest-astropy-header-0.2.0/.github/workflows/ci_workflows.yml
2021-12-27 18:22:00.000000000 +0100
@@ -0,0 +1,56 @@
+name: CI
+
+on:
+ pull_request:
+ push:
+ schedule:
+ # Run every Sunday at 05:53 UTC
+ - cron: 53 5 * * 0
+
+jobs:
+ tests:
+ runs-on: ${{ matrix.os }}
+ strategy:
+ fail-fast: true
+ 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-pytest51
+ - os: ubuntu-latest
+ python-version: 3.8
+ toxenv: py38-test-pytest52
+ - os: windows-latest
+ python-version: 3.9
+ toxenv: py39-test-pytest53
+ - os: macos-latest
+ python-version: 3.9
+ toxenv: py39-test-pytest60
+ - os: ubuntu-latest
+ python-version: 3.9
+ toxenv: py39-test-pytest61
+ - os: windows-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-astropy-header-0.1.2/.github/workflows/publish.yml
new/pytest-astropy-header-0.2.0/.github/workflows/publish.yml
--- old/pytest-astropy-header-0.1.2/.github/workflows/publish.yml
1970-01-01 01:00:00.000000000 +0100
+++ new/pytest-astropy-header-0.2.0/.github/workflows/publish.yml
2021-12-27 18:22:00.000000000 +0100
@@ -0,0 +1,47 @@
+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 wheel
+ run: python -m twine check --strict dist/*
+
+ - name: Test package
+ run: |
+ cd ..
+ python -m venv testenv
+ testenv/bin/pip install astropy pytest pytest-astropy-header/dist/*.whl
+ testenv/bin/pytest pytest-astropy-header/tests
+
+ - 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_API_TOKEN }}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-astropy-header-0.1.2/.gitignore
new/pytest-astropy-header-0.2.0/.gitignore
--- old/pytest-astropy-header-0.1.2/.gitignore 2019-10-07 20:13:45.000000000
+0200
+++ new/pytest-astropy-header-0.2.0/.gitignore 2021-12-27 18:22:00.000000000
+0100
@@ -12,6 +12,8 @@
# Other generated files
MANIFEST
+pytest_astropy_header/version.py
+pip-wheel-metadata/
# Sphinx
_build
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-astropy-header-0.1.2/.travis.yml
new/pytest-astropy-header-0.2.0/.travis.yml
--- old/pytest-astropy-header-0.1.2/.travis.yml 2019-12-05 15:19:02.000000000
+0100
+++ new/pytest-astropy-header-0.2.0/.travis.yml 1970-01-01 01:00:00.000000000
+0100
@@ -1,48 +0,0 @@
-# We set the language to c because python isn't supported on the MacOS X nodes
-# on Travis. However, the language ends up being irrelevant anyway, since we
-# install Python ourselves using conda.
-language: c
-
-os:
- - linux
- - windows
-
-# Use Travis' container-based architecture
-sudo: false
-
-env:
- global:
- # The following versions are the 'default' for tests, unless
- # overidden underneath. They are defined here in order to save having
- # to repeat them for all configurations.
- - PYTHON_VERSION=3.7
- - PYTEST_VERSION=4
- - PYTEST_COMMAND='pytest'
- - NUMPY_VERSION=stable
- - CONDA_DEPENDENCIES='astropy'
-
- matrix:
- - PYTHON_VERSION=2.7 NUMPY_VERSION=1.15 PYTEST_COMMAND='py.test'
- - PYTHON_VERSION=2.7 NUMPY_VERSION=1.15
- - PYTHON_VERSION=3.5 NUMPY_VERSION=1.15
- - PYTHON_VERSION=3.6
- - PYTHON_VERSION=3.7 PYTEST_VERSION=3.8
- - PYTHON_VERSION=3.7 PYTEST_VERSION=3.9
- - PYTHON_VERSION=3.7
-
-matrix:
- include:
- # Try a run on OSX with latest versions of python and pytest
- - os: osx
- env: PYTHON_VERSION=3.7
-
- # Try a run against latest pytest
- - env: PYTHON_VERSION=3.7 PYTEST_VERSION=5
-
-install:
- - git clone git://github.com/astropy/ci-helpers.git
- - source ci-helpers/travis/setup_conda.sh
- - pip install -e .
-
-script:
- - $PYTEST_COMMAND
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-astropy-header-0.1.2/CHANGES.rst
new/pytest-astropy-header-0.2.0/CHANGES.rst
--- old/pytest-astropy-header-0.1.2/CHANGES.rst 2019-12-18 15:53:08.000000000
+0100
+++ new/pytest-astropy-header-0.2.0/CHANGES.rst 2021-12-27 18:22:00.000000000
+0100
@@ -1,3 +1,16 @@
+0.2.0 (2021-12-27)
+==================
+
+- Suppressed ``PytestAssertRewriteWarning``. [#4]
+
+- Do not show astropy-helpers version in packages that don't use it. [#16]
+
+- Removed compatibility code for ``astropy`` < 4.0, and for
``astropy-helpers``. [#32]
+
+- Removed ``astropy`` dependency. [#19, #34]
+
+- Bumped minimum supported Python version to 3.7 and various infrastructure
updates. [#23, #39]
+
0.1.2 (2019-12-18)
==================
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-astropy-header-0.1.2/PKG-INFO
new/pytest-astropy-header-0.2.0/PKG-INFO
--- old/pytest-astropy-header-0.1.2/PKG-INFO 2019-12-18 15:54:13.525991200
+0100
+++ new/pytest-astropy-header-0.2.0/PKG-INFO 2021-12-27 18:22:16.337073300
+0100
@@ -1,190 +1,231 @@
Metadata-Version: 2.1
Name: pytest-astropy-header
-Version: 0.1.2
+Version: 0.2.0
Summary: pytest plugin to add diagnostic information to the header of the test
output
-Home-page: http://astropy.org
+Home-page: https://github.com/astropy/pytest-astropy-header
Author: The Astropy Developers
Author-email: [email protected]
License: BSD 3-Clause License
-Description: =====================
- pytest-astropy-header
- =====================
-
- This plugin package provides a way to include information about the
system,
- Python installation, and select dependencies in the header of the
output when
- running pytest. It can be used with packages that are not affiliated
with the
- Astropy project, but is optimized for use with astropy-related
projects.
-
- Installation
- ------------
-
- The ``pytest-astropy-header`` plugin can be installed using ``pip``::
-
- $ pip install pytest-astropy-header
-
- It is also possible to install the latest development version from the
source
- repository::
-
- $ git clone https://github.com/astropy/pytest-astropy-header
- $ cd pytest-astropy-header
- $ pip install .
-
- In either case, the plugin will automatically be registered for use
with
- ``pytest``.
-
- User guide
- ----------
-
- The plugin provided by this package makes it easy to include a header
- with diagnostic information before running the tests, e.g.::
-
- Running tests in astropy.
-
- Date: 2019-09-02T23:33:43
-
- Platform: Darwin-18.7.0-x86_64-i386-64bit
-
- Executable: /Users/tom/python/dev/bin/python3.7
-
- Full Python Version:
- 3.7.4 (v3.7.4:e09359112e, Jul 8 2019, 14:54:52)
- [Clang 6.0 (clang-600.0.57)]
-
- encodings: sys: utf-8, locale: UTF-8, filesystem: utf-8
- byteorder: little
- float info: dig: 15, mant_dig: 15
-
- Package versions:
- numpy: 1.16.4
- scipy: 1.3.0
- matplotlib: 3.1.1
- h5py: 2.9.0
- pandas: 0.24.2
- astropy: 4.0.dev25634
-
- Using Astropy options: remote_data: none.
-
- The most robust way to enable the plugin in a way that will work
regardless of
- how the tests are run (e.g. via ``python setup.py test``, ``pytest``,
or
- ``package.test()``) is to add the following to a ``conftest.py`` file
that is
- inside your package::
-
- def pytest_configure(config):
- config.option.astropy_header = True
-
-
- By default, a few packages will be shown, but you may want to
customize how the
- packages appear. As for enabling the plugin, the most robust way to do
this to
- be compatible with different astropy versions is via the
``conftest.py`` file::
-
- from pytest_astropy_header.display import PYTEST_HEADER_MODULES,
TESTED_VERSIONS
-
- def pytest_configure(config):
- config.option.astropy_header = True
- PYTEST_HEADER_MODULES.pop('Pandas')
- PYTEST_HEADER_MODULES['scikit-image'] = 'skimage'
-
- The key to ``PYTEST_HEADER_MODULES`` should be the name that will be
displayed
- in the header, and the value should be the name of the Python module.
-
- Migrating from the astropy header plugin to pytest-astropy
- ----------------------------------------------------------
-
- Before the v4.0 release of the core astropy package, the plugin that
handles the
- header of the testing output described above lived in
- ``astropy.tests.plugins.display``. A few steps are now needed to
update packages
- to make sure that only the pytest-astropy version is used instead.
These should
- be done in addition to the configuration mentioned in the previous
section.
-
- First, you should be able to significantly simplify the
``conftest.py`` file by
- replacing e.g.::
-
- from astropy.version import version as astropy_version
- if astropy_version < '3.0':
- # With older versions of Astropy, we actually need to import
the pytest
- # plugins themselves in order to make them discoverable by
pytest.
- from astropy.tests.pytest_plugins import *
- else:
- # As of Astropy 3.0, the pytest plugins provided by Astropy are
- # automatically made available when Astropy is installed. This
means it's
- # not necessary to import them here, but we still need to
import global
- # variables that are used for configuration.
- from astropy.tests.plugins.display import
(pytest_report_header,
-
PYTEST_HEADER_MODULES,
- TESTED_VERSIONS)
-
- # Customize the following lines to add/remove entries from
- # the list of packages for which version numbers are displayed
when running
- # the tests. Making it pass for KeyError is essential in some
cases when
- # the package uses other astropy affiliated packages.
- try:
- PYTEST_HEADER_MODULES['Astropy'] = 'astropy'
- del PYTEST_HEADER_MODULES['h5py']
- except KeyError:
- pass
-
- # This is to figure out the package version, rather than
- # using Astropy's
- from .version import version, astropy_helpers_version
-
- packagename = os.path.basename(os.path.dirname(__file__))
- TESTED_VERSIONS[packagename] = version
- TESTED_VERSIONS['astropy_helpers'] = astropy_helpers_version
-
- with e.g.::
-
- import os
-
- from astropy.version import version as astropy_version
- if astropy_version < '3.0':
- from astropy.tests.pytest_plugins import *
- del pytest_report_header
- else:
- from pytest_astropy_header.display import
PYTEST_HEADER_MODULES, TESTED_VERSIONS
-
-
- def pytest_configure(config):
-
- config.option.astropy_header = True
-
- PYTEST_HEADER_MODULES.pop('Pandas', None)
- PYTEST_HEADER_MODULES['scikit-image'] = 'skimage'
-
- from .version import version, astropy_helpers_version
- packagename = os.path.basename(os.path.dirname(__file__))
- TESTED_VERSIONS[packagename] = version
- TESTED_VERSIONS['astropy_helpers'] = astropy_helpers_version
-
- Note that while you will need to use a recent version of
pytest-astropy for this
- to work, it should work with Astropy 2.0 onwards without requiring all
the
- ``try...except`` for imports.
-
- Next check all of your ``conftest.py`` files and be sure to remove the
old
- plugin from lists such as::
-
- pytest_plugins = [
- 'astropy.tests.plugins.display',
- ]
-
- Development Status
- ------------------
-
- Questions, bug reports, and feature requests can be submitted on
`github`_.
-
- .. _github: https://github.com/astropy/pytest-astropy
-
- License
- -------
-
- This package is licensed under a 3-clause BSD style license - see the
- ``LICENSE.rst`` file.
-
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
-Classifier: Programming Language :: Python
-Classifier: Programming Language :: Python :: 2
-Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3 :: Only
+Classifier: Programming Language :: Python :: 3.7
+Classifier: Programming Language :: Python :: 3.8
+Classifier: Programming Language :: Python :: 3.9
+Classifier: Programming Language :: Python :: 3.10
Classifier: Operating System :: OS Independent
Classifier: License :: OSI Approved :: BSD License
+Requires-Python: >=3.7
+Description-Content-Type: text/x-rst
Provides-Extra: test
+License-File: LICENSE.rst
+
+=====================
+pytest-astropy-header
+=====================
+
+.. image:: https://img.shields.io/pypi/v/pytest-astropy-header.svg
+ :target: https://pypi.python.org/pypi/pytest-astropy-header
+
+.. image::
https://github.com/astropy/pytest-astropy-header/workflows/CI/badge.svg
+ :target: https://github.com/astropy/pytest-astropy-header/actions
+ :alt: CI Status
+
+This plugin package provides a way to include information about the system,
+Python installation, and select dependencies in the header of the output when
+running pytest. It can be used with packages that are not affiliated with the
+Astropy project, but is optimized for use with Astropy-related projects.
+
+Installation
+------------
+
+The ``pytest-astropy-header`` plugin can be installed using ``pip``::
+
+ $ pip install pytest-astropy-header
+
+It is also possible to install the latest development version from the source
+repository::
+
+ $ git clone https://github.com/astropy/pytest-astropy-header
+ $ cd pytest-astropy-header
+ $ pip install .
+
+In either case, the plugin will automatically be registered for use with
+``pytest``.
+
+User guide
+----------
+
+The plugin provided by this package makes it easy to include a header
+with diagnostic information before running the tests, e.g.::
+
+ Running tests in astropy.
+
+ Date: 2019-09-02T23:33:43
+
+ Platform: Darwin-18.7.0-x86_64-i386-64bit
+
+ Executable: /Users/tom/python/dev/bin/python3.7
+
+ Full Python Version:
+ 3.7.4 (v3.7.4:e09359112e, Jul 8 2019, 14:54:52)
+ [Clang 6.0 (clang-600.0.57)]
+
+ encodings: sys: utf-8, locale: UTF-8, filesystem: utf-8
+ byteorder: little
+ float info: dig: 15, mant_dig: 15
+
+ Package versions:
+ numpy: 1.16.4
+ scipy: 1.3.0
+ matplotlib: 3.1.1
+ h5py: 2.9.0
+ pandas: 0.24.2
+ astropy: 4.0.dev25634
+
+ Using Astropy options: remote_data: none.
+
+The most robust way to enable the plugin in a way that will work regardless of
+how the tests are run (e.g. via ``pytest``, or ``package.test()``)
+is to add the following to a ``conftest.py`` file that is
+inside your package::
+
+ def pytest_configure(config):
+ config.option.astropy_header = True
+
+**or** add the following to your ``setup.cfg``::
+
+ [tool:pytest]
+ astropy_header = true
+
+By default, a few packages will be shown, but you may want to customize how the
+packages appear. As for enabling the plugin, the most robust way to do this to
+be compatible with different astropy versions is via the ``conftest.py`` file::
+
+ try:
+ from pytest_astropy_header.display import PYTEST_HEADER_MODULES,
TESTED_VERSIONS
+ except ImportError: # In case this plugin is not installed
+ PYTEST_HEADER_MODULES = {}
+ TESTED_VERSIONS = {}
+
+ # This really depends on how you set up your package version,
+ # modify as needed.
+ from mypackage import __version__ as version
+
+ def pytest_configure(config):
+ config.option.astropy_header = True # If you do not have it in
setup.cfg
+ PYTEST_HEADER_MODULES.pop('Pandas')
+ PYTEST_HEADER_MODULES['scikit-image'] = 'skimage'
+ TESTED_VERSIONS['mypackage'] = version
+
+The key to ``PYTEST_HEADER_MODULES`` should be the name that will be displayed
+in the header, and the value should be the name of the Python module.
+
+If you would like to append other text to the end of the header, you can do
this
+by implementing your own ``pytest_report_header()`` function in the
+``conftest.py`` file in your package. For example, to add a custom footer to
the
+end of the Astropy header, you could define::
+
+ def pytest_report_header(config):
+ footer = ("This is some custom text that will appear after the "
+ "Astropy pytest header!")
+ return footer + "\n"
+
+
+Migrating from the astropy header plugin to pytest-astropy-header
+-----------------------------------------------------------------
+
+**Note: pytest-astropy-header no longer supports astropy<4.
+This section is only kept for historical reason.**
+
+Before the v4.0 release of the core astropy package, the plugin that handles
the
+header of the testing output described above lived in
+``astropy.tests.plugins.display``. A few steps are now needed to update
packages
+to make sure that only the pytest-astropy-header version is used instead.
These should
+be done in addition to the configuration mentioned in the previous section.
+
+First, you should be able to significantly simplify the ``conftest.py`` file by
+replacing e.g.::
+
+ from astropy.version import version as astropy_version
+ if astropy_version < '3.0':
+ # With older versions of Astropy, we actually need to import the pytest
+ # plugins themselves in order to make them discoverable by pytest.
+ from astropy.tests.pytest_plugins import *
+ else:
+ # As of Astropy 3.0, the pytest plugins provided by Astropy are
+ # automatically made available when Astropy is installed. This means
it's
+ # not necessary to import them here, but we still need to import global
+ # variables that are used for configuration.
+ from astropy.tests.plugins.display import (pytest_report_header,
+ PYTEST_HEADER_MODULES,
+ TESTED_VERSIONS)
+
+ # Customize the following lines to add/remove entries from
+ # the list of packages for which version numbers are displayed when running
+ # the tests. Making it pass for KeyError is essential in some cases when
+ # the package uses other astropy affiliated packages.
+ try:
+ PYTEST_HEADER_MODULES['Astropy'] = 'astropy'
+ del PYTEST_HEADER_MODULES['h5py']
+ except KeyError:
+ pass
+
+ # This is to figure out the package version, rather than
+ # using Astropy's
+ from .version import version, astropy_helpers_version
+
+ packagename = os.path.basename(os.path.dirname(__file__))
+ TESTED_VERSIONS[packagename] = version
+ TESTED_VERSIONS['astropy_helpers'] = astropy_helpers_version
+
+with e.g.::
+
+ import os
+
+ from astropy.version import version as astropy_version
+ if astropy_version < '3.0':
+ from astropy.tests.pytest_plugins import *
+ del pytest_report_header
+ else:
+ from pytest_astropy_header.display import PYTEST_HEADER_MODULES,
TESTED_VERSIONS
+
+
+ def pytest_configure(config):
+
+ config.option.astropy_header = True
+
+ PYTEST_HEADER_MODULES.pop('Pandas', None)
+ PYTEST_HEADER_MODULES['scikit-image'] = 'skimage'
+
+ from .version import version, astropy_helpers_version
+ packagename = os.path.basename(os.path.dirname(__file__))
+ TESTED_VERSIONS[packagename] = version
+ TESTED_VERSIONS['astropy_helpers'] = astropy_helpers_version
+
+Note that while you will need to use a recent version of pytest-astropy for
this
+to work, it should work with Astropy 2.0 onwards without requiring all the
+``try...except`` for imports.
+
+Next check all of your ``conftest.py`` files and be sure to remove the old
+plugin from lists such as::
+
+ pytest_plugins = [
+ 'astropy.tests.plugins.display',
+ ]
+
+Development Status
+------------------
+
+Questions, bug reports, and feature requests can be submitted on `github`_.
+
+.. _github: https://github.com/astropy/pytest-astropy
+
+License
+-------
+
+This package is licensed under a 3-clause BSD style license - see the
+``LICENSE.rst`` file.
+
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-astropy-header-0.1.2/README.rst
new/pytest-astropy-header-0.2.0/README.rst
--- old/pytest-astropy-header-0.1.2/README.rst 2019-10-07 20:14:41.000000000
+0200
+++ new/pytest-astropy-header-0.2.0/README.rst 2021-12-27 18:22:00.000000000
+0100
@@ -2,10 +2,17 @@
pytest-astropy-header
=====================
+.. image:: https://img.shields.io/pypi/v/pytest-astropy-header.svg
+ :target: https://pypi.python.org/pypi/pytest-astropy-header
+
+.. image::
https://github.com/astropy/pytest-astropy-header/workflows/CI/badge.svg
+ :target: https://github.com/astropy/pytest-astropy-header/actions
+ :alt: CI Status
+
This plugin package provides a way to include information about the system,
Python installation, and select dependencies in the header of the output when
running pytest. It can be used with packages that are not affiliated with the
-Astropy project, but is optimized for use with astropy-related projects.
+Astropy project, but is optimized for use with Astropy-related projects.
Installation
------------
@@ -57,35 +64,62 @@
Using Astropy options: remote_data: none.
The most robust way to enable the plugin in a way that will work regardless of
-how the tests are run (e.g. via ``python setup.py test``, ``pytest``, or
-``package.test()``) is to add the following to a ``conftest.py`` file that is
+how the tests are run (e.g. via ``pytest``, or ``package.test()``)
+is to add the following to a ``conftest.py`` file that is
inside your package::
def pytest_configure(config):
config.option.astropy_header = True
+**or** add the following to your ``setup.cfg``::
+
+ [tool:pytest]
+ astropy_header = true
By default, a few packages will be shown, but you may want to customize how the
packages appear. As for enabling the plugin, the most robust way to do this to
be compatible with different astropy versions is via the ``conftest.py`` file::
- from pytest_astropy_header.display import PYTEST_HEADER_MODULES,
TESTED_VERSIONS
+ try:
+ from pytest_astropy_header.display import PYTEST_HEADER_MODULES,
TESTED_VERSIONS
+ except ImportError: # In case this plugin is not installed
+ PYTEST_HEADER_MODULES = {}
+ TESTED_VERSIONS = {}
+
+ # This really depends on how you set up your package version,
+ # modify as needed.
+ from mypackage import __version__ as version
def pytest_configure(config):
- config.option.astropy_header = True
+ config.option.astropy_header = True # If you do not have it in
setup.cfg
PYTEST_HEADER_MODULES.pop('Pandas')
PYTEST_HEADER_MODULES['scikit-image'] = 'skimage'
+ TESTED_VERSIONS['mypackage'] = version
The key to ``PYTEST_HEADER_MODULES`` should be the name that will be displayed
in the header, and the value should be the name of the Python module.
-Migrating from the astropy header plugin to pytest-astropy
-----------------------------------------------------------
+If you would like to append other text to the end of the header, you can do
this
+by implementing your own ``pytest_report_header()`` function in the
+``conftest.py`` file in your package. For example, to add a custom footer to
the
+end of the Astropy header, you could define::
+
+ def pytest_report_header(config):
+ footer = ("This is some custom text that will appear after the "
+ "Astropy pytest header!")
+ return footer + "\n"
+
+
+Migrating from the astropy header plugin to pytest-astropy-header
+-----------------------------------------------------------------
+
+**Note: pytest-astropy-header no longer supports astropy<4.
+This section is only kept for historical reason.**
Before the v4.0 release of the core astropy package, the plugin that handles
the
header of the testing output described above lived in
``astropy.tests.plugins.display``. A few steps are now needed to update
packages
-to make sure that only the pytest-astropy version is used instead. These should
+to make sure that only the pytest-astropy-header version is used instead.
These should
be done in addition to the configuration mentioned in the previous section.
First, you should be able to significantly simplify the ``conftest.py`` file by
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-astropy-header-0.1.2/pyproject.toml
new/pytest-astropy-header-0.2.0/pyproject.toml
--- old/pytest-astropy-header-0.1.2/pyproject.toml 1970-01-01
01:00:00.000000000 +0100
+++ new/pytest-astropy-header-0.2.0/pyproject.toml 2021-12-27
18:22:00.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-astropy-header-0.1.2/pytest_astropy_header/__init__.py
new/pytest-astropy-header-0.2.0/pytest_astropy_header/__init__.py
--- old/pytest-astropy-header-0.1.2/pytest_astropy_header/__init__.py
2019-12-18 15:53:48.000000000 +0100
+++ new/pytest-astropy-header-0.2.0/pytest_astropy_header/__init__.py
2021-12-27 18:22:00.000000000 +0100
@@ -1 +1,3 @@
-__version__ = '0.1.2'
+# 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-astropy-header-0.1.2/pytest_astropy_header/display.py
new/pytest-astropy-header-0.2.0/pytest_astropy_header/display.py
--- old/pytest-astropy-header-0.1.2/pytest_astropy_header/display.py
2019-12-18 15:51:35.000000000 +0100
+++ new/pytest-astropy-header-0.2.0/pytest_astropy_header/display.py
2021-12-27 18:22:00.000000000 +0100
@@ -2,54 +2,24 @@
"""
This plugin provides customization of the header displayed by pytest for
reporting purposes.
-"""
-import os
-import sys
+PYTEST_DONT_REWRITE
+
+"""
import datetime
+import importlib
import locale
-import math
+import os
+import sys
from collections import OrderedDict
-from distutils.version import LooseVersion
+TESTED_VERSIONS = {}
PYTEST_HEADER_MODULES = OrderedDict([('Numpy', 'numpy'),
('Scipy', 'scipy'),
('Matplotlib', 'matplotlib'),
('h5py', 'h5py'),
('Pandas', 'pandas')])
-try:
-
- from astropy import __version__ as astropy_version
- from astropy.tests.helper import ignore_warnings
- from astropy.utils.introspection import resolve_name
-
-except ImportError:
-
- ASTROPY_INSTALLED = False
-
-else:
-
- ASTROPY_INSTALLED = True
-
- TESTED_VERSIONS = OrderedDict([('Astropy', astropy_version)])
-
- if astropy_version == 'unknown': # assume developer version
- ASTROPY_LT_30 = ASTROPY_LT_40 = False
- else:
- ASTROPY_LT_30 = LooseVersion(astropy_version) < '3.0'
- ASTROPY_LT_40 = LooseVersion(astropy_version) < '4.0'
-
- # If using a version of astropy that has the display plugin, we make sure
that
- # we use those variables for listing the packages, in case we choose to let
- # that plugin handle things below (which we do if that plugin is active).
- if ASTROPY_LT_30:
- from astropy.tests.pytest_plugins import (PYTEST_HEADER_MODULES,
- TESTED_VERSIONS)
- elif ASTROPY_LT_40:
- from astropy.tests.plugins.display import (PYTEST_HEADER_MODULES,
- TESTED_VERSIONS)
-
def pytest_addoption(parser):
@@ -66,14 +36,6 @@
def pytest_report_header(config):
- if not ASTROPY_INSTALLED:
- return
-
- # If the astropy display plugin is registered, we stop now and let it
- # handle the header.
- if ASTROPY_LT_40 and
config.pluginmanager.hasplugin('astropy.tests.plugins.display'):
- return
-
if not config.getoption("astropy_header") and not
config.getini("astropy_header"):
return
@@ -98,15 +60,9 @@
args = config.args
- # TESTED_VERSIONS can contain the affiliated package version, too
- if len(TESTED_VERSIONS) > 1:
- for pkg, version in TESTED_VERSIONS.items():
- if pkg not in ['Astropy', 'astropy_helpers']:
- s = "\nRunning tests with {} version {}.\n".format(
- pkg, version)
- else:
- s = "\nRunning tests with Astropy version {}.\n".format(
- TESTED_VERSIONS['Astropy'])
+ s = ''
+ for pkg, version in TESTED_VERSIONS.items():
+ s += f"\nRunning tests with {pkg} version {version}.\n"
# Per https://github.com/astropy/astropy/pull/4204, strip the rootdir from
# each directory argument
@@ -124,13 +80,14 @@
s += "Date: {}\n\n".format(datetime.datetime.now().isoformat()[:19])
+ import warnings
from platform import platform
plat = platform()
if isinstance(plat, bytes):
plat = plat.decode(stdoutencoding, 'replace')
- s += "Platform: {plat}\n\n".format(plat=plat)
- s += "Executable: {executable}\n\n".format(executable=sys.executable)
- s += "Full Python Version: \n{version}\n\n".format(version=sys.version)
+ s += f"Platform: {plat}\n\n"
+ s += f"Executable: {sys.executable}\n\n"
+ s += f"Full Python Version: \n{sys.version}\n\n"
s += "encodings: sys: {}, locale: {}, filesystem: {}".format(
sys.getdefaultencoding(),
@@ -138,7 +95,7 @@
sys.getfilesystemencoding())
s += '\n'
- s += "byteorder: {byteorder}\n".format(byteorder=sys.byteorder)
+ s += f"byteorder: {sys.byteorder}\n"
s += "float info: dig: {0.dig}, mant_dig: {0.dig}\n\n".format(
sys.float_info)
@@ -146,28 +103,17 @@
for module_display, module_name in packages_to_display.items():
try:
- with ignore_warnings(DeprecationWarning):
- module = resolve_name(module_name)
+ with warnings.catch_warnings():
+ warnings.filterwarnings('ignore', category=DeprecationWarning)
+ module = importlib.import_module(module_name)
except ImportError:
- s += "{module_display}: not
available\n".format(module_display=module_display)
+ s += f"{module_display}: not available\n"
else:
try:
version = module.__version__
except AttributeError:
version = 'unknown (no __version__ attribute)'
- s += "{module_display}:
{version}\n".format(module_display=module_display, version=version)
-
- # Helpers version
- if 'astropy_helpers' in TESTED_VERSIONS:
- astropy_helpers_version = TESTED_VERSIONS['astropy_helpers']
- else:
- try:
- from astropy.version import astropy_helpers_version
- except ImportError:
- astropy_helpers_version = None
-
- if astropy_helpers_version:
- s += "astropy-helpers:
{astropy_helpers_version}\n".format(astropy_helpers_version=astropy_helpers_version)
+ s += f"{module_display}: {version}\n"
s += "\n"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/pytest-astropy-header-0.1.2/pytest_astropy_header/version.py
new/pytest-astropy-header-0.2.0/pytest_astropy_header/version.py
--- old/pytest-astropy-header-0.1.2/pytest_astropy_header/version.py
1970-01-01 01:00:00.000000000 +0100
+++ new/pytest-astropy-header-0.2.0/pytest_astropy_header/version.py
2021-12-27 18:22:16.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.2.0'
+version_tuple = (0, 2, 0)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/pytest-astropy-header-0.1.2/pytest_astropy_header.egg-info/PKG-INFO
new/pytest-astropy-header-0.2.0/pytest_astropy_header.egg-info/PKG-INFO
--- old/pytest-astropy-header-0.1.2/pytest_astropy_header.egg-info/PKG-INFO
2019-12-18 15:54:13.000000000 +0100
+++ new/pytest-astropy-header-0.2.0/pytest_astropy_header.egg-info/PKG-INFO
2021-12-27 18:22:16.000000000 +0100
@@ -1,190 +1,231 @@
Metadata-Version: 2.1
Name: pytest-astropy-header
-Version: 0.1.2
+Version: 0.2.0
Summary: pytest plugin to add diagnostic information to the header of the test
output
-Home-page: http://astropy.org
+Home-page: https://github.com/astropy/pytest-astropy-header
Author: The Astropy Developers
Author-email: [email protected]
License: BSD 3-Clause License
-Description: =====================
- pytest-astropy-header
- =====================
-
- This plugin package provides a way to include information about the
system,
- Python installation, and select dependencies in the header of the
output when
- running pytest. It can be used with packages that are not affiliated
with the
- Astropy project, but is optimized for use with astropy-related
projects.
-
- Installation
- ------------
-
- The ``pytest-astropy-header`` plugin can be installed using ``pip``::
-
- $ pip install pytest-astropy-header
-
- It is also possible to install the latest development version from the
source
- repository::
-
- $ git clone https://github.com/astropy/pytest-astropy-header
- $ cd pytest-astropy-header
- $ pip install .
-
- In either case, the plugin will automatically be registered for use
with
- ``pytest``.
-
- User guide
- ----------
-
- The plugin provided by this package makes it easy to include a header
- with diagnostic information before running the tests, e.g.::
-
- Running tests in astropy.
-
- Date: 2019-09-02T23:33:43
-
- Platform: Darwin-18.7.0-x86_64-i386-64bit
-
- Executable: /Users/tom/python/dev/bin/python3.7
-
- Full Python Version:
- 3.7.4 (v3.7.4:e09359112e, Jul 8 2019, 14:54:52)
- [Clang 6.0 (clang-600.0.57)]
-
- encodings: sys: utf-8, locale: UTF-8, filesystem: utf-8
- byteorder: little
- float info: dig: 15, mant_dig: 15
-
- Package versions:
- numpy: 1.16.4
- scipy: 1.3.0
- matplotlib: 3.1.1
- h5py: 2.9.0
- pandas: 0.24.2
- astropy: 4.0.dev25634
-
- Using Astropy options: remote_data: none.
-
- The most robust way to enable the plugin in a way that will work
regardless of
- how the tests are run (e.g. via ``python setup.py test``, ``pytest``,
or
- ``package.test()``) is to add the following to a ``conftest.py`` file
that is
- inside your package::
-
- def pytest_configure(config):
- config.option.astropy_header = True
-
-
- By default, a few packages will be shown, but you may want to
customize how the
- packages appear. As for enabling the plugin, the most robust way to do
this to
- be compatible with different astropy versions is via the
``conftest.py`` file::
-
- from pytest_astropy_header.display import PYTEST_HEADER_MODULES,
TESTED_VERSIONS
-
- def pytest_configure(config):
- config.option.astropy_header = True
- PYTEST_HEADER_MODULES.pop('Pandas')
- PYTEST_HEADER_MODULES['scikit-image'] = 'skimage'
-
- The key to ``PYTEST_HEADER_MODULES`` should be the name that will be
displayed
- in the header, and the value should be the name of the Python module.
-
- Migrating from the astropy header plugin to pytest-astropy
- ----------------------------------------------------------
-
- Before the v4.0 release of the core astropy package, the plugin that
handles the
- header of the testing output described above lived in
- ``astropy.tests.plugins.display``. A few steps are now needed to
update packages
- to make sure that only the pytest-astropy version is used instead.
These should
- be done in addition to the configuration mentioned in the previous
section.
-
- First, you should be able to significantly simplify the
``conftest.py`` file by
- replacing e.g.::
-
- from astropy.version import version as astropy_version
- if astropy_version < '3.0':
- # With older versions of Astropy, we actually need to import
the pytest
- # plugins themselves in order to make them discoverable by
pytest.
- from astropy.tests.pytest_plugins import *
- else:
- # As of Astropy 3.0, the pytest plugins provided by Astropy are
- # automatically made available when Astropy is installed. This
means it's
- # not necessary to import them here, but we still need to
import global
- # variables that are used for configuration.
- from astropy.tests.plugins.display import
(pytest_report_header,
-
PYTEST_HEADER_MODULES,
- TESTED_VERSIONS)
-
- # Customize the following lines to add/remove entries from
- # the list of packages for which version numbers are displayed
when running
- # the tests. Making it pass for KeyError is essential in some
cases when
- # the package uses other astropy affiliated packages.
- try:
- PYTEST_HEADER_MODULES['Astropy'] = 'astropy'
- del PYTEST_HEADER_MODULES['h5py']
- except KeyError:
- pass
-
- # This is to figure out the package version, rather than
- # using Astropy's
- from .version import version, astropy_helpers_version
-
- packagename = os.path.basename(os.path.dirname(__file__))
- TESTED_VERSIONS[packagename] = version
- TESTED_VERSIONS['astropy_helpers'] = astropy_helpers_version
-
- with e.g.::
-
- import os
-
- from astropy.version import version as astropy_version
- if astropy_version < '3.0':
- from astropy.tests.pytest_plugins import *
- del pytest_report_header
- else:
- from pytest_astropy_header.display import
PYTEST_HEADER_MODULES, TESTED_VERSIONS
-
-
- def pytest_configure(config):
-
- config.option.astropy_header = True
-
- PYTEST_HEADER_MODULES.pop('Pandas', None)
- PYTEST_HEADER_MODULES['scikit-image'] = 'skimage'
-
- from .version import version, astropy_helpers_version
- packagename = os.path.basename(os.path.dirname(__file__))
- TESTED_VERSIONS[packagename] = version
- TESTED_VERSIONS['astropy_helpers'] = astropy_helpers_version
-
- Note that while you will need to use a recent version of
pytest-astropy for this
- to work, it should work with Astropy 2.0 onwards without requiring all
the
- ``try...except`` for imports.
-
- Next check all of your ``conftest.py`` files and be sure to remove the
old
- plugin from lists such as::
-
- pytest_plugins = [
- 'astropy.tests.plugins.display',
- ]
-
- Development Status
- ------------------
-
- Questions, bug reports, and feature requests can be submitted on
`github`_.
-
- .. _github: https://github.com/astropy/pytest-astropy
-
- License
- -------
-
- This package is licensed under a 3-clause BSD style license - see the
- ``LICENSE.rst`` file.
-
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
-Classifier: Programming Language :: Python
-Classifier: Programming Language :: Python :: 2
-Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3 :: Only
+Classifier: Programming Language :: Python :: 3.7
+Classifier: Programming Language :: Python :: 3.8
+Classifier: Programming Language :: Python :: 3.9
+Classifier: Programming Language :: Python :: 3.10
Classifier: Operating System :: OS Independent
Classifier: License :: OSI Approved :: BSD License
+Requires-Python: >=3.7
+Description-Content-Type: text/x-rst
Provides-Extra: test
+License-File: LICENSE.rst
+
+=====================
+pytest-astropy-header
+=====================
+
+.. image:: https://img.shields.io/pypi/v/pytest-astropy-header.svg
+ :target: https://pypi.python.org/pypi/pytest-astropy-header
+
+.. image::
https://github.com/astropy/pytest-astropy-header/workflows/CI/badge.svg
+ :target: https://github.com/astropy/pytest-astropy-header/actions
+ :alt: CI Status
+
+This plugin package provides a way to include information about the system,
+Python installation, and select dependencies in the header of the output when
+running pytest. It can be used with packages that are not affiliated with the
+Astropy project, but is optimized for use with Astropy-related projects.
+
+Installation
+------------
+
+The ``pytest-astropy-header`` plugin can be installed using ``pip``::
+
+ $ pip install pytest-astropy-header
+
+It is also possible to install the latest development version from the source
+repository::
+
+ $ git clone https://github.com/astropy/pytest-astropy-header
+ $ cd pytest-astropy-header
+ $ pip install .
+
+In either case, the plugin will automatically be registered for use with
+``pytest``.
+
+User guide
+----------
+
+The plugin provided by this package makes it easy to include a header
+with diagnostic information before running the tests, e.g.::
+
+ Running tests in astropy.
+
+ Date: 2019-09-02T23:33:43
+
+ Platform: Darwin-18.7.0-x86_64-i386-64bit
+
+ Executable: /Users/tom/python/dev/bin/python3.7
+
+ Full Python Version:
+ 3.7.4 (v3.7.4:e09359112e, Jul 8 2019, 14:54:52)
+ [Clang 6.0 (clang-600.0.57)]
+
+ encodings: sys: utf-8, locale: UTF-8, filesystem: utf-8
+ byteorder: little
+ float info: dig: 15, mant_dig: 15
+
+ Package versions:
+ numpy: 1.16.4
+ scipy: 1.3.0
+ matplotlib: 3.1.1
+ h5py: 2.9.0
+ pandas: 0.24.2
+ astropy: 4.0.dev25634
+
+ Using Astropy options: remote_data: none.
+
+The most robust way to enable the plugin in a way that will work regardless of
+how the tests are run (e.g. via ``pytest``, or ``package.test()``)
+is to add the following to a ``conftest.py`` file that is
+inside your package::
+
+ def pytest_configure(config):
+ config.option.astropy_header = True
+
+**or** add the following to your ``setup.cfg``::
+
+ [tool:pytest]
+ astropy_header = true
+
+By default, a few packages will be shown, but you may want to customize how the
+packages appear. As for enabling the plugin, the most robust way to do this to
+be compatible with different astropy versions is via the ``conftest.py`` file::
+
+ try:
+ from pytest_astropy_header.display import PYTEST_HEADER_MODULES,
TESTED_VERSIONS
+ except ImportError: # In case this plugin is not installed
+ PYTEST_HEADER_MODULES = {}
+ TESTED_VERSIONS = {}
+
+ # This really depends on how you set up your package version,
+ # modify as needed.
+ from mypackage import __version__ as version
+
+ def pytest_configure(config):
+ config.option.astropy_header = True # If you do not have it in
setup.cfg
+ PYTEST_HEADER_MODULES.pop('Pandas')
+ PYTEST_HEADER_MODULES['scikit-image'] = 'skimage'
+ TESTED_VERSIONS['mypackage'] = version
+
+The key to ``PYTEST_HEADER_MODULES`` should be the name that will be displayed
+in the header, and the value should be the name of the Python module.
+
+If you would like to append other text to the end of the header, you can do
this
+by implementing your own ``pytest_report_header()`` function in the
+``conftest.py`` file in your package. For example, to add a custom footer to
the
+end of the Astropy header, you could define::
+
+ def pytest_report_header(config):
+ footer = ("This is some custom text that will appear after the "
+ "Astropy pytest header!")
+ return footer + "\n"
+
+
+Migrating from the astropy header plugin to pytest-astropy-header
+-----------------------------------------------------------------
+
+**Note: pytest-astropy-header no longer supports astropy<4.
+This section is only kept for historical reason.**
+
+Before the v4.0 release of the core astropy package, the plugin that handles
the
+header of the testing output described above lived in
+``astropy.tests.plugins.display``. A few steps are now needed to update
packages
+to make sure that only the pytest-astropy-header version is used instead.
These should
+be done in addition to the configuration mentioned in the previous section.
+
+First, you should be able to significantly simplify the ``conftest.py`` file by
+replacing e.g.::
+
+ from astropy.version import version as astropy_version
+ if astropy_version < '3.0':
+ # With older versions of Astropy, we actually need to import the pytest
+ # plugins themselves in order to make them discoverable by pytest.
+ from astropy.tests.pytest_plugins import *
+ else:
+ # As of Astropy 3.0, the pytest plugins provided by Astropy are
+ # automatically made available when Astropy is installed. This means
it's
+ # not necessary to import them here, but we still need to import global
+ # variables that are used for configuration.
+ from astropy.tests.plugins.display import (pytest_report_header,
+ PYTEST_HEADER_MODULES,
+ TESTED_VERSIONS)
+
+ # Customize the following lines to add/remove entries from
+ # the list of packages for which version numbers are displayed when running
+ # the tests. Making it pass for KeyError is essential in some cases when
+ # the package uses other astropy affiliated packages.
+ try:
+ PYTEST_HEADER_MODULES['Astropy'] = 'astropy'
+ del PYTEST_HEADER_MODULES['h5py']
+ except KeyError:
+ pass
+
+ # This is to figure out the package version, rather than
+ # using Astropy's
+ from .version import version, astropy_helpers_version
+
+ packagename = os.path.basename(os.path.dirname(__file__))
+ TESTED_VERSIONS[packagename] = version
+ TESTED_VERSIONS['astropy_helpers'] = astropy_helpers_version
+
+with e.g.::
+
+ import os
+
+ from astropy.version import version as astropy_version
+ if astropy_version < '3.0':
+ from astropy.tests.pytest_plugins import *
+ del pytest_report_header
+ else:
+ from pytest_astropy_header.display import PYTEST_HEADER_MODULES,
TESTED_VERSIONS
+
+
+ def pytest_configure(config):
+
+ config.option.astropy_header = True
+
+ PYTEST_HEADER_MODULES.pop('Pandas', None)
+ PYTEST_HEADER_MODULES['scikit-image'] = 'skimage'
+
+ from .version import version, astropy_helpers_version
+ packagename = os.path.basename(os.path.dirname(__file__))
+ TESTED_VERSIONS[packagename] = version
+ TESTED_VERSIONS['astropy_helpers'] = astropy_helpers_version
+
+Note that while you will need to use a recent version of pytest-astropy for
this
+to work, it should work with Astropy 2.0 onwards without requiring all the
+``try...except`` for imports.
+
+Next check all of your ``conftest.py`` files and be sure to remove the old
+plugin from lists such as::
+
+ pytest_plugins = [
+ 'astropy.tests.plugins.display',
+ ]
+
+Development Status
+------------------
+
+Questions, bug reports, and feature requests can be submitted on `github`_.
+
+.. _github: https://github.com/astropy/pytest-astropy
+
+License
+-------
+
+This package is licensed under a 3-clause BSD style license - see the
+``LICENSE.rst`` file.
+
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/pytest-astropy-header-0.1.2/pytest_astropy_header.egg-info/SOURCES.txt
new/pytest-astropy-header-0.2.0/pytest_astropy_header.egg-info/SOURCES.txt
--- old/pytest-astropy-header-0.1.2/pytest_astropy_header.egg-info/SOURCES.txt
2019-12-18 15:54:13.000000000 +0100
+++ new/pytest-astropy-header-0.2.0/pytest_astropy_header.egg-info/SOURCES.txt
2021-12-27 18:22:16.000000000 +0100
@@ -1,13 +1,17 @@
.gitignore
-.travis.yml
CHANGES.rst
LICENSE.rst
MANIFEST.in
README.rst
+pyproject.toml
setup.cfg
setup.py
+tox.ini
+.github/workflows/ci_workflows.yml
+.github/workflows/publish.yml
pytest_astropy_header/__init__.py
pytest_astropy_header/display.py
+pytest_astropy_header/version.py
pytest_astropy_header.egg-info/PKG-INFO
pytest_astropy_header.egg-info/SOURCES.txt
pytest_astropy_header.egg-info/dependency_links.txt
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/pytest-astropy-header-0.1.2/pytest_astropy_header.egg-info/requires.txt
new/pytest-astropy-header-0.2.0/pytest_astropy_header.egg-info/requires.txt
--- old/pytest-astropy-header-0.1.2/pytest_astropy_header.egg-info/requires.txt
2019-12-18 15:54:13.000000000 +0100
+++ new/pytest-astropy-header-0.2.0/pytest_astropy_header.egg-info/requires.txt
2021-12-27 18:22:16.000000000 +0100
@@ -1,9 +1,5 @@
-pytest>=2.8
+pytest>=4.6
[test]
-pytest
-pytest-cov
-codecov
-coverage
numpy
-astropy
+astropy>=4.0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-astropy-header-0.1.2/setup.cfg
new/pytest-astropy-header-0.2.0/setup.cfg
--- old/pytest-astropy-header-0.1.2/setup.cfg 2019-12-18 15:54:13.526912500
+0100
+++ new/pytest-astropy-header-0.2.0/setup.cfg 2021-12-27 18:22:16.337073300
+0100
@@ -1,40 +1,44 @@
[metadata]
name = pytest-astropy-header
-version = attr:pytest_astropy_header.__version__
description = pytest plugin to add diagnostic information to the header of the
test output
long_description = file:README.rst
+long_description_content_type = text/x-rst
author = The Astropy Developers
author_email = [email protected]
license = BSD 3-Clause License
-url = http://astropy.org
+url = https://github.com/astropy/pytest-astropy-header
classifiers =
Development Status :: 3 - Alpha
Intended Audience :: Developers
- Programming Language :: Python
- Programming Language :: Python :: 2
- 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
Operating System :: OS Independent
License :: OSI Approved :: BSD License
[options]
zip_safe = False
packages = find:
+python_requires = >=3.7
+setup_requires =
+ setuptools_scm
install_requires =
- pytest>=2.8
+ pytest>=4.6
[options.extras_require]
test =
- pytest
- pytest-cov
- codecov
- coverage
numpy
- astropy
+ astropy>=4.0
[options.entry_points]
pytest11 =
pytest_astropy_header = pytest_astropy_header.display
+[flake8]
+max-line-length = 125
+
[egg_info]
tag_build =
tag_date = 0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-astropy-header-0.1.2/setup.py
new/pytest-astropy-header-0.2.0/setup.py
--- old/pytest-astropy-header-0.1.2/setup.py 2019-10-07 20:13:45.000000000
+0200
+++ new/pytest-astropy-header-0.2.0/setup.py 2021-12-27 18:22:00.000000000
+0100
@@ -1,14 +1,6 @@
#!/usr/bin/env python
-import sys
-import setuptools
-from distutils.version import LooseVersion
+import os
from setuptools import setup
-# Setuptools 30.3.0 or later is needed for setup.cfg options to be used
-if LooseVersion(setuptools.__version__) < LooseVersion('30.3.0'):
- sys.stderr.write("ERROR: sphinx-automodapi requires setuptools 30.3.0 or "
- "later (found {0})".format(setuptools.__version__))
- sys.exit(1)
-
-setup()
+setup(use_scm_version={'write_to': os.path.join('pytest_astropy_header',
'version.py')})
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-astropy-header-0.1.2/tests/test_display.py
new/pytest-astropy-header-0.2.0/tests/test_display.py
--- old/pytest-astropy-header-0.1.2/tests/test_display.py 2019-12-18
15:51:35.000000000 +0100
+++ new/pytest-astropy-header-0.2.0/tests/test_display.py 2021-12-27
18:22:00.000000000 +0100
@@ -1,5 +1,4 @@
import pytest
-
import numpy
NUMPY_VERSION = numpy.__version__
@@ -42,16 +41,15 @@
def pytest_configure(config):
config.option.astropy_header = True
""")
- testdir.inline_run()
+ testdir.inline_run()
out, err = capsys.readouterr()
lines = extract_package_version_lines(out)
- assert len(lines) == 6
+ assert len(lines) == 5
assert lines[0].startswith('Numpy: ')
assert lines[1].startswith('Scipy: ')
assert lines[2].startswith('Matplotlib: ')
assert lines[3].startswith('h5py: ')
assert lines[4].startswith('Pandas: ')
- assert lines[5].startswith('astropy-helpers: ')
@pytest.mark.parametrize('method', ['ini', 'conftest'])
@@ -100,9 +98,8 @@
testdir.inline_run()
out, err = capsys.readouterr()
lines = extract_package_version_lines(out)
- assert len(lines) == 2
- assert lines[0] == 'numpy:
{NUMPY_VERSION}'.format(NUMPY_VERSION=NUMPY_VERSION)
- assert lines[1].startswith('astropy-helpers: ')
+ assert len(lines) == 1
+ assert lines[0] == f'numpy: {NUMPY_VERSION}'
@pytest.mark.parametrize('method', ['cli', 'ini', 'ini_list', 'conftest'])
@@ -135,10 +132,9 @@
out, err = capsys.readouterr()
print(out)
lines = extract_package_version_lines(out)
- assert len(lines) == 3
- assert lines[0] == 'numpy:
{NUMPY_VERSION}'.format(NUMPY_VERSION=NUMPY_VERSION)
+ assert len(lines) == 2
+ assert lines[0] == f'numpy: {NUMPY_VERSION}'
assert lines[1].startswith('pandas')
- assert lines[2].startswith('astropy-helpers: ')
@pytest.mark.parametrize('method', ['cli', 'ini', 'ini_list', 'conftest'])
@@ -169,9 +165,8 @@
testdir.inline_run()
out, err = capsys.readouterr()
lines = extract_package_version_lines(out)
- assert len(lines) == 2
+ assert len(lines) == 1
assert lines[0] == 'apackagethatdoesnotexist: not available'
- assert lines[1].startswith('astropy-helpers: ')
def test_modify_in_conftest(testdir, capsys):
@@ -188,11 +183,10 @@
out, err = capsys.readouterr()
assert err == ''
lines = extract_package_version_lines(out)
- assert len(lines) == 6
+ assert len(lines) == 5
assert lines[0].startswith('Numpy: ')
assert lines[1].startswith('Scipy: ')
assert lines[2].startswith('Matplotlib: ')
assert lines[3].startswith('h5py: ')
assert lines[4].startswith('scikit-image: ')
- assert lines[5].startswith('astropy-helpers: ')
assert 'Running tests with fakepackage version 1.0.2' in out
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-astropy-header-0.1.2/tox.ini
new/pytest-astropy-header-0.2.0/tox.ini
--- old/pytest-astropy-header-0.1.2/tox.ini 1970-01-01 01:00:00.000000000
+0100
+++ new/pytest-astropy-header-0.2.0/tox.ini 2021-12-27 18:22:00.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
+extras = test
+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 =
+ pip freeze
+ pytest {toxinidir}/tests {posargs}
+
+[testenv:codestyle]
+skip_install = true
+description = check code style, e.g. with flake8
+deps = flake8
+commands = flake8 pytest_astropy_header --count