Ignore unwanted tests instead of removing the files

This commit is contained in:
Benjamin A. Beasley 2023-05-18 10:07:51 -04:00
parent 91662c8644
commit 0b52151511

View File

@ -102,24 +102,12 @@ Requires: python3-%{srcname}+socks = %{version}-%{release}
recent_date=$(date --date "7 month ago" +"%Y, %_m, %_d") recent_date=$(date --date "7 month ago" +"%Y, %_m, %_d")
sed -i "s/^RECENT_DATE = datetime.date(.*)/RECENT_DATE = datetime.date($recent_date)/" src/urllib3/connection.py sed -i "s/^RECENT_DATE = datetime.date(.*)/RECENT_DATE = datetime.date($recent_date)/" src/urllib3/connection.py
# Drop the dummyserver tests in koji. They fail there in real builds, but not
# in scratch builds (weird).
rm -rf test/with_dummyserver/
# Don't run the Google App Engine tests
rm -rf test/appengine/
# Lots of these tests started failing, even for old versions, so it has something
# to do with Fedora in particular. They don't fail in upstream build infrastructure
rm -rf test/contrib/
# Tests for Python built without SSL, but Fedora builds with SSL. These tests
# fail when combined with the unbundling of backports-ssl_match_hostname
rm -f test/test_no_ssl.py
# Use the standard library instead of a backport # Use the standard library instead of a backport
sed -i -e 's/^import mock/from unittest import mock/' \ sed -i -e 's/^import mock/from unittest import mock/' \
-e 's/^from mock import /from unittest.mock import /' \ -e 's/^from mock import /from unittest.mock import /' \
test/*.py docs/conf.py test/*.py docs/conf.py
%build %build
%py3_build %py3_build
@ -141,7 +129,18 @@ ln -s %{python3_sitelib}/__pycache__/six.cpython-%{python3_version_nodots}.pyc \
%if %{with tests} %if %{with tests}
%check %check
%pytest -v # Drop the dummyserver tests in koji. They fail there in real builds, but not
# in scratch builds (weird).
ignore="${ignore-} --ignore=test/with_dummyserver/"
# Don't run the Google App Engine tests
ignore="${ignore-} --ignore=test/appengine/"
# Lots of these tests started failing, even for old versions, so it has something
# to do with Fedora in particular. They don't fail in upstream build infrastructure
ignore="${ignore-} --ignore=test/contrib/"
# Tests for Python built without SSL, but Fedora builds with SSL. These tests
# fail when combined with the unbundling of backports-ssl_match_hostname
ignore="${ignore-} --ignore=test/test_no_ssl.py"
%pytest -v ${ignore-}
%endif %endif