getappmap / getappmap/appmap-python

in-process invocation of a test runner fails with "Recording already in progress"

Ouverte
#371 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Langage dominant
Python
Étoiles
104
Forks
17
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

If one of the supported test runners (e.g. pytest, unittest) is run in-process, the enabled recording methods for the process apply to the test runner.

For example, in this test, the sqlmesh plan subcommand uses a click.testing.CliRunner to run a unittest test, which fails:

tests/cli/test_cli.py::test_plan 
----------------------------------------------------------------------
Test Failure Summary
======================================================================
Num Successful Tests: 0
Failure Test: sqlmesh_example.full_model test_example_full_model
======================================================================
E
======================================================================
ERROR: test_example_full_model (/private/var/folders/2g/xqtf8_tn5j1861bbkvvhtmmr0000gn/T/pytest-of-ajp/pytest-159/test_plan0/tests/test_full_model.yaml)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/ajp/src/applandinc/appmap-python/_appmap/wrapt/wrappers.py", line 744, in __call__
    return self._self_wrapper(self.__wrapped__, self._self_instance,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ajp/src/applandinc/appmap-python/_appmap/unittest.py", line 36, in callTestMethod
    with _session.record(test_case.__class__, method_name, location=location) as metadata:
  File "/Users/ajp/.asdf/installs/python/3.12.2/lib/python3.12/contextlib.py", line 137, in __enter__
    return next(self.gen)
           ^^^^^^^^^^^^^^
  File "/Users/ajp/src/applandinc/appmap-python/_appmap/testing_framework.py", line 119, in record
    with rec, environ.disabled("requests"):
  File "/Users/ajp/src/applandinc/appmap-python/_appmap/recording.py", line 47, in __enter__
    self.start()
  File "/Users/ajp/src/applandinc/appmap-python/_appmap/recording.py", line 32, in start
    r.start_recording()
  File "/Users/ajp/src/applandinc/appmap-python/_appmap/recorder.py", line 108, in start_recording
    cls.get_current()._start_recording()  # pylint: disable=protected-access
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ajp/src/applandinc/appmap-python/_appmap/recorder.py", line 236, in _start_recording
    super()._start_recording()
  File "/Users/ajp/src/applandinc/appmap-python/_appmap/recorder.py", line 158, in _start_recording
    raise RuntimeError("Recording already in progress")
RuntimeError: Recording already in progress

----------------------------------------------------------------------
Ran 1 test in 0.165s

FAILED (errors=1)

Error: Cannot generate plan due to failing test(s). Fix test(s) and run again

FAILED

============================================================================================ FAILURES ============================================================================================

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Reproduisez l’échec de tests/cli/test_cli.py::test_plan, puis suivez le flux d’enregistrement imbriqué à travers _appmap/unittest.py, testing_framework.py, recording.py et recorder.py. Vérifiez qu’un exécuteur de tests dans le processus ne lève plus "Recording already in progress" et que le test du plan se termine correctement.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
python
Domaine
devtools, testing-qa
Type d'issue
Bug
Difficulté
4/5
Temps estimé
3-5 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.