pytest
pytest copied to clipboard
The pytest framework makes it easy to write small tests, yet scales to support complex functional testing
Using `` maxsplit=1`` from ``use-maxplit-args`` will make splits slightly faster and is the important one that will improve performances. The other fix are about readability / style.
It seems that if pytest is run in a development directory, it can create files in `site-packages/.../__pycache__` which can cause modules to continue getting "imported" even when they are uninstalled....
Suppose you have a test that may fail with a very large diff; say: ```python def test_xyz() -> None: assert ["x"] * 10_000 == ["x\n"] * 10_000 ``` With normal...
The magic name-matching of pytest's fixtures can lead to namespace clashes, apart from being unpythonic (see #3834). Getting a wrong fixture may lead to hard-to-debug errors, especially if one does...
I started giving more and more pytest trainings recently, and noticed a confusion almost everyone stumbles over when using parametrize the first time. Many people accidentally write: ```python import pytest...
Hello here! I'm posting this following another older topic I found about someone having the same issue: https://github.com/pytest-dev/pytest/issues/6945, but this was related to a way older version of Pytest than...
In https://github.com/jaraco/keyring/issues/673, I captured an issue stemming from the introduction of `--import-mode importlib` to jaraco/skeleton projects. In https://github.com/jaraco/keyring/commit/6ff02e0eefcd90e271cefd326b460ecfa0e3eb9e, I'm attempting to enable importlib mode for all projects in order to...
When there are some pytest plugins disabled using the `-p no:XXX` option the information about disabled plugins is not passed down to the `runpytest()` call, so the initially disabled plugin...
Using ``exc_info.exconly(tryshort=True)`` is meant to remove ``AssertionError: `` from the exception message according to [(ref)](https://docs.pytest.org/en/7.1.x/reference/reference.html#pytest.ExceptionInfo.exconly) > When 'tryshort' resolves to True, and the exception is an AssertionError, only the actual...
In #4826 (and earlier with `--strict`), we introduced warnings for *applying* unregistered marks, because otherwise something like: ```python @pytest.mark.sloww # sic! def test_slow(): pass ``` would be a silent failure,...