-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Labels
Description
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
============================= test session starts ==============================
platform darwin -- Python 3.12.2, pytest-8.1.1, pluggy-1.4.0 -- /Users/petecheslock/repos/indico/venv/bin/python
cachedir: .pytest_cache
rootdir: /Users/petecheslock/repos/indico
configfile: pytest.ini
plugins: 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.1
collecting ... collected 1 item
indico/modules/events/export_test.py::test_event_export FAILED [100%]
=================================== FAILURES ===================================
______________________________ test_event_export _______________________________
db = <IndicoSQLAlchemy postgresql:///test?host=%2Fvar%2Ffolders%2F2y%2Ft_jpbzqd07l4969l1523q2y40000gn%2FT%2Findicotestpg.bcr_yi8e>
dummy_event = <Event(0, 2017-08-24 10:00:00+00:00, 2017-08-24 12:00:00+00:00): "dummy#0">
monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x11df6f800>
@pytest.mark.usefixtures('reproducible_uuids', 'static_indico_version')
def test_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
> with tarfile.open(fileobj=f) as tarf:
indico/modules/events/export_test.py:64:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'tarfile.TarFile'>, name = None, mode = 'r'
fileobj = <_io.BytesIO object at 0x11f210d10>, bufsize = 10240, kwargs = {}
not_compressed = <function TarFile.open.<locals>.not_compressed at 0x11efe98a0>
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 = <bound method TarFile.taropen of <class 'tarfile.TarFile'>>
saved_pos = 0
error_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')"
@classmethod
def open(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
"""
if not name and not fileobj:
raise ValueError("nothing to open")
if mode in ("r", "r:*"):
# Find out which *open() is appropriate for opening the file.
def not_compressed(comptype):
return cls.OPEN_METH[comptype] == 'taropen'
error_msgs = []
for comptype in sorted(cls.OPEN_METH, key=not_compressed):
func = getattr(cls, cls.OPEN_METH[comptype])
if fileobj is not None:
saved_pos = fileobj.tell()
try:
return func(name, "r", fileobj, **kwargs)
except (ReadError, CompressionError) as e:
error_msgs.append(f'- method {comptype}: {e!r}')
if fileobj is not None:
fileobj.seek(saved_pos)
continue
error_msgs_summary = '\n'.join(error_msgs)
> raise ReadError(f"file could not be opened successfully:\n{error_msgs_summary}")
E tarfile.ReadError: file could not be opened successfully:
E - method gz: ReadError('empty file')
E - method bz2: ReadError('not a bzip2 file')
E - method xz: ReadError('not an lzma file')
E - method tar: ReadError('empty file')
../../.asdf/installs/python/3.12.2/lib/python3.12/tarfile.py:1809: ReadError
------------------------------ Captured log call -------------------------------
INFO _appmap.recording:recording.py:104 writing /Users/petecheslock/repos/indico/tmp/appmap/pytest/test_event_export.appmap.json
=========================== short test summary info ============================
FAILED indico/modules/events/export_test.py::test_event_export - tarfile.Read...
============================== 1 failed in 13.20s ==============================indico/modules/events/export_test.py::test_event_attachment_export
============================= test session starts ==============================
platform darwin -- Python 3.12.2, pytest-8.1.1, pluggy-1.4.0 -- /Users/petecheslock/repos/indico/venv/bin/python
cachedir: .pytest_cache
rootdir: /Users/petecheslock/repos/indico
configfile: pytest.ini
plugins: 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.1
collecting ... collected 1 item
indico/modules/events/export_test.py::test_event_attachment_export FAILED [100%]
=================================== FAILURES ===================================
_________________________ test_event_attachment_export _________________________
db = <IndicoSQLAlchemy postgresql:///test?host=%2Fvar%2Ffolders%2F2y%2Ft_jpbzqd07l4969l1523q2y40000gn%2FT%2Findicotestpg.8pucq15u>
dummy_event = <Event(0, 2024-07-30 13:42:00+00:00, 2024-07-30 14:42:00+00:00): "dummy#0">
@pytest.mark.usefixtures('reproducible_uuids', 'dummy_attachment')
def test_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)
> with tarfile.open(fileobj=f) as tarf:
indico/modules/events/export_test.py:80:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'tarfile.TarFile'>, name = None, mode = 'r'
fileobj = <_io.BytesIO object at 0x12d13c8b0>, bufsize = 10240, kwargs = {}
not_compressed = <function TarFile.open.<locals>.not_compressed at 0x12cfb1580>
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 = <bound method TarFile.taropen of <class 'tarfile.TarFile'>>
saved_pos = 0
error_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')"
@classmethod
def open(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
"""
if not name and not fileobj:
raise ValueError("nothing to open")
if mode in ("r", "r:*"):
# Find out which *open() is appropriate for opening the file.
def not_compressed(comptype):
return cls.OPEN_METH[comptype] == 'taropen'
error_msgs = []
for comptype in sorted(cls.OPEN_METH, key=not_compressed):
func = getattr(cls, cls.OPEN_METH[comptype])
if fileobj is not None:
saved_pos = fileobj.tell()
try:
return func(name, "r", fileobj, **kwargs)
except (ReadError, CompressionError) as e:
error_msgs.append(f'- method {comptype}: {e!r}')
if fileobj is not None:
fileobj.seek(saved_pos)
continue
error_msgs_summary = '\n'.join(error_msgs)
> raise ReadError(f"file could not be opened successfully:\n{error_msgs_summary}")
E tarfile.ReadError: file could not be opened successfully:
E - method gz: ReadError('empty file')
E - method bz2: ReadError('not a bzip2 file')
E - method xz: ReadError('not an lzma file')
E - method tar: ReadError('empty file')
../../.asdf/installs/python/3.12.2/lib/python3.12/tarfile.py:1809: ReadError
------------------------------ Captured log call -------------------------------
INFO _appmap.recording:recording.py:104 writing /Users/petecheslock/repos/indico/tmp/appmap/pytest/test_event_attachment_export.appmap.json
=========================== short test summary info ============================
FAILED indico/modules/events/export_test.py::test_event_attachment_export - t...
============================== 1 failed in 13.27s ==============================indico/modules/events/papers/models/papers_test.py::test_can_judge
============================= test session starts ==============================
platform darwin -- Python 3.12.2, pytest-8.1.1, pluggy-1.4.0 -- /Users/petecheslock/repos/indico/venv/bin/python
cachedir: .pytest_cache
rootdir: /Users/petecheslock/repos/indico
configfile: pytest.ini
plugins: 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.1
collecting ... collected 1 item
indico/modules/events/papers/models/papers_test.py::test_can_judge FAILED [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-30 13:44:00+00:00, 2024-07-30 14:44:00+00:00): "dummy#0">
@pytest.mark.usefixtures('dummy_contribution')
def test_can_judge(dummy_paper, dummy_user, dummy_event):
assert not dummy_paper.can_judge(None)
# Judged papers cannot be judged again
PaperRevision(paper=dummy_paper, submitter=dummy_user)
> dummy_paper.state = PaperRevisionState.accepted
indico/modules/events/papers/models/papers_test.py:23:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Paper(contribution_id=420, state=None)>
state = <PaperRevisionState.accepted: 2>
@state.setter
def state(self, state):
> self.last_revision.state = state
E AttributeError: 'NoneType' object has no attribute 'state'
indico/modules/events/papers/models/papers.py:54: AttributeError
------------------------------ Captured log call -------------------------------
INFO _appmap.recording:recording.py:104 writing /Users/petecheslock/repos/indico/tmp/appmap/pytest/test_can_judge.appmap.json
=========================== short test summary info ============================
FAILED indico/modules/events/papers/models/papers_test.py::test_can_judge - A...
============================== 1 failed in 12.64s ==============================indico/util/i18n_test.py::test_lazy_translation
============================= test session starts ==============================
platform darwin -- Python 3.12.2, pytest-8.1.1, pluggy-1.4.0 -- /Users/petecheslock/repos/indico/venv/bin/python
cachedir: .pytest_cache
rootdir: /Users/petecheslock/repos/indico
configfile: pytest.ini
plugins: 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.1
collecting ... collected 1 item
indico/util/i18n_test.py::test_lazy_translation FAILED [100%]
=================================== FAILURES ===================================
____________________________ test_lazy_translation _____________________________
monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x12a653860>
@pytest.mark.usefixtures('mock_translations')
def test_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)
assert isinstance(a, _LazyString)
assert isinstance(b, _LazyString)
session.lang = 'fr_CH'
> assert str(a) == 'Fetchez la vache'
indico/util/i18n_test.py:103:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
venv/lib/python3.12/site-packages/speaklater.py:133: in __str__
return str(self.value)
venv/lib/python3.12/site-packages/speaklater.py:115: in <lambda>
value = property(lambda x: x._func(*x._args, **x._kwargs))
venv/lib/python3.12/site-packages/_appmap/wrapt/wrappers.py:629: in __call__
return self._self_wrapper(self.__wrapped__, self._self_instance,
venv/lib/python3.12/site-packages/_appmap/instrument.py:138: in instrumented_fn
return call_instrumented(f, instance, args, kwargs)
venv/lib/python3.12/site-packages/_appmap/instrument.py:94: in call_instrumented
ret = f.fn(*args, **kwargs)
indico/util/i18n.py:89: in _indico_gettext
translations = get_translation_domain(plugin_name).get_translations()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <MockTranslations: "None">
def __init__(self):
super().__init__()
> self._catalog = DICTIONARIES[str(get_locale())]
E KeyError: 'en_GB'
indico/util/i18n_test.py:63: KeyError
------------------------------ Captured log call -------------------------------
INFO _appmap.recording:recording.py:104 writing /Users/petecheslock/repos/indico/tmp/appmap/pytest/test_lazy_translation.appmap.json
=========================== short test summary info ============================
FAILED indico/util/i18n_test.py::test_lazy_translation - KeyError: 'en_GB'
============================== 1 failed in 10.39s ==============================