Hello community,

here is the log from the commit of package python-pytest-astropy-header for 
openSUSE:Factory checked in at 2020-12-09 22:22:04
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-pytest-astropy-header (Old)
 and      /work/SRC/openSUSE:Factory/.python-pytest-astropy-header.new.2328 
(New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-pytest-astropy-header"

Wed Dec  9 22:22:04 2020 rev:5 rq:854214 version:0.1.2

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/python-pytest-astropy-header/python-pytest-astropy-header.changes
        2020-08-17 12:08:39.854804066 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-pytest-astropy-header.new.2328/python-pytest-astropy-header.changes
      2020-12-09 22:22:05.655716327 +0100
@@ -1,0 +2,10 @@
+Wed Dec  9 09:49:05 UTC 2020 - Benjamin Greiner <c...@bnavigator.de>
+
+- Fix test failures
+  * requires astropy >= 4 which removed astropy-helpers 
+  * gh#/astropy/pytest-astropy-header#16
+    pytest-astropy-header-pr16-no-helper-version.patch
+  * gh#/astropy/pytest-astropy-header#29
+    pytest-astropy-header-pr29-nohelpers.patch
+
+-------------------------------------------------------------------

New:
----
  pytest-astropy-header-pr16-no-helper-version.patch
  pytest-astropy-header-pr29-nohelpers.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-pytest-astropy-header.spec ++++++
--- /var/tmp/diff_new_pack.Bjtkq3/_old  2020-12-09 22:22:06.243716924 +0100
+++ /var/tmp/diff_new_pack.Bjtkq3/_new  2020-12-09 22:22:06.247716928 +0100
@@ -22,6 +22,8 @@
 %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}
@@ -35,12 +37,15 @@
 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 setuptools >= 30.3.0}
 BuildRequires:  fdupes
 BuildRequires:  python-rpm-macros
 Requires:       python-pytest >= 2.8
 %if %{with test}
-BuildRequires:  %{python_module astropy >= 3.0}
+# 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}
 %endif
@@ -53,7 +58,7 @@
 Astropy project, but is optimized for use with astropy-related projects.
 
 %prep
-%setup -q -n %{modname}-%{version}
+%autosetup -p1 -n %{modname}-%{version}
 
 %build
 %python_build

++++++ pytest-astropy-header-pr16-no-helper-version.patch ++++++
From 0d5d2768ba7727977eaa9c750c067c60fa667631 Mon Sep 17 00:00:00 2001
From: Thomas Robitaille <thomas.robitai...@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
++++++ pytest-astropy-header-pr29-nohelpers.patch ++++++
From 7f282c28f68fe152e6364a4ebb11d59d126b7d82 Mon Sep 17 00:00:00 2001
From: Pey Lian Lim <2090236+pl...@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'])
_______________________________________________
openSUSE Commits mailing list -- commit@lists.opensuse.org
To unsubscribe, email commit-le...@lists.opensuse.org
List Netiquette: https://en.opensuse.org/openSUSE:Mailing_list_netiquette
List Archives: 
https://lists.opensuse.org/archives/list/commit@lists.opensuse.org

Reply via email to