RFH: Unable to invoke the testsuite for python-antlr4-python3-runtime
Hi! I have updated the python-antlr4-python3-runtime package to the latest upstream version [1]. Unfortunately, the invocation of the testsuite somehow seems to fail with unittest complaining about not knowing the command line parameters provided by the RPM macro: [ 13s] + python_flavor=python39 [ 13s] + PYTHONPATH=/home/abuild/rpmbuild/BUILDROOT/python-antlr4-python3-runtime-4.13.1-10.1.x86_64/usr/lib/python3.9/site-packages [ 13s] + PYTHONDONTWRITEBYTECODE=1 [ 13s] + python3.9 -m unittest discover -v --pattern '*.py' --start-directory tests [ 13s] usage: python3.9 -m unittest [-h] [-v] [-q] [--locals] [-f] [-c] [-b] [ 13s] [-k TESTNAMEPATTERNS] [ 13s] [tests ...] [ 13s] python3.9 -m unittest: error: unrecognized arguments: --pattern *.py --start-directory tests [ 13s] testStream (TestFileStream.TestFileStream) ... ok [ 13s] testStream (TestInputStream.TestInputStream) ... ok [ 13s] testComplement (TestIntervalSet.TestIntervalSet) ... ok [ 13s] testContiguous1 (TestIntervalSet.TestIntervalSet) ... /home/abuild/rpmbuild/BUILD/antlr4-4.13.1/runtime/Python3/tests/TestIntervalSet.py:55: DeprecationWarning: Please use assertEqual instead. [ 13s] self.assertEquals(1,len(s.intervals)) [ 13s] ok [ 13s] testContiguous2 (TestIntervalSet.TestIntervalSet) ... ok [ 13s] testDistinct1 (TestIntervalSet.TestIntervalSet) ... ok [ 13s] testDistinct2 (TestIntervalSet.TestIntervalSet) ... ok [ 13s] testEmpty (TestIntervalSet.TestIntervalSet) ... ok [ 13s] testOne (TestIntervalSet.TestIntervalSet) ... ok [ 13s] testOverlapping1 (TestIntervalSet.TestIntervalSet) ... ok [ 13s] testOverlapping2 (TestIntervalSet.TestIntervalSet) ... ok [ 13s] testOverlapping3 (TestIntervalSet.TestIntervalSet) ... ok [ 13s] testRange (TestIntervalSet.TestIntervalSet) ... ok [ 13s] testTwo (TestIntervalSet.TestIntervalSet) ... ok [ 13s] testVersion (TestRecognizer.TestRecognizer) ... ok [ 13s] TestTokenStreamRewriter (unittest.loader._FailedTest) ... ERROR [ 13s] ctest (unittest.loader._FailedTest) ... ERROR [ 13s] mocks.TestLexer (unittest.loader._FailedTest) ... ERROR [ 13s] parser.clexer (unittest.loader._FailedTest) ... ERROR [ 13s] parser.cparser (unittest.loader._FailedTest) ... ERROR [ 13s] run (unittest.loader._FailedTest) ... ok [ 13s] testValidPaths (xpathtest.XPathTest) ... ok Does anyone have a suggestion how to fix this before I keep digging for too long? Thanks, Adrian
[1] https://build.opensuse.org/package/show/home:glaubitz:branches:devel:languag...
Hi, On mié, 2023-11-15 at 13:13 +0000, Adrian Glaubitz via openSUSE Factory wrote:
Hi!
I have updated the python-antlr4-python3-runtime package to the latest upstream version [1]. Unfortunately, the invocation of the testsuite somehow seems to fail with unittest complaining about not knowing the command line parameters provided by the RPM macro:
[ 13s] + python_flavor=python39 [ 13s] + PYTHONPATH=/home/abuild/rpmbuild/BUILDROOT/python-antlr4- python3-runtime-4.13.1-10.1.x86_64/usr/lib/python3.9/site-packages [ 13s] + PYTHONDONTWRITEBYTECODE=1 [ 13s] + python3.9 -m unittest discover -v --pattern '*.py' --start- directory tests [ 13s] usage: python3.9 -m unittest [-h] [-v] [-q] [--locals] [-f] [-c] [-b] [ 13s] [-k TESTNAMEPATTERNS] [ 13s] [tests ...] [ 13s] python3.9 -m unittest: error: unrecognized arguments: --pattern *.py --start-directory tests Does anyone have a suggestion how to fix this before I keep digging for too long?
I think that the macro expansion is okay, I've been testing and it's happening to me running the same command inside the "oscb --shell" abuild@localhost:~/rpmbuild/BUILD/antlr4-4.13.1/runtime/Python3> python3.9 -m unittest discover -v --pattern "*.py" --start-directory tests usage: python3.9 -m unittest [-h] [-v] [-q] [--locals] [-f] [-c] [-b] [-k TESTNAMEPATTERNS] [tests ...] Looks like the pattern "*.py" is catching the "run.py" script inside tests and that tries to run again unittest and that's the fail that you can see. I could recommend to run the tests in this case with: %{python_expand # PYTHONPATH=%{buildroot}%{$python_sitelib} $python tests/run.py } -- Daniel García Moreno Python Packager
Hi Daniel! On Wed, 2023-11-15 at 17:16 +0000, Daniel Garcia wrote:
I think that the macro expansion is okay, I've been testing and it's happening to me running the same command inside the "oscb --shell"
abuild@localhost:~/rpmbuild/BUILD/antlr4-4.13.1/runtime/Python3> python3.9 -m unittest discover -v --pattern "*.py" --start-directory tests usage: python3.9 -m unittest [-h] [-v] [-q] [--locals] [-f] [-c] [-b] [-k TESTNAMEPATTERNS] [tests ...]
Looks like the pattern "*.py" is catching the "run.py" script inside tests and that tries to run again unittest and that's the fail that you can see.
I could recommend to run the tests in this case with:
%{python_expand # PYTHONPATH=%{buildroot}%{$python_sitelib} $python tests/run.py }
The suggested change works fine. \o/ Thanks so much! Adrian
On Wed Nov 15, 2023 at 2:13 PM CET, Adrian Glaubitz via openSUSE Factory wrote:
[ 13s] + python3.9 -m unittest discover -v --pattern '*.py' --start-directory tests [ 13s] usage: python3.9 -m unittest [-h] [-v] [-q] [--locals] [-f] [-c] [-b] [ 13s] [-k TESTNAMEPATTERNS] [ 13s] [tests ...] [ 13s] python3.9 -m unittest: error: unrecognized arguments: --pattern *.py --start-directory tests
The problem is that our macros don't work well with double-hyphenated options. Try -p and -s instead. Does it work? Best, Matěj -- http://matej.ceplovi.cz/blog/, @mcepl@floss.social GPG Finger: 3C76 A027 CA45 AD70 98B5 BC1D 7920 5802 880B C9D8 This message has been composed of recycled electrons. None of these electrons has been harmed or injured in the creation and transmission of this message but they have been shamelessly exploited for this use.
participants (3)
-
Adrian Glaubitz
-
Daniel Garcia
-
Matěj Cepl