Hello community,
here is the log from the commit of package python-pytest-remotedata for
openSUSE:Factory checked in at 2019-02-25 17:51:31
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-pytest-remotedata (Old)
and /work/SRC/openSUSE:Factory/.python-pytest-remotedata.new.28833 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pytest-remotedata"
Mon Feb 25 17:51:31 2019 rev:2 rq:676357 version:0.3.1
Changes:
--------
---
/work/SRC/openSUSE:Factory/python-pytest-remotedata/python-pytest-remotedata.changes
2018-08-18 00:03:10.838910052 +0200
+++
/work/SRC/openSUSE:Factory/.python-pytest-remotedata.new.28833/python-pytest-remotedata.changes
2019-02-25 17:51:32.630747027 +0100
@@ -1,0 +2,9 @@
+Fri Feb 15 09:20:39 UTC 2019 - Tomáš Chvátal <[email protected]>
+
+- Update to 0.3.1:
+ * Fix warnings that occur with pytest-3.7 and later. [#34]
+- Enable tests
+- Add patch from upstream to build with pytest-4.2+:
+ * pytest42.patch
+
+-------------------------------------------------------------------
Old:
----
pytest-remotedata-0.3.0.tar.gz
New:
----
pytest-remotedata-0.3.1.tar.gz
pytest42.patch
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-pytest-remotedata.spec ++++++
--- /var/tmp/diff_new_pack.ogYm5x/_old 2019-02-25 17:51:34.998745738 +0100
+++ /var/tmp/diff_new_pack.ogYm5x/_new 2019-02-25 17:51:35.002745736 +0100
@@ -1,7 +1,7 @@
#
# spec file for package python-pytest-remotedata
#
-# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -12,20 +12,23 @@
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
+#
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-pytest-remotedata
-Version: 0.3.0
+Version: 0.3.1
Release: 0
-License: BSD-3-Clause
Summary: Pytest plugin for controlling remote data access
-Url: https://github.com/astropy/pytest-remotedata
+License: BSD-3-Clause
Group: Development/Languages/Python
+Url: https://github.com/astropy/pytest-remotedata
Source:
https://files.pythonhosted.org/packages/source/p/pytest-remotedata/pytest-remotedata-%{version}.tar.gz
-BuildRequires: %{python_module devel}
+Patch0: pytest42.patch
+BuildRequires: %{python_module pytest >= 3.1}
BuildRequires: %{python_module setuptools}
+BuildRequires: %{python_module six}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-pytest >= 3.1
@@ -40,6 +43,7 @@
%prep
%setup -q -n pytest-remotedata-%{version}
+%patch0 -p1
%build
%python_build
@@ -48,6 +52,10 @@
%python_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
+%check
+# test_internet_access (test_default_behavior, test_strict_with_decorator) -
needs network
+%python_expand PYTHONPATH=%{buildroot}%{$python_sitelib}
py.test-%{$python_bin_suffix} -v -k 'not (test_default_behavior or
test_strict_with_decorator)'
+
%files %{python_files}
%doc CHANGES.rst README.rst
%license LICENSE.rst
++++++ pytest-remotedata-0.3.0.tar.gz -> pytest-remotedata-0.3.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-remotedata-0.3.0/CHANGES.rst
new/pytest-remotedata-0.3.1/CHANGES.rst
--- old/pytest-remotedata-0.3.0/CHANGES.rst 2018-05-29 22:28:36.000000000
+0200
+++ new/pytest-remotedata-0.3.1/CHANGES.rst 2018-10-23 22:37:34.000000000
+0200
@@ -1,3 +1,8 @@
+0.3.1 (2018-10-23)
+==================
+
+- Fix warnings that occur with ``pytest-3.7`` and later. [#34]
+
0.3.0 (2018-05-29)
==================
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-remotedata-0.3.0/MANIFEST.in
new/pytest-remotedata-0.3.1/MANIFEST.in
--- old/pytest-remotedata-0.3.0/MANIFEST.in 2018-04-20 19:43:12.000000000
+0200
+++ new/pytest-remotedata-0.3.1/MANIFEST.in 2018-09-21 16:09:51.000000000
+0200
@@ -4,4 +4,6 @@
include setup.cfg
+recursive-include tests *
+
global-exclude *.pyc *.o
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-remotedata-0.3.0/PKG-INFO
new/pytest-remotedata-0.3.1/PKG-INFO
--- old/pytest-remotedata-0.3.0/PKG-INFO 2018-05-29 22:28:52.000000000
+0200
+++ new/pytest-remotedata-0.3.1/PKG-INFO 2018-10-23 22:41:56.000000000
+0200
@@ -1,6 +1,6 @@
Metadata-Version: 1.2
Name: pytest-remotedata
-Version: 0.3.0
+Version: 0.3.1
Summary: Pytest plugin for controlling remote data access.
Home-page: https://astropy.org
Author: The Astropy Developers
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-remotedata-0.3.0/pytest_remotedata/plugin.py
new/pytest-remotedata-0.3.1/pytest_remotedata/plugin.py
--- old/pytest-remotedata-0.3.0/pytest_remotedata/plugin.py 2018-05-29
22:28:36.000000000 +0200
+++ new/pytest-remotedata-0.3.1/pytest_remotedata/plugin.py 2018-10-23
22:35:40.000000000 +0200
@@ -5,6 +5,7 @@
"""
import pytest
from .disable_internet import turn_off_internet, turn_on_internet
+from distutils.version import StrictVersion
def pytest_addoption(parser):
@@ -61,8 +62,12 @@
def pytest_runtest_setup(item):
- remote_data = item.get_marker('remote_data')
- internet_off = item.get_marker('internet_off')
+ if StrictVersion(pytest.__version__) < StrictVersion("3.6"):
+ remote_data = item.get_marker('remote_data')
+ internet_off = item.get_marker('internet_off')
+ else:
+ remote_data = item.get_closest_marker('remote_data')
+ internet_off = item.get_closest_marker('internet_off')
remote_data_config = item.config.getvalue("remote_data")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/pytest-remotedata-0.3.0/pytest_remotedata.egg-info/PKG-INFO
new/pytest-remotedata-0.3.1/pytest_remotedata.egg-info/PKG-INFO
--- old/pytest-remotedata-0.3.0/pytest_remotedata.egg-info/PKG-INFO
2018-05-29 22:28:52.000000000 +0200
+++ new/pytest-remotedata-0.3.1/pytest_remotedata.egg-info/PKG-INFO
2018-10-23 22:41:56.000000000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 1.2
Name: pytest-remotedata
-Version: 0.3.0
+Version: 0.3.1
Summary: Pytest plugin for controlling remote data access.
Home-page: https://astropy.org
Author: The Astropy Developers
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/pytest-remotedata-0.3.0/pytest_remotedata.egg-info/SOURCES.txt
new/pytest-remotedata-0.3.1/pytest_remotedata.egg-info/SOURCES.txt
--- old/pytest-remotedata-0.3.0/pytest_remotedata.egg-info/SOURCES.txt
2018-05-29 22:28:52.000000000 +0200
+++ new/pytest-remotedata-0.3.1/pytest_remotedata.egg-info/SOURCES.txt
2018-10-23 22:41:56.000000000 +0200
@@ -13,4 +13,9 @@
pytest_remotedata.egg-info/entry_points.txt
pytest_remotedata.egg-info/not-zip-safe
pytest_remotedata.egg-info/requires.txt
-pytest_remotedata.egg-info/top_level.txt
\ No newline at end of file
+pytest_remotedata.egg-info/top_level.txt
+tests/__init__.py
+tests/conftest.py
+tests/test_skip_remote_data.py
+tests/test_socketblocker.py
+tests/test_strict_check.py
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-remotedata-0.3.0/setup.cfg
new/pytest-remotedata-0.3.1/setup.cfg
--- old/pytest-remotedata-0.3.0/setup.cfg 2018-05-29 22:28:52.000000000
+0200
+++ new/pytest-remotedata-0.3.1/setup.cfg 2018-10-23 22:41:56.000000000
+0200
@@ -1,4 +1,4 @@
-[pytest]
+[tool:pytest]
minversion = 3.1
testpaths = tests
remote_data_strict = true
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-remotedata-0.3.0/setup.py
new/pytest-remotedata-0.3.1/setup.py
--- old/pytest-remotedata-0.3.0/setup.py 2018-05-29 22:28:36.000000000
+0200
+++ new/pytest-remotedata-0.3.1/setup.py 2018-10-23 22:38:04.000000000
+0200
@@ -19,7 +19,7 @@
setup(
name='pytest-remotedata',
- version='0.3.0',
+ version='0.3.1',
license='BSD',
description='Pytest plugin for controlling remote data access.',
long_description=readme(),
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-remotedata-0.3.0/tests/__init__.py
new/pytest-remotedata-0.3.1/tests/__init__.py
--- old/pytest-remotedata-0.3.0/tests/__init__.py 1970-01-01
01:00:00.000000000 +0100
+++ new/pytest-remotedata-0.3.1/tests/__init__.py 2017-09-25
17:17:16.000000000 +0200
@@ -0,0 +1,2 @@
+from __future__ import (absolute_import, division, print_function,
+ unicode_literals)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-remotedata-0.3.0/tests/conftest.py
new/pytest-remotedata-0.3.1/tests/conftest.py
--- old/pytest-remotedata-0.3.0/tests/conftest.py 1970-01-01
01:00:00.000000000 +0100
+++ new/pytest-remotedata-0.3.1/tests/conftest.py 2017-11-10
16:16:23.000000000 +0100
@@ -0,0 +1,2 @@
+# This enables the meta-testing of this plugin via the testdir fixture
+pytest_plugins = ['pytester']
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/pytest-remotedata-0.3.0/tests/test_skip_remote_data.py
new/pytest-remotedata-0.3.1/tests/test_skip_remote_data.py
--- old/pytest-remotedata-0.3.0/tests/test_skip_remote_data.py 1970-01-01
01:00:00.000000000 +0100
+++ new/pytest-remotedata-0.3.1/tests/test_skip_remote_data.py 2018-05-29
21:27:36.000000000 +0200
@@ -0,0 +1,115 @@
+# Licensed under a 3-clause BSD style license - see LICENSE.rst
+# this test doesn't actually use any online data, it should just be skipped
+# by run_tests because it has the remote_data decorator.
+
+import pytest
+from contextlib import closing
+
+import six
+from six.moves.urllib.request import urlopen
+
+
+ASTROPY_DATA_URL = "http://data.astropy.org/"
+GITHUB_DATA_URL = "http://astropy.github.io/"
+EXTERNAL_URL = "http://www.google.com"
+TIMEOUT = 10
+
+if six.PY2:
+ _EXPECTED_ERROR = IOError
+else:
+ from six.moves.urllib.error import URLError
+ _EXPECTED_ERROR = URLError
+
+
+def download_file(remote_url):
+ with closing(urlopen(remote_url, timeout=TIMEOUT)) as remote:
+ remote.read()
+
+
[email protected]_data
+def test_skip_remote_data(pytestconfig):
+
+ # astropy.test() has remote_data=none or remote_data=astropy but we still
+ # got here somehow, so fail with a helpful message
+
+ if pytestconfig.getoption('remote_data') == 'none':
+ pytest.fail('@remote_data was not skipped with remote_data=none')
+ elif pytestconfig.getoption('remote_data') == 'astropy':
+ pytest.fail('@remote_data was not skipped with remote_data=astropy')
+ elif pytestconfig.getoption('remote_data') == 'github':
+ pytest.fail('@remote_data was not skipped with remote_data=github')
+
+ # Test Astropy URL
+ download_file(ASTROPY_DATA_URL + 'galactic_center/gc_2mass_k.fits')
+
+ # Test GitHub URL
+ download_file(GITHUB_DATA_URL)
+
+ # Test unrelated URL
+ download_file(EXTERNAL_URL)
+
+
[email protected]_data(source='astropy')
+def test_skip_remote_data_astropy(pytestconfig):
+
+ # astropy.test() has remote_data=none but we still got here somehow,
+ # so fail with a helpful message
+
+ if pytestconfig.getoption('remote_data') in ('none', 'github'):
+ pytest.fail('@remote_data was not skipped with remote_data=none'
+ 'or remote_data=github')
+
+ # Test Astropy URL
+ download_file(ASTROPY_DATA_URL + 'galactic_center/gc_2mass_k.fits')
+
+ # Test non-Astropy URL
+ if pytestconfig.getoption('remote_data') == 'astropy':
+ with pytest.raises(Exception) as exc:
+ download_file(EXTERNAL_URL)
+ assert "An attempt was made to connect to the internet" in
str(exc.value) # noqa
+ else: # remote_data=any
+ download_file(EXTERNAL_URL)
+
+
[email protected]_data(source='github')
+def test_skip_remote_data_github(pytestconfig):
+ if pytestconfig.getoption('remote_data') == 'none':
+ pytest.fail('@remote_data was not skipped with remote_data=none')
+
+ # Test GitHub URL
+ download_file(GITHUB_DATA_URL)
+
+ # Test non-GitHub URL
+ if pytestconfig.getoption('remote_data') == 'github':
+ with pytest.raises(Exception) as exc:
+ download_file(ASTROPY_DATA_URL)
+ assert "An attempt was made to connect to the internet" in
str(exc.value)
+ else: # remote_data=any or remote_data=astropy
+ download_file(ASTROPY_DATA_URL)
+
+
[email protected]_off
+def test_internet_off_decorator(pytestconfig):
+ # This test should only run when internet access has been disabled
+ if pytestconfig.getoption('remote_data') != 'none':
+ pytest.fail('@internet_off test ran when remote_data!=none')
+
+
+def test_block_internet_connection(pytestconfig):
+ if pytestconfig.getoption('remote_data') == 'none':
+ with pytest.raises(_EXPECTED_ERROR):
+ download_file(EXTERNAL_URL)
+ elif pytestconfig.getoption('remote_data') == 'astropy':
+ with pytest.raises(_EXPECTED_ERROR):
+ download_file(EXTERNAL_URL)
+ elif pytestconfig.getoption('remote_data') == 'github':
+ with pytest.raises(_EXPECTED_ERROR):
+ download_file(EXTERNAL_URL)
+ else:
+ download_file(EXTERNAL_URL)
+
+
[email protected]_off
+def test_block_internet_connection_internet_off():
+ with pytest.raises(_EXPECTED_ERROR):
+ download_file(EXTERNAL_URL)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-remotedata-0.3.0/tests/test_socketblocker.py
new/pytest-remotedata-0.3.1/tests/test_socketblocker.py
--- old/pytest-remotedata-0.3.0/tests/test_socketblocker.py 1970-01-01
01:00:00.000000000 +0100
+++ new/pytest-remotedata-0.3.1/tests/test_socketblocker.py 2017-11-10
14:30:22.000000000 +0100
@@ -0,0 +1,86 @@
+# Licensed under a 3-clause BSD style license - see LICENSE.rst
+import sys
+import time
+
+from threading import Thread
+
+from six.moves import BaseHTTPServer, SimpleHTTPServer
+from six.moves.urllib.request import urlopen
+
+import pytest
+
+from pytest_remotedata.disable_internet import no_internet
+
+
+def test_outgoing_fails():
+ with pytest.raises(IOError):
+ with no_internet():
+ urlopen('http://www.python.org')
+
+
+class StoppableHTTPServer(BaseHTTPServer.HTTPServer, object):
+ def __init__(self, *args):
+ super(StoppableHTTPServer, self).__init__(*args)
+ self.stop = False
+
+ def handle_request(self):
+ self.stop = True
+ super(StoppableHTTPServer, self).handle_request()
+
+ def serve_forever(self):
+ """
+ Serve until stop set, which will happen if any request is handled
+ """
+ while not self.stop:
+ self.handle_request()
+
+
[email protected](('localhost'), ('localhost', '127.0.0.1'))
+def test_localconnect_succeeds(localhost):
+ """
+ Ensure that connections to localhost are allowed, since these are genuinely
+ not remotedata.
+ """
+
+ # port "0" means find open port
+ # see
http://stackoverflow.com/questions/1365265/on-localhost-how-to-pick-a-free-port-number
+ httpd = StoppableHTTPServer(('localhost', 0),
+ SimpleHTTPServer.SimpleHTTPRequestHandler)
+
+ port = httpd.socket.getsockname()[1]
+
+ server = Thread(target=httpd.serve_forever)
+ server.setDaemon(True)
+
+ server.start()
+ time.sleep(0.1)
+
+ urlopen('http://{localhost:s}:{port:d}'.format(localhost=localhost,
port=port)).close()
+
+
+PY3_4 = sys.version_info[:2] >= (3, 4)
+
+
+# Used for the below test--inline functions aren't pickleable
+# by multiprocessing?
+def _square(x):
+ return x ** 2
+
+
[email protected]('not PY3_4 or sys.platform == "win32" or
sys.platform.startswith("gnu0")')
+def test_multiprocessing_forkserver():
+ """
+ Test that using multiprocessing with forkserver works. Perhaps
+ a simpler more direct test would be to just open some local
+ sockets and pass something through them.
+
+ Regression test for https://github.com/astropy/astropy/pull/3713
+ """
+
+ import multiprocessing
+ ctx = multiprocessing.get_context('forkserver')
+ pool = ctx.Pool(1)
+ result = pool.map(_square, [1, 2, 3, 4, 5])
+ pool.close()
+ pool.join()
+ assert result == [1, 4, 9, 16, 25]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-remotedata-0.3.0/tests/test_strict_check.py
new/pytest-remotedata-0.3.1/tests/test_strict_check.py
--- old/pytest-remotedata-0.3.0/tests/test_strict_check.py 1970-01-01
01:00:00.000000000 +0100
+++ new/pytest-remotedata-0.3.1/tests/test_strict_check.py 2017-11-10
16:16:23.000000000 +0100
@@ -0,0 +1,65 @@
+# Licensed under a 3-clause BSD style license - see LICENSE.rst
+
+import os
+import pytest
+
+PYFILE_CONTENTS = """
+ import pytest
+ from six.moves.urllib.request import urlopen
+
+ def test_config_setting(pytestconfig):
+ assert pytestconfig.getini('remote_data_strict') == {}
+
+ {}
+ def test_internet_access():
+ urlopen('http://astropy.org')
+ """
+
+def _write_config_file(testdir, entry):
+ config = testdir.tmpdir.join('setup.cfg')
+ config.write("""
+[pytest]
+{}
+ """.format(entry))
+
+ # Just a sanity check to make sure we actually write the config file
+ assert os.path.exists(str(testdir.tmpdir.join('setup.cfg')))
+
+
+def test_local_config(pytestconfig):
+ assert pytestconfig.getini('remote_data_strict') == True
+
+
+def test_default_behavior(testdir):
+ _write_config_file(testdir, '')
+
+ testdir.makepyfile(PYFILE_CONTENTS.format('False', ''))
+
+ result = testdir.runpytest_subprocess()
+ result.assert_outcomes(passed=2)
+
+
+def test_strict_behavior(testdir):
+ _write_config_file(testdir, 'remote_data_strict = true')
+
+ testdir.makepyfile(PYFILE_CONTENTS.format('True', ''))
+
+ result = testdir.runpytest_subprocess()
+ result.assert_outcomes(passed=1, failed=1)
+
+
[email protected]('source', ['none', 'any'])
+def test_strict_with_decorator(testdir, source):
+ _write_config_file(testdir, 'remote_data_strict = true')
+
+ decorator = '@pytest.mark.remote_data'
+ testdir.makepyfile(PYFILE_CONTENTS.format('True', decorator))
+
+ clarg = '--remote-data=' + source
+ result = testdir.runpytest_subprocess(clarg)
+
+ if source == 'none':
+ outcomes = dict(passed=1, skipped=1)
+ else:
+ outcomes = dict(passed=2)
+ result.assert_outcomes(**outcomes)
++++++ pytest42.patch ++++++
>From b395fca12d392e433b19844d14d014a481ff52fe Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= <[email protected]>
Date: Fri, 15 Feb 2019 10:26:59 +0100
Subject: [PATCH] Use [tool:pytest] to fix build on pytest 4.2
[pytest] marking is deprecated and errors out on 4.2+ version.
---
tests/test_strict_check.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/test_strict_check.py b/tests/test_strict_check.py
index 79b6073..8527c25 100644
--- a/tests/test_strict_check.py
+++ b/tests/test_strict_check.py
@@ -18,7 +18,7 @@ def test_internet_access():
def _write_config_file(testdir, entry):
config = testdir.tmpdir.join('setup.cfg')
config.write("""
-[pytest]
+[tool:pytest]
{}
""".format(entry))