MCPcopy Create free account
hub / github.com/pytest-dev/pytest / test_no_magic_values

Method test_no_magic_values

testing/test_mark.py:876–891  ·  view source on GitHub ↗

Make sure the tests do not match on magic values, no double underscored values, like '__dict__' and '+'.

(self, pytester: Pytester, keyword: str)

Source from the content-addressed store, hash-verified

874 ["__", "+", ".."],
875 )
876 def test_no_magic_values(self, pytester: Pytester, keyword: str) -> None:
877 """Make sure the tests do not match on magic values,
878 no double underscored values, like '__dict__' and '+'.
879 """
880 p = pytester.makepyfile(
881 """
882 def test_one(): assert 1
883 """
884 )
885
886 reprec = pytester.inline_run("-k", keyword, p)
887 passed, skipped, failed = reprec.countoutcomes()
888 dlist = reprec.getcalls("pytest_deselected")
889 assert passed + skipped + failed == 0
890 deselected_tests = dlist[0].items
891 assert len(deselected_tests) == 1
892
893 def test_no_match_directories_outside_the_suite(self, pytester: Pytester) -> None:
894 """`-k` should not match against directories containing the test suite (#7040)."""

Callers

nothing calls this directly

Calls 4

countoutcomesMethod · 0.80
getcallsMethod · 0.80
makepyfileMethod · 0.45
inline_runMethod · 0.45

Tested by

no test coverage detected