You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What is your setup and what steps did you do?
This is reduced from an issue I encountered in our project
> nix shell nixpkgs#python3
> which python
/nix/store/7hnr99nxrd2aw6lghybqdmkckq60j6l9-python3-3.11.9/bin/python
> find
.
./test_repro.py
> cat test_repro.py
def test_hmm():
method = "get"
match method:
case"post":
def mk_request():
return"a"case"get":
def mk_request():
return"b"case _:
raise ValueError("Method must be either get or post")
assert mk_request() == "yo"> python -m venv env
python -m venv env 2,52s user 0,18s system 96% cpu 2,805 total
>. env/bin/activate
(env) > pip install pytest-testmon
Collecting pytest-testmon
Using cached pytest_testmon-2.1.1-py3-none-any.whl.metadata (2.0 kB)
Collecting pytest<9,>=5 (from pytest-testmon)
Using cached pytest-8.2.2-py3-none-any.whl.metadata (7.6 kB)
Collecting coverage<8,>=6 (from pytest-testmon)
Using cached coverage-7.5.4-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (8.2 kB)
Collecting iniconfig (from pytest<9,>=5->pytest-testmon)
Using cached iniconfig-2.0.0-py3-none-any.whl.metadata (2.6 kB)
Collecting packaging (from pytest<9,>=5->pytest-testmon)
Using cached packaging-24.1-py3-none-any.whl.metadata (3.2 kB)
Collecting pluggy<2.0,>=1.5 (from pytest<9,>=5->pytest-testmon)
Using cached pluggy-1.5.0-py3-none-any.whl.metadata (4.8 kB)
Using cached pytest_testmon-2.1.1-py3-none-any.whl (22 kB)
Using cached coverage-7.5.4-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (236 kB)
Using cached pytest-8.2.2-py3-none-any.whl (339 kB)
Using cached pluggy-1.5.0-py3-none-any.whl (20 kB)
Using cached iniconfig-2.0.0-py3-none-any.whl (5.9 kB)
Using cached packaging-24.1-py3-none-any.whl (53 kB)
Installing collected packages: pluggy, packaging, iniconfig, coverage, pytest, pytest-testmon
Successfully installed coverage-7.5.4 iniconfig-2.0.0 packaging-24.1 pluggy-1.5.0 pytest-8.2.2 pytest-testmon-2.1.1
[notice] A new release of pip is available: 24.0 -> 24.1.2
[notice] To update, run: pip install --upgrade pip
(env) > pip freeze
coverage==7.5.4
iniconfig==2.0.0
packaging==24.1
pluggy==1.5.0
pytest==8.2.2
pytest-testmon==2.1.1
(env) > pytest --testmon
/path/to/testmon_repro/env/lib/python3.11/site-packages/testmon/pytest_testmon.py:461: PytestRemovedIn9Warning: The (path: py.path.local) argument is deprecated, please use (collection_path: pathlib.Path)
see https://docs.pytest.org/en/latest/deprecations.html#py-path-local-arguments-for-hooks-replaced-with-pathlib-path
def pytest_ignore_collect(self, path, config):
=========================================================================== test session starts ===========================================================================
platform linux -- Python 3.11.9, pytest-8.2.2, pluggy-1.5.0
testmon: new DB, environment: default
We'd like to hear from testmon users! 🙏🙏 go to https://testmon.org/survey to leave feedback ✅❌rootdir: /path/to/testmon_reproplugins: testmon-2.1.1collected 1 item test_repro.py FINTERNALERROR> Traceback (most recent call last):INTERNALERROR> File "/path/to/testmon_repro/env/lib/python3.11/site-packages/_pytest/main.py", line 285, in wrap_sessionINTERNALERROR> session.exitstatus = doit(config, session) or 0INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^INTERNALERROR> File "/path/to/testmon_repro/env/lib/python3.11/site-packages/_pytest/main.py", line 339, in _mainINTERNALERROR> config.hook.pytest_runtestloop(session=session)INTERNALERROR> File "/path/to/testmon_repro/env/lib/python3.11/site-packages/pluggy/_hooks.py", line 513, in __call__INTERNALERROR> return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^INTERNALERROR> File "/path/to/testmon_repro/env/lib/python3.11/site-packages/pluggy/_manager.py", line 120, in _hookexecINTERNALERROR> return self._inner_hookexec(hook_name, methods, kwargs, firstresult)INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^INTERNALERROR> File "/path/to/testmon_repro/env/lib/python3.11/site-packages/pluggy/_callers.py", line 139, in _multicallINTERNALERROR> raise exception.with_traceback(exception.__traceback__)INTERNALERROR> File "/path/to/testmon_repro/env/lib/python3.11/site-packages/pluggy/_callers.py", line 122, in _multicallINTERNALERROR> teardown.throw(exception) # type: ignore[union-attr]INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^^INTERNALERROR> File "/path/to/testmon_repro/env/lib/python3.11/site-packages/_pytest/logging.py", line 807, in pytest_runtestloopINTERNALERROR> return (yield) # Run all the tests.INTERNALERROR> ^^^^^INTERNALERROR> File "/path/to/testmon_repro/env/lib/python3.11/site-packages/pluggy/_callers.py", line 103, in _multicallINTERNALERROR> res = hook_impl.function(*args)INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^^INTERNALERROR> File "/path/to/testmon_repro/env/lib/python3.11/site-packages/_pytest/main.py", line 364, in pytest_runtestloopINTERNALERROR> item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)INTERNALERROR> File "/path/to/testmon_repro/env/lib/python3.11/site-packages/pluggy/_hooks.py", line 513, in __call__INTERNALERROR> return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^INTERNALERROR> File "/path/to/testmon_repro/env/lib/python3.11/site-packages/pluggy/_manager.py", line 120, in _hookexecINTERNALERROR> return self._inner_hookexec(hook_name, methods, kwargs, firstresult)INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^INTERNALERROR> File "/path/to/testmon_repro/env/lib/python3.11/site-packages/pluggy/_callers.py", line 182, in _multicallINTERNALERROR> return outcome.get_result()INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^INTERNALERROR> File "/path/to/testmon_repro/env/lib/python3.11/site-packages/pluggy/_result.py", line 100, in get_resultINTERNALERROR> raise exc.with_traceback(exc.__traceback__)INTERNALERROR> File "/path/to/testmon_repro/env/lib/python3.11/site-packages/pluggy/_callers.py", line 167, in _multicallINTERNALERROR> teardown.throw(outcome._exception)INTERNALERROR> File "/path/to/testmon_repro/env/lib/python3.11/site-packages/_pytest/warnings.py", line 111, in pytest_runtest_protocolINTERNALERROR> return (yield)INTERNALERROR> ^^^^^INTERNALERROR> File "/path/to/testmon_repro/env/lib/python3.11/site-packages/pluggy/_callers.py", line 167, in _multicallINTERNALERROR> teardown.throw(outcome._exception)INTERNALERROR> File "/path/to/testmon_repro/env/lib/python3.11/site-packages/_pytest/assertion/__init__.py", line 176, in pytest_runtest_protocolINTERNALERROR> return (yield)INTERNALERROR> ^^^^^INTERNALERROR> File "/path/to/testmon_repro/env/lib/python3.11/site-packages/pluggy/_callers.py", line 167, in _multicallINTERNALERROR> teardown.throw(outcome._exception)INTERNALERROR> File "/path/to/testmon_repro/env/lib/python3.11/site-packages/_pytest/unittest.py", line 422, in pytest_runtest_protocolINTERNALERROR> res = yieldINTERNALERROR> ^^^^^INTERNALERROR> File "/path/to/testmon_repro/env/lib/python3.11/site-packages/pluggy/_callers.py", line 167, in _multicallINTERNALERROR> teardown.throw(outcome._exception)INTERNALERROR> File "/path/to/testmon_repro/env/lib/python3.11/site-packages/_pytest/faulthandler.py", line 85, in pytest_runtest_protocolINTERNALERROR> return (yield)INTERNALERROR> ^^^^^INTERNALERROR> File "/path/to/testmon_repro/env/lib/python3.11/site-packages/pluggy/_callers.py", line 103, in _multicallINTERNALERROR> res = hook_impl.function(*args)INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^^INTERNALERROR> File "/path/to/testmon_repro/env/lib/python3.11/site-packages/_pytest/runner.py", line 116, in pytest_runtest_protocolINTERNALERROR> runtestprotocol(item, nextitem=nextitem)INTERNALERROR> File "/path/to/testmon_repro/env/lib/python3.11/site-packages/_pytest/runner.py", line 136, in runtestprotocolINTERNALERROR> reports.append(call_and_report(item, "teardown", log, nextitem=nextitem))INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^INTERNALERROR> File "/path/to/testmon_repro/env/lib/python3.11/site-packages/_pytest/runner.py", line 245, in call_and_reportINTERNALERROR> ihook.pytest_runtest_logreport(report=report)INTERNALERROR> File "/path/to/testmon_repro/env/lib/python3.11/site-packages/pluggy/_hooks.py", line 513, in __call__INTERNALERROR> return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^INTERNALERROR> File "/path/to/testmon_repro/env/lib/python3.11/site-packages/pluggy/_manager.py", line 120, in _hookexecINTERNALERROR> return self._inner_hookexec(hook_name, methods, kwargs, firstresult)INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^INTERNALERROR> File "/path/to/testmon_repro/env/lib/python3.11/site-packages/pluggy/_callers.py", line 139, in _multicallINTERNALERROR> raise exception.with_traceback(exception.__traceback__)INTERNALERROR> File "/path/to/testmon_repro/env/lib/python3.11/site-packages/pluggy/_callers.py", line 103, in _multicallINTERNALERROR> res = hook_impl.function(*args)INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^^INTERNALERROR> File "/path/to/testmon_repro/env/lib/python3.11/site-packages/testmon/pytest_testmon.py", line 373, in pytest_runtest_logreportINTERNALERROR> test_executions_fingerprints = self.testmon_data.get_tests_fingerprints(INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^INTERNALERROR> File "/path/to/testmon_repro/env/lib/python3.11/site-packages/testmon/testmon_core.py", line 216, in get_tests_fingerprintsINTERNALERROR> fingerprint = create_fingerprint(module, covered)INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^INTERNALERROR> File "/path/to/testmon_repro/env/lib/python3.11/site-packages/testmon/process_code.py", line 280, in create_fingerprintINTERNALERROR> if sorted_lines[line_index] <= current_block.end:INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^INTERNALERROR> TypeError: '<=' not supported between instances of 'int' and 'NoneType'============================================================================ 1 failed in 0.04s ============================================================================
What was the outcome?
See above
What is your operating system and it's version please?
Reasonably updated arch linux with nix stuff generously sprinkled about...
I'm happy to help investigate if this doesn't reproduce as easily as I hope.
The text was updated successfully, but these errors were encountered:
We are also running into this issue, it is preventing us from using testmon now.
It seems to have something to do with defining functions inside match...case blocks:
importtestmon.process_codem=testmon.process_code.Module("""def f(a): match a: case 23: def b(): print("23") case 46: def b(): print("46")""")
[b.endforbinm.blocks]
prints [None, 9, 9, 9].
importtestmon.process_codem=testmon.process_code.Module("""def f(a): if a == 23: def b(): print("23") if a == 46: def b(): print("46")""")
[b.endforbinm.blocks]
What is your setup and what steps did you do?
This is reduced from an issue I encountered in our project
What was the outcome?
See above
What is your operating system and it's version please?
Reasonably updated arch linux with nix stuff generously sprinkled about...
I'm happy to help investigate if this doesn't reproduce as easily as I hope.
The text was updated successfully, but these errors were encountered: