It hangs forever on the `collecting ...` phase.
It hangs forever on the `collecting ...` phase.
Alternatively, your IDE or editor probably already has an extension that allows you to right click - run single test. VS Code at least has some plugin that collects the tests in the background.
=============================== warnings summary ===============================
tests/parser/test_expressions.py::test_complex[+inf+1.23e7j-(inf+12300000j)]
You can run just that particular test (with that particular parametrized input) with pytest tests/parser/test_expressions.py::test_complex[+inf+1.23e7j-(inf+12300000j)] pytest tests/parser/test_expressions.py::test_complex[special_case_7]
[0] https://docs.pytest.org/en/7.1.x/example/parametrize.html#di...I'm hoping this PEP Proposal for lazy imports might solve things: https://peps.python.org/pep-0690/
Try profiling pytest with something like pyinstrument[1] and make sure you invoke it from python directly[2] with `--collect-only` as an argument. You'll essentially then just be profiling the import overheads before tests are ran.
[1] - https://pyinstrument.readthedocs.io/en/latest/guide.html#pro...
[2] - https://pyinstrument.readthedocs.io/en/latest/guide.html#pro...
If you’ve got a large project that’s been going for a while, squashing migrations helps too. It can be a bit tricky to do this though.