diff --git a/conftest-skipper.py b/conftest-skipper.py new file mode 100644 index 0000000..5a1de83 --- /dev/null +++ b/conftest-skipper.py @@ -0,0 +1,22 @@ + +class Skipper: + """Skip iso8601 and pretend tests + + RHEL buildroot doesn't have python-iso8601 and python-pretend. Skip + all tests that use the excluded modules. + """ + + def parse_date(self, datestring): + pytest.skip(f"iso8601 module is not available.") + + def stub(self, **kwargs): + pytest.skip(f"pretend module is not available.") + + def raiser(self, exc): + pytest.skip(f"pretend module is not available.") + + +import sys + +sys.modules["iso8601"] = sys.modules["pretend"] = Skipper() + diff --git a/python-cryptography.spec b/python-cryptography.spec index 527d6ae..2c40030 100644 --- a/python-cryptography.spec +++ b/python-cryptography.spec @@ -7,7 +7,7 @@ Name: python-%{srcname} Version: 3.4.4 -Release: 2%{?dist} +Release: 3%{?dist} Summary: PyCA's cryptography library License: ASL 2.0 or BSD @@ -22,6 +22,7 @@ Source2: gpgkey-05FD_9FA1_6CF7_5735_0D91_A560_235A_E5F1_29F9_ED98.gpg %if 0%{?rhel} # created by ./vendor_rust.py helper script Source3: cryptography-%{version}-vendor.tar.bz2 +Source4: conftest-skipper.py %endif BuildRequires: openssl-devel @@ -43,10 +44,10 @@ BuildRequires: python%{python3_pkgversion}-six >= 1.4.1 BuildRequires: python%{python3_pkgversion}-cryptography-vectors = %{version} %if 0%{?fedora} BuildRequires: python%{python3_pkgversion}-hypothesis >= 1.11.4 -BuildRequires: python%{python3_pkgversion}-pytest-xdist -%endif BuildRequires: python%{python3_pkgversion}-iso8601 BuildRequires: python%{python3_pkgversion}-pretend +BuildRequires: python%{python3_pkgversion}-pytest-xdist +%endif BuildRequires: python%{python3_pkgversion}-pytest >= 6.0 BuildRequires: python%{python3_pkgversion}-pytest-subtests >= 0.3.2 BuildRequires: python%{python3_pkgversion}-pytz @@ -100,6 +101,8 @@ find . -name .keep -print -delete %if 0%{?rhel} # skip hypothesis tests on RHEL rm -rf tests/hypothesis +# append skipper to skip iso8601 and pretend tests +cat < %{SOURCE4} >> tests/conftest.py %endif # see https://github.com/pyca/cryptography/issues/4885 and @@ -114,6 +117,9 @@ PYTHONPATH=%{buildroot}%{python3_sitearch} %{__python3} -m pytest -k "not (test_ %{python3_sitearch}/%{srcname}-%{version}-py*.egg-info %changelog +* Fri Feb 12 2021 Christian Heimes - 3.4.4-3 +- Skip iso8601 and pretend tests on RHEL + * Fri Feb 12 2021 Christian Heimes - 3.4.4-2 - Provide RHEL build infrastructure