[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Test suite issues with new version of python3-antlr4 (Was: python3-antlr4: FTBFS: AttributeError: 'TestIntervalSet' object has no attribute 'assertEquals'. Did you mean: 'assertEqual'?)



Control: tags -1 pending

Hi,

I intended to fix bug #1058096.  Since I realised there is a new
upstream version I was considering an upgrade which I pushed to Salsa.
Unfortunately there are other test suite errors as you can see in Salsa
CI[1]:

======================================================================
ERROR: test.__main__ (unittest.loader._FailedTest.test.__main__)
----------------------------------------------------------------------
ImportError: Failed to import test module: test.__main__
Traceback (most recent call last):
  File "/usr/lib/python3.11/unittest/loader.py", line 419, in _find_test_path
    module = self._get_module_from_name(name)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/unittest/loader.py", line 362, in _get_module_from_name
    __import__(name)
  File "/usr/lib/python3.11/test/__main__.py", line 2, in <module>
    main(_add_python_opts=True)
  File "/usr/lib/python3.11/test/libregrtest/main.py", line 671, in main
    ns = _parse_args(sys.argv[1:], **kwargs)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/test/libregrtest/cmdline.py", line 402, in _parse_args
    parser.error("unrecognized arguments: %s" % arg)
  File "/usr/lib/python3.11/test/libregrtest/cmdline.py", line 182, in error
    super().error(message + "\nPass -h or --help for complete help.")
  File "/usr/lib/python3.11/argparse.py", line 2642, in error
    self.exit(2, _('%(prog)s: error: %(message)s\n') % args)
  File "/usr/lib/python3.11/argparse.py", line 2629, in exit
    _sys.exit(status)
SystemExit: 2
...
(see more in Salsa CI log[1])


Since this looks pretty much as if the reason for this failur is that
the PiPY downloadable tarball is lacking the directory test/ (which was
included in the currently packaged version) I checked Github for these
files and added these inside a multi-source tarball (a script to create
this tarball is commited as well).  While the first three tests that
were importing from test/ are passing now.  I've also fixed bug #1058096
in a patch[2] (thus tagging this bug pending).  However, that new version
has now new test failures which you can find in the new Salsa CI build
log which includes the (fixed) tests[3].  It starts with

======================================================================
ERROR: TestTokenStreamRewriter (unittest.loader._FailedTest.TestTokenStreamRewriter)
----------------------------------------------------------------------
ImportError: Failed to import test module: TestTokenStreamRewriter
Traceback (most recent call last):
  File "/usr/lib/python3.11/unittest/loader.py", line 419, in _find_test_path
    module = self._get_module_from_name(name)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/unittest/loader.py", line 362, in _get_module_from_name
    __import__(name)
  File "/builds/python-team/packages/python3-antlr4/debian/output/source_dir/.pybuild/cpython3_3.11_antlr4/build/test/TestTokenStreamRewriter.py", line 8, in <module>
    from mocks.TestLexer import TestLexer, TestLexer2
  File "/builds/python-team/packages/python3-antlr4/debian/output/source_dir/.pybuild/cpython3_3.11_antlr4/build/test/mocks/TestLexer.py", line 19, in <module>
    class TestLexer(Lexer):
  File "/builds/python-team/packages/python3-antlr4/debian/output/source_dir/.pybuild/cpython3_3.11_antlr4/build/test/mocks/TestLexer.py", line 20, in TestLexer
    atn = ATNDeserializer().deserialize(serializedATN())
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builds/python-team/packages/python3-antlr4/debian/output/source_dir/.pybuild/cpython3_3.11_antlr4/build/antlr4/atn/ATNDeserializer.py", line 28, in deserialize
    self.checkVersion()
  File "/builds/python-team/packages/python3-antlr4/debian/output/source_dir/.pybuild/cpython3_3.11_antlr4/build/antlr4/atn/ATNDeserializer.py", line 50, in checkVersion
    raise Exception("Could not deserialize ATN with version " + str(version) + " (expected " + str(SERIALIZED_VERSION) + ").")
Exception: Could not deserialize ATN with version   (expected 4).
...

and I have no idea how to fix this.

Kind regards
    Andreas.


[1] https://salsa.debian.org/python-team/packages/python3-antlr4/-/jobs/5066603
[2] https://salsa.debian.org/python-team/packages/python3-antlr4/-/blob/master/debian/patches/assertEquals.patch?ref_type=heads
[3] https://salsa.debian.org/python-team/packages/python3-antlr4/-/jobs/5067599

-- 
http://fam-tille.de
#!/bin/sh
# The archive at PiPy is not featuring the test suite files
# This script is fetching the files and creates a tarball that is suited for multi-source tarball

UGIT=https://github.com/antlr/antlr4/
UVERSION=$(dpkg-parsechangelog --file ./changelog | grep '^Version' | cut -d' ' -f2  | cut -f1 -d-)
tarball=$(dpkg-parsechangelog --file ./changelog | awk '/^Source:/ {print $2}')_${UVERSION}.orig-tests.tar.gz
set -x

tmpdir=$(mktemp -d /tmp/python3-antlr4-testsuiteXXXX)
curdir=$PWD
cd $tmpdir

git clone ${UGIT}
cd antlr4
git checkout ${UVERSION}
mv runtime/Python3/tests ..
cd ..

tar --owner=root --group=root --mode=a+rX -caf $tarball tests
mv $tarball $curdir
cd $curdir

rm -rf $tmpdir
[DEFAULT]
pristine-tar=True
filter=[ '.gitignore', '.travis.yml', '.git*' ]
component=['tests']

Reply to: