Skip to content

Test Failures in Indico project with AppMap recording enabled #362

Description

@petecheslock

Appmap library version 2.1.4
Python 3.12.2
Using the Indico fork mailnline branch

The following tests fail when using appmap-python pytest -vv <path to test>

indico/modules/events/export_test.py::test_event_export
=============================testsessionstarts==============================platformdarwin--Python3.12.2, pytest-8.1.1, pluggy-1.4.0--/Users/petecheslock/repos/indico/venv/bin/pythoncachedir: .pytest_cacherootdir: /Users/petecheslock/repos/indicoconfigfile: pytest.iniplugins: snapshot-0.9.0, cov-5.0.0, indico-3.3.4.dev0, redis-3.0.2, anyio-4.3.0, appmap-2.1.4, mock-3.14.0, localserver-0.8.1collecting ... collected1itemindico/modules/events/export_test.py::test_event_exportFAILED [100%]
===================================FAILURES===================================______________________________test_event_export_______________________________db=<IndicoSQLAlchemypostgresql:///test?host=%2Fvar%2Ffolders%2F2y%2Ft_jpbzqd07l4969l1523q2y40000gn%2FT%2Findicotestpg.bcr_yi8e>dummy_event=<Event(0, 2017-08-2410:00:00+00:00, 2017-08-2412:00:00+00:00): "dummy#0">monkeypatch=<_pytest.monkeypatch.MonkeyPatchobjectat0x11df6f800>@pytest.mark.usefixtures('reproducible_uuids', 'static_indico_version')deftest_event_export(db, dummy_event, monkeypatch):
monkeypatch.setattr('indico.modules.events.export.now_utc', lambda: as_utc(datetime(2017, 8, 24, 9, 0, 0)))
f=BytesIO()
dummy_event.created_dt=as_utc(datetime(2017, 8, 24, 0, 0, 0))
dummy_event.start_dt=as_utc(datetime(2017, 8, 24, 10, 0, 0))
dummy_event.end_dt=as_utc(datetime(2017, 8, 24, 12, 0, 0))
s=Session(event=dummy_event, title='sd', is_deleted=True)
Contribution(event=dummy_event, title='c1', duration=timedelta(minutes=30))
Contribution(event=dummy_event, title='c2', session=s, duration=timedelta(minutes=30), is_deleted=True)
db.session.flush()
export_event(dummy_event, f)
f.seek(0)
data_yaml_content= (Path(__file__).parent/'export_test_1.yaml').read_text()
# check composition of tarfile and data.yaml content>withtarfile.open(fileobj=f) astarf:
indico/modules/events/export_test.py:64: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ cls=<class'tarfile.TarFile'>, name=None, mode='r'fileobj=<_io.BytesIOobjectat0x11f210d10>, bufsize=10240, kwargs= {}
not_compressed=<functionTarFile.open.<locals>.not_compressedat0x11efe98a0>error_msgs= ["- method gz: ReadError('empty file')", "- method bz2: ReadError('not a bzip2 file')", "- method xz: ReadError('not an lzma file')", "- method tar: ReadError('empty file')"]
comptype='tar'func=<boundmethodTarFile.taropenof<class'tarfile.TarFile'>>saved_pos=0error_msgs_summary="- method gz: ReadError('empty file')\n- method bz2: ReadError('not a bzip2 file')\n- method xz: ReadError('not an lzma file')\n- method tar: ReadError('empty file')"@classmethoddefopen(cls, name=None, mode="r", fileobj=None, bufsize=RECORDSIZE, **kwargs):
"""Open a tar archive for reading, writing or appending. Return an appropriate TarFile class. mode: 'r' or 'r:*' open for reading with transparent compression 'r:' open for reading exclusively uncompressed 'r:gz' open for reading with gzip compression 'r:bz2' open for reading with bzip2 compression 'r:xz' open for reading with lzma compression 'a' or 'a:' open for appending, creating the file if necessary 'w' or 'w:' open for writing without compression 'w:gz' open for writing with gzip compression 'w:bz2' open for writing with bzip2 compression 'w:xz' open for writing with lzma compression 'x' or 'x:' create a tarfile exclusively without compression, raise an exception if the file is already created 'x:gz' create a gzip compressed tarfile, raise an exception if the file is already created 'x:bz2' create a bzip2 compressed tarfile, raise an exception if the file is already created 'x:xz' create an lzma compressed tarfile, raise an exception if the file is already created 'r|*' open a stream of tar blocks with transparent compression 'r|' open an uncompressed stream of tar blocks for reading 'r|gz' open a gzip compressed stream of tar blocks 'r|bz2' open a bzip2 compressed stream of tar blocks 'r|xz' open an lzma compressed stream of tar blocks 'w|' open an uncompressed stream for writing 'w|gz' open a gzip compressed stream for writing 'w|bz2' open a bzip2 compressed stream for writing 'w|xz' open an lzma compressed stream for writing """ifnotnameandnotfileobj:
raiseValueError("nothing to open")
ifmodein ("r", "r:*"):
# Find out which *open() is appropriate for opening the file.defnot_compressed(comptype):
returncls.OPEN_METH[comptype] =='taropen'error_msgs= []
forcomptypeinsorted(cls.OPEN_METH, key=not_compressed):
func=getattr(cls, cls.OPEN_METH[comptype])
iffileobjisnotNone:
saved_pos=fileobj.tell()
try:
returnfunc(name, "r", fileobj, **kwargs)
except (ReadError, CompressionError) ase:
error_msgs.append(f'- method {comptype}: {e!r}')
iffileobjisnotNone:
fileobj.seek(saved_pos)
continueerror_msgs_summary='\n'.join(error_msgs)
>raiseReadError(f"file could not be opened successfully:\n{error_msgs_summary}")
Etarfile.ReadError: filecouldnotbeopenedsuccessfully:
E-methodgz: ReadError('empty file')
E-methodbz2: ReadError('not a bzip2 file')
E-methodxz: ReadError('not an lzma file')
E-methodtar: ReadError('empty file')
../../.asdf/installs/python/3.12.2/lib/python3.12/tarfile.py:1809: ReadError------------------------------Capturedlogcall-------------------------------INFO_appmap.recording:recording.py:104writing/Users/petecheslock/repos/indico/tmp/appmap/pytest/test_event_export.appmap.json===========================shorttestsummaryinfo============================FAILEDindico/modules/events/export_test.py::test_event_export-tarfile.Read...
==============================1failedin13.20s==============================
indico/modules/events/export_test.py::test_event_attachment_export
=============================testsessionstarts==============================platformdarwin--Python3.12.2, pytest-8.1.1, pluggy-1.4.0--/Users/petecheslock/repos/indico/venv/bin/pythoncachedir: .pytest_cacherootdir: /Users/petecheslock/repos/indicoconfigfile: pytest.iniplugins: snapshot-0.9.0, cov-5.0.0, indico-3.3.4.dev0, redis-3.0.2, anyio-4.3.0, appmap-2.1.4, mock-3.14.0, localserver-0.8.1collecting ... collected1itemindico/modules/events/export_test.py::test_event_attachment_exportFAILED [100%]
===================================FAILURES===================================_________________________test_event_attachment_export_________________________db=<IndicoSQLAlchemypostgresql:///test?host=%2Fvar%2Ffolders%2F2y%2Ft_jpbzqd07l4969l1523q2y40000gn%2FT%2Findicotestpg.8pucq15u>dummy_event=<Event(0, 2024-07-3013:42:00+00:00, 2024-07-3014:42:00+00:00): "dummy#0">
@pytest.mark.usefixtures('reproducible_uuids', 'dummy_attachment')
deftest_event_attachment_export(db, dummy_event):
s=Session(event=dummy_event, title='sd', is_deleted=True)
Contribution(event=dummy_event, title='c1', duration=timedelta(minutes=30))
Contribution(event=dummy_event, title='c2', session=s, duration=timedelta(minutes=30), is_deleted=True)
db.session.flush()
f=BytesIO()
export_event(dummy_event, f)
f.seek(0)
>withtarfile.open(fileobj=f) astarf:
indico/modules/events/export_test.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ cls=<class'tarfile.TarFile'>, name=None, mode='r'fileobj=<_io.BytesIOobjectat0x12d13c8b0>, bufsize=10240, kwargs= {}
not_compressed=<functionTarFile.open.<locals>.not_compressedat0x12cfb1580>error_msgs= ["- method gz: ReadError('empty file')", "- method bz2: ReadError('not a bzip2 file')", "- method xz: ReadError('not an lzma file')", "- method tar: ReadError('empty file')"]
comptype='tar'func=<boundmethodTarFile.taropenof<class'tarfile.TarFile'>>saved_pos=0error_msgs_summary="- method gz: ReadError('empty file')\n- method bz2: ReadError('not a bzip2 file')\n- method xz: ReadError('not an lzma file')\n- method tar: ReadError('empty file')"@classmethoddefopen(cls, name=None, mode="r", fileobj=None, bufsize=RECORDSIZE, **kwargs):
"""Open a tar archive for reading, writing or appending. Return an appropriate TarFile class. mode: 'r' or 'r:*' open for reading with transparent compression 'r:' open for reading exclusively uncompressed 'r:gz' open for reading with gzip compression 'r:bz2' open for reading with bzip2 compression 'r:xz' open for reading with lzma compression 'a' or 'a:' open for appending, creating the file if necessary 'w' or 'w:' open for writing without compression 'w:gz' open for writing with gzip compression 'w:bz2' open for writing with bzip2 compression 'w:xz' open for writing with lzma compression 'x' or 'x:' create a tarfile exclusively without compression, raise an exception if the file is already created 'x:gz' create a gzip compressed tarfile, raise an exception if the file is already created 'x:bz2' create a bzip2 compressed tarfile, raise an exception if the file is already created 'x:xz' create an lzma compressed tarfile, raise an exception if the file is already created 'r|*' open a stream of tar blocks with transparent compression 'r|' open an uncompressed stream of tar blocks for reading 'r|gz' open a gzip compressed stream of tar blocks 'r|bz2' open a bzip2 compressed stream of tar blocks 'r|xz' open an lzma compressed stream of tar blocks 'w|' open an uncompressed stream for writing 'w|gz' open a gzip compressed stream for writing 'w|bz2' open a bzip2 compressed stream for writing 'w|xz' open an lzma compressed stream for writing """ifnotnameandnotfileobj:
raiseValueError("nothing to open")
ifmodein ("r", "r:*"):
# Find out which *open() is appropriate for opening the file.defnot_compressed(comptype):
returncls.OPEN_METH[comptype] =='taropen'error_msgs= []
forcomptypeinsorted(cls.OPEN_METH, key=not_compressed):
func=getattr(cls, cls.OPEN_METH[comptype])
iffileobjisnotNone:
saved_pos=fileobj.tell()
try:
returnfunc(name, "r", fileobj, **kwargs)
except (ReadError, CompressionError) ase:
error_msgs.append(f'- method {comptype}: {e!r}')
iffileobjisnotNone:
fileobj.seek(saved_pos)
continueerror_msgs_summary='\n'.join(error_msgs)
>raiseReadError(f"file could not be opened successfully:\n{error_msgs_summary}")
Etarfile.ReadError: filecouldnotbeopenedsuccessfully:
E-methodgz: ReadError('empty file')
E-methodbz2: ReadError('not a bzip2 file')
E-methodxz: ReadError('not an lzma file')
E-methodtar: ReadError('empty file')
../../.asdf/installs/python/3.12.2/lib/python3.12/tarfile.py:1809: ReadError------------------------------Capturedlogcall-------------------------------INFO_appmap.recording:recording.py:104writing/Users/petecheslock/repos/indico/tmp/appmap/pytest/test_event_attachment_export.appmap.json===========================shorttestsummaryinfo============================FAILEDindico/modules/events/export_test.py::test_event_attachment_export-t...
==============================1failedin13.27s==============================
indico/modules/events/papers/models/papers_test.py::test_can_judge
=============================testsessionstarts==============================platformdarwin--Python3.12.2, pytest-8.1.1, pluggy-1.4.0--/Users/petecheslock/repos/indico/venv/bin/pythoncachedir: .pytest_cacherootdir: /Users/petecheslock/repos/indicoconfigfile: pytest.iniplugins: snapshot-0.9.0, cov-5.0.0, indico-3.3.4.dev0, redis-3.0.2, anyio-4.3.0, appmap-2.1.4, mock-3.14.0, localserver-0.8.1collecting ... collected1itemindico/modules/events/papers/models/papers_test.py::test_can_judgeFAILED [100%]
===================================FAILURES===================================________________________________test_can_judge________________________________dummy_paper=<Paper(contribution_id=420, state=None)>dummy_user=<User(1337, 1337@example.test): "Guinea Pig">dummy_event=<Event(0, 2024-07-3013:44:00+00:00, 2024-07-3014:44:00+00:00): "dummy#0">
@pytest.mark.usefixtures('dummy_contribution')
deftest_can_judge(dummy_paper, dummy_user, dummy_event):
assertnotdummy_paper.can_judge(None)
# Judged papers cannot be judged againPaperRevision(paper=dummy_paper, submitter=dummy_user)
>dummy_paper.state=PaperRevisionState.acceptedindico/modules/events/papers/models/papers_test.py:23: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self=<Paper(contribution_id=420, state=None)>state=<PaperRevisionState.accepted: 2>
@state.setterdefstate(self, state):
>self.last_revision.state=stateEAttributeError: 'NoneType'objecthasnoattribute'state'indico/modules/events/papers/models/papers.py:54: AttributeError------------------------------Capturedlogcall-------------------------------INFO_appmap.recording:recording.py:104writing/Users/petecheslock/repos/indico/tmp/appmap/pytest/test_can_judge.appmap.json===========================shorttestsummaryinfo============================FAILEDindico/modules/events/papers/models/papers_test.py::test_can_judge-A...
==============================1failedin12.64s==============================
indico/util/i18n_test.py::test_lazy_translation
=============================testsessionstarts==============================platformdarwin--Python3.12.2, pytest-8.1.1, pluggy-1.4.0--/Users/petecheslock/repos/indico/venv/bin/pythoncachedir: .pytest_cacherootdir: /Users/petecheslock/repos/indicoconfigfile: pytest.iniplugins: snapshot-0.9.0, cov-5.0.0, indico-3.3.4.dev0, redis-3.0.2, anyio-4.3.0, appmap-2.1.4, mock-3.14.0, localserver-0.8.1collecting ... collected1itemindico/util/i18n_test.py::test_lazy_translationFAILED [100%]
===================================FAILURES===================================____________________________test_lazy_translation_____________________________monkeypatch=<_pytest.monkeypatch.MonkeyPatchobjectat0x12a653860>
@pytest.mark.usefixtures('mock_translations')
deftest_lazy_translation(monkeypatch):
monkeypatch.setattr('indico.util.i18n.has_request_context', lambda: False)
a= _('Fetch the cow')
b= _('The wheels')
monkeypatch.setattr('indico.util.i18n.has_request_context', lambda: True)
assertisinstance(a, _LazyString)
assertisinstance(b, _LazyString)
session.lang='fr_CH'>assertstr(a) =='Fetchez la vache'indico/util/i18n_test.py:103: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ venv/lib/python3.12/site-packages/speaklater.py:133: in__str__returnstr(self.value)
venv/lib/python3.12/site-packages/speaklater.py:115: in<lambda>value=property(lambdax: x._func(*x._args, **x._kwargs))
venv/lib/python3.12/site-packages/_appmap/wrapt/wrappers.py:629: in__call__returnself._self_wrapper(self.__wrapped__, self._self_instance,
venv/lib/python3.12/site-packages/_appmap/instrument.py:138: ininstrumented_fnreturncall_instrumented(f, instance, args, kwargs)
venv/lib/python3.12/site-packages/_appmap/instrument.py:94: incall_instrumentedret=f.fn(*args, **kwargs)
indico/util/i18n.py:89: in_indico_gettexttranslations=get_translation_domain(plugin_name).get_translations()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self=<MockTranslations: "None">def__init__(self):
super().__init__()
>self._catalog=DICTIONARIES[str(get_locale())]
EKeyError: 'en_GB'indico/util/i18n_test.py:63: KeyError------------------------------Capturedlogcall-------------------------------INFO_appmap.recording:recording.py:104writing/Users/petecheslock/repos/indico/tmp/appmap/pytest/test_lazy_translation.appmap.json===========================shorttestsummaryinfo============================FAILEDindico/util/i18n_test.py::test_lazy_translation-KeyError: 'en_GB'==============================1failedin10.39s==============================

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions