forked from pool/python-pytest-astropy-header
Accepting request 942974 from home:bnavigator:branches:devel:languages:python:pytest
- 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 OBS-URL: https://build.opensuse.org/request/show/942974 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:pytest/python-pytest-astropy-header?expand=0&rev=11
This commit is contained in:
@@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:afdc79650b24d175d54da459fc88f597144e65af3e7eb85fe9e61231f25307f9
|
|
||||||
size 9260
|
|
||||||
3
pytest-astropy-header-0.2.0.tar.gz
Normal file
3
pytest-astropy-header-0.2.0.tar.gz
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:50d60c92d988510e7bceade795a79ed143b36fd70b17fd1bfa778eb428a4a166
|
||||||
|
size 10081
|
||||||
@@ -1,168 +0,0 @@
|
|||||||
From 0d5d2768ba7727977eaa9c750c067c60fa667631 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Thomas Robitaille <thomas.robitaille@gmail.com>
|
|
||||||
Date: Tue, 28 Jan 2020 12:40:36 +0000
|
|
||||||
Subject: [PATCH] Don't show astropy-helpers version in packages that don't use
|
|
||||||
it
|
|
||||||
|
|
||||||
---
|
|
||||||
CHANGES.rst | 5 +++++
|
|
||||||
pytest_astropy_header/display.py | 29 +++++++++++++++---------
|
|
||||||
tests/test_display.py | 38 ++++++++++++++++++++++++--------
|
|
||||||
3 files changed, 52 insertions(+), 20 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/CHANGES.rst b/CHANGES.rst
|
|
||||||
index d215057..5d8af5f 100644
|
|
||||||
--- a/CHANGES.rst
|
|
||||||
+++ b/CHANGES.rst
|
|
||||||
@@ -1,3 +1,8 @@
|
|
||||||
+0.1.3 (unreleased)
|
|
||||||
+==================
|
|
||||||
+
|
|
||||||
+- Don't show astropy-helpers version in packages that don't use it. [#16]
|
|
||||||
+
|
|
||||||
0.1.2 (2019-12-18)
|
|
||||||
==================
|
|
||||||
|
|
||||||
diff --git a/pytest_astropy_header/display.py b/pytest_astropy_header/display.py
|
|
||||||
index 48c8a22..e23d820 100644
|
|
||||||
--- a/pytest_astropy_header/display.py
|
|
||||||
+++ b/pytest_astropy_header/display.py
|
|
||||||
@@ -8,10 +8,14 @@
|
|
||||||
import sys
|
|
||||||
import datetime
|
|
||||||
import locale
|
|
||||||
-import math
|
|
||||||
from collections import OrderedDict
|
|
||||||
from distutils.version import LooseVersion
|
|
||||||
|
|
||||||
+if sys.version_info[0] >= 3:
|
|
||||||
+ import builtins
|
|
||||||
+else:
|
|
||||||
+ import __builtin__ as builtins
|
|
||||||
+
|
|
||||||
PYTEST_HEADER_MODULES = OrderedDict([('Numpy', 'numpy'),
|
|
||||||
('Scipy', 'scipy'),
|
|
||||||
('Matplotlib', 'matplotlib'),
|
|
||||||
@@ -157,17 +161,20 @@ def pytest_report_header(config):
|
|
||||||
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
|
|
||||||
+ # Show the astropy-helpers version, if appropriate. We only show this if
|
|
||||||
+ # the _ASTROPY_SETUP_ variable is set since this indicates an old-style
|
|
||||||
+ # setup.py that is usually associated with astropy-helpers
|
|
||||||
+ if getattr(builtins, '_ASTROPY_SETUP_', False):
|
|
||||||
+ 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)
|
|
||||||
+ if astropy_helpers_version:
|
|
||||||
+ s += "astropy-helpers: {astropy_helpers_version}\n".format(astropy_helpers_version=astropy_helpers_version)
|
|
||||||
|
|
||||||
s += "\n"
|
|
||||||
|
|
||||||
diff --git a/tests/test_display.py b/tests/test_display.py
|
|
||||||
index 0525a35..14fc2f5 100644
|
|
||||||
--- a/tests/test_display.py
|
|
||||||
+++ b/tests/test_display.py
|
|
||||||
@@ -1,7 +1,14 @@
|
|
||||||
+import sys
|
|
||||||
import pytest
|
|
||||||
|
|
||||||
import numpy
|
|
||||||
|
|
||||||
+if sys.version_info[0] >= 3:
|
|
||||||
+ import builtins
|
|
||||||
+else:
|
|
||||||
+ import __builtin__ as builtins
|
|
||||||
+
|
|
||||||
+
|
|
||||||
NUMPY_VERSION = numpy.__version__
|
|
||||||
|
|
||||||
pytest_plugins = ['pytester']
|
|
||||||
@@ -42,7 +49,24 @@ def test_enabled(testdir, capsys, method):
|
|
||||||
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) == 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: ')
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+def test_astropy_helpers(testdir, capsys):
|
|
||||||
+ try:
|
|
||||||
+ builtins._ASTROPY_SETUP_ = True
|
|
||||||
+ testdir.inline_run("--astropy-header")
|
|
||||||
+ finally:
|
|
||||||
+ del builtins._ASTROPY_SETUP_
|
|
||||||
out, err = capsys.readouterr()
|
|
||||||
lines = extract_package_version_lines(out)
|
|
||||||
assert len(lines) == 6
|
|
||||||
@@ -100,9 +124,8 @@ def pytest_configure(config):
|
|
||||||
testdir.inline_run()
|
|
||||||
out, err = capsys.readouterr()
|
|
||||||
lines = extract_package_version_lines(out)
|
|
||||||
- assert len(lines) == 2
|
|
||||||
+ assert len(lines) == 1
|
|
||||||
assert lines[0] == 'numpy: {NUMPY_VERSION}'.format(NUMPY_VERSION=NUMPY_VERSION)
|
|
||||||
- assert lines[1].startswith('astropy-helpers: ')
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('method', ['cli', 'ini', 'ini_list', 'conftest'])
|
|
||||||
@@ -135,10 +158,9 @@ def pytest_configure(config):
|
|
||||||
out, err = capsys.readouterr()
|
|
||||||
print(out)
|
|
||||||
lines = extract_package_version_lines(out)
|
|
||||||
- assert len(lines) == 3
|
|
||||||
+ assert len(lines) == 2
|
|
||||||
assert lines[0] == 'numpy: {NUMPY_VERSION}'.format(NUMPY_VERSION=NUMPY_VERSION)
|
|
||||||
assert lines[1].startswith('pandas')
|
|
||||||
- assert lines[2].startswith('astropy-helpers: ')
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('method', ['cli', 'ini', 'ini_list', 'conftest'])
|
|
||||||
@@ -169,9 +191,8 @@ def pytest_configure(config):
|
|
||||||
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 +209,10 @@ def pytest_configure(config):
|
|
||||||
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
|
|
||||||
@@ -1,53 +0,0 @@
|
|||||||
From 7f282c28f68fe152e6364a4ebb11d59d126b7d82 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Pey Lian Lim <2090236+pllim@users.noreply.github.com>
|
|
||||||
Date: Thu, 12 Nov 2020 16:55:01 -0500
|
|
||||||
Subject: [PATCH] TST: No more helpers
|
|
||||||
|
|
||||||
---
|
|
||||||
tests/test_display.py | 14 +++-----------
|
|
||||||
1 file changed, 3 insertions(+), 11 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/tests/test_display.py b/tests/test_display.py
|
|
||||||
index 14fc2f5..32d9828 100644
|
|
||||||
--- a/tests/test_display.py
|
|
||||||
+++ b/tests/test_display.py
|
|
||||||
@@ -1,14 +1,8 @@
|
|
||||||
-import sys
|
|
||||||
-import pytest
|
|
||||||
+import builtins
|
|
||||||
|
|
||||||
+import pytest
|
|
||||||
import numpy
|
|
||||||
|
|
||||||
-if sys.version_info[0] >= 3:
|
|
||||||
- import builtins
|
|
||||||
-else:
|
|
||||||
- import __builtin__ as builtins
|
|
||||||
-
|
|
||||||
-
|
|
||||||
NUMPY_VERSION = numpy.__version__
|
|
||||||
|
|
||||||
pytest_plugins = ['pytester']
|
|
||||||
@@ -60,7 +54,6 @@ def pytest_configure(config):
|
|
||||||
assert lines[4].startswith('Pandas: ')
|
|
||||||
|
|
||||||
|
|
||||||
-
|
|
||||||
def test_astropy_helpers(testdir, capsys):
|
|
||||||
try:
|
|
||||||
builtins._ASTROPY_SETUP_ = True
|
|
||||||
@@ -69,13 +62,12 @@ def test_astropy_helpers(testdir, capsys):
|
|
||||||
del builtins._ASTROPY_SETUP_
|
|
||||||
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'])
|
|
||||||
@@ -1,3 +1,19 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Tue Dec 28 17:37:12 UTC 2021 - Ben Greiner <code@bnavigator.de>
|
||||||
|
|
||||||
|
- 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
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Wed Dec 9 09:49:05 UTC 2020 - Benjamin Greiner <code@bnavigator.de>
|
Wed Dec 9 09:49:05 UTC 2020 - Benjamin Greiner <code@bnavigator.de>
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
# All modifications and additions to the file contributed by third parties
|
||||||
# remain the property of their copyright owners, unless otherwise agreed
|
# 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}
|
%global flavor @BUILD_FLAVOR@%{nil}
|
||||||
%if "%{flavor}" == "test"
|
%if "%{flavor}" == "test"
|
||||||
%define psuffix -test
|
%define psuffix -test
|
||||||
# current astropy in TW requires python >= 3.7
|
|
||||||
%define skip_python36 1
|
|
||||||
%bcond_without test
|
%bcond_without test
|
||||||
%else
|
%else
|
||||||
%define psuffix %{nil}
|
%define psuffix %{nil}
|
||||||
%bcond_with test
|
%bcond_with test
|
||||||
%endif
|
%endif
|
||||||
|
%define modname pytest-astropy-header
|
||||||
|
%{?!python_module:%define python_module() python3-%{**}}
|
||||||
|
%define skip_python2 1
|
||||||
|
%define skip_python36 1
|
||||||
Name: python-%{modname}%{psuffix}
|
Name: python-%{modname}%{psuffix}
|
||||||
Version: 0.1.2
|
Version: 0.2.0
|
||||||
Release: 0
|
Release: 0
|
||||||
Summary: Pytest plugin to add diagnostic information to the header of the test output
|
Summary: Pytest plugin to add diagnostic information to the header of the test output
|
||||||
License: BSD-3-Clause
|
License: BSD-3-Clause
|
||||||
Group: Productivity/Scientific/Astronomy
|
Group: Productivity/Scientific/Astronomy
|
||||||
URL: https://github.com/astropy/pytest-astropy-header
|
URL: https://github.com/astropy/pytest-astropy-header
|
||||||
Source: https://files.pythonhosted.org/packages/source/p/%{modname}/%{modname}-%{version}.tar.gz
|
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
|
BuildRequires: %{python_module base >= 3.7}
|
||||||
Patch1: https://github.com/astropy/pytest-astropy-header/pull/29.patch#/pytest-astropy-header-pr29-nohelpers.patch
|
|
||||||
BuildRequires: %{python_module setuptools >= 30.3.0}
|
BuildRequires: %{python_module setuptools >= 30.3.0}
|
||||||
|
BuildRequires: %{python_module setuptools_scm}
|
||||||
BuildRequires: fdupes
|
BuildRequires: fdupes
|
||||||
BuildRequires: python-rpm-macros
|
BuildRequires: python-rpm-macros
|
||||||
Requires: python-pytest >= 2.8
|
Requires: python-pytest >= 4.6
|
||||||
%if %{with test}
|
%if %{with test}
|
||||||
# Patch0 and Patch1: helpers got removed in astropy 4
|
|
||||||
BuildRequires: %{python_module astropy >= 4.0}
|
BuildRequires: %{python_module astropy >= 4.0}
|
||||||
BuildRequires: %{python_module numpy}
|
BuildRequires: %{python_module numpy}
|
||||||
BuildRequires: %{python_module pytest >= 2.8}
|
BuildRequires: %{python_module pytest >= 4.6}
|
||||||
%endif
|
%endif
|
||||||
%python_subpackages
|
%python_subpackages
|
||||||
|
|
||||||
@@ -81,7 +79,7 @@ export PYTHONPATH=$(pwd)
|
|||||||
%doc CHANGES.rst README.rst
|
%doc CHANGES.rst README.rst
|
||||||
%license LICENSE.rst
|
%license LICENSE.rst
|
||||||
%{python_sitelib}/pytest_astropy_header
|
%{python_sitelib}/pytest_astropy_header
|
||||||
%{python_sitelib}/pytest_astropy_header-%{version}-py*.egg-info
|
%{python_sitelib}/pytest_astropy_header-%{version}*-info
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
|||||||
Reference in New Issue
Block a user