From fc26ff268896fa8e66902cf53f979496851758dd Mon Sep 17 00:00:00 2001 From: Charalampos Stratakis Date: Fri, 10 Dec 2021 18:23:54 +0100 Subject: [PATCH] Use pytest instead of the deprecated nose test runner --- python-yara.spec | 33 +++------------------------------ 1 file changed, 3 insertions(+), 30 deletions(-) diff --git a/python-yara.spec b/python-yara.spec index 81ecedd..72116ed 100644 --- a/python-yara.spec +++ b/python-yara.spec @@ -60,7 +60,7 @@ BuildRequires: yara-devel >= %{version} BuildRequires: /usr/bin/sphinx-build BuildRequires: python%{python3_pkgversion}-devel -BuildRequires: python%{python3_pkgversion}-nose +BuildRequires: python%{python3_pkgversion}-pytest BuildRequires: python%{python3_pkgversion}-setuptools @@ -132,40 +132,13 @@ Summary: Python2 binding for the YARA pattern matching tool %check %if 0%{?with_check} # ============================================================================== -# Tests for python3 used to always fail on testModuleData testcase -# Tests for python3 used to randomly fail on testCompare testcase -# reported to upstream - https://github.com/VirusTotal/yara-python/issues/21 -# temporarily run the failing tests but ignore the results for those 2 -# EXCLUDE='--exclude=^testCompare$|^testModuleData$' -# seems to be fixed in 3.9.0 -EXCLUDE='--exclude=^nothing$' - -# Yara is not prepared to run on s390 - more tests failing on s390 -# http://s390.koji.fedoraproject.org/kojifiles/work/tasks/9135/2399135/build.log -# https://github.com/VirusTotal/yara-python/issues/25 -# 3.6.3 - testCompileFile started failing - https://kojipkgs.fedoraproject.org//work/tasks/9619/20589619/build.log -# https://github.com/VirusTotal/yara-python/issues/54 -# seems to be fixed in 3.9.0 -%ifarch s390 s390x %{power64} -# EXCLUDE='--exclude=^testCompare$|^testModuleData$|^testEntrypoint$|^testIn$|^testIntegerFunctions$|^testCompileFile$' -EXCLUDE='--exclude=^nothing$' -%endif # 3.9.0 - testModuleData is always failing for architecture armv7hl %ifarch armv7hl -EXCLUDE='--exclude=^testModuleData$' +EXCLUDE='not testModuleData' %endif - -# Find the NOSETEST binary or use false if not present -NOSETESTS3=`ls /usr/bin/nosetests-3.* || which false ` -PYTHONPATH=%{buildroot}/%{python3_sitearch}/ "$NOSETESTS3" -v "$EXCLUDE" - -# Run potentially ignored tests separately so we can at least see the results -PYTHONPATH=%{buildroot}/%{python3_sitearch}/ "$NOSETESTS3" -v ./tests.py:TestYara.testCompare \ - ./tests.py:TestYara.testModuleData ./tests.py:TestYara.testEntrypoint \ - ./tests.py:TestYara.testIn ./tests.py:TestYara.testIntegerFunctions \ - ./tests.py:TestYara.testCompileFile || true +%pytest -k "$EXCLUDE" tests.py -v # with_check %endif