No pytest-httpbin for Python 2

https://bugzilla.redhat.com/show_bug.cgi?id=1653223
This commit is contained in:
Miro Hrončok 2018-11-26 11:25:10 +01:00
parent ffc9beb883
commit 33bb8ea0e5
2 changed files with 41 additions and 2 deletions

View File

@ -10,7 +10,7 @@
Name: python-requests Name: python-requests
Version: 2.20.0 Version: 2.20.0
Release: 1%{?dist} Release: 2%{?dist}
Summary: HTTP library, written in Python, for human beings Summary: HTTP library, written in Python, for human beings
License: ASL 2.0 License: ASL 2.0
@ -33,6 +33,9 @@ Patch3: requests-2.12.4-tests_nonet.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1567862 # https://bugzilla.redhat.com/show_bug.cgi?id=1567862
Patch4: Don-t-inject-pyopenssl-into-urllib3.patch Patch4: Don-t-inject-pyopenssl-into-urllib3.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1653223
Patch5: requests-2.20.0-no-py2-httpbin.patch
BuildArch: noarch BuildArch: noarch
%description %description
@ -52,7 +55,6 @@ BuildRequires: python2-idna
%if %{with tests} %if %{with tests}
BuildRequires: python2-pytest BuildRequires: python2-pytest
BuildRequires: python2-pytest-cov BuildRequires: python2-pytest-cov
BuildRequires: python2-pytest-httpbin
BuildRequires: python2-pytest-mock BuildRequires: python2-pytest-mock
%endif %endif
@ -139,6 +141,9 @@ PYTHONPATH=%{buildroot}%{python3_sitelib} %{__python3} -m pytest -v
%changelog %changelog
* Mon Nov 26 2018 Miro Hrončok <mhroncok@redhat.com> - 2.20.0-2
- No pytest-httpbin for Python 2
* Mon Oct 29 2018 Jeremy Cline <jeremy@jcline.org> - 2.20.0-1 * Mon Oct 29 2018 Jeremy Cline <jeremy@jcline.org> - 2.20.0-1
- Update to v2.20.0 - Update to v2.20.0

View File

@ -0,0 +1,34 @@
diff --git a/tests/conftest.py b/tests/conftest.py
index cd64a76..1d5ddbb 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -14,11 +14,23 @@ def prepare_url(value):
return inner
-@pytest.fixture
-def httpbin(httpbin):
- return prepare_url(httpbin)
+import sys
+if sys.version_info[0] < 3:
+ @pytest.fixture
+ def httpbin():
+ pytest.skip('No httpbin for Python 2')
-@pytest.fixture
-def httpbin_secure(httpbin_secure):
- return prepare_url(httpbin_secure)
+ @pytest.fixture
+ def httpbin_secure():
+ pytest.skip('No httpbin for Python 2')
+
+else:
+ @pytest.fixture
+ def httpbin(httpbin):
+ return prepare_url(httpbin)
+
+
+ @pytest.fixture
+ def httpbin_secure(httpbin_secure):
+ return prepare_url(httpbin_secure)