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

Function test_config_blocked_default_plugins

testing/test_config.py:1830–1864  ·  view source on GitHub ↗
(pytester: Pytester, plugin: str)

Source from the content-addressed store, hash-verified

1828 ],
1829)
1830def test_config_blocked_default_plugins(pytester: Pytester, plugin: str) -> None:
1831 if plugin == "debugging":
1832 # Fixed in xdist (after 1.27.0).
1833 # https://github.com/pytest-dev/pytest-xdist/pull/422
1834 try:
1835 import xdist # noqa: F401
1836 except ImportError:
1837 pass
1838 else:
1839 pytest.skip("does not work with xdist currently")
1840
1841 p = pytester.makepyfile("def test(): pass")
1842 result = pytester.runpytest(str(p), "-pno:%s" % plugin)
1843
1844 if plugin == "python":
1845 assert result.ret == ExitCode.USAGE_ERROR
1846 result.stderr.fnmatch_lines(
1847 [
1848 "ERROR: not found: */test_config_blocked_default_plugins.py",
1849 "(no name '*/test_config_blocked_default_plugins.py' in any of [])",
1850 ]
1851 )
1852 return
1853
1854 assert result.ret == ExitCode.OK
1855 if plugin != "terminal":
1856 result.stdout.fnmatch_lines(["* 1 passed in *"])
1857
1858 p = pytester.makepyfile("def test(): assert 0")
1859 result = pytester.runpytest(str(p), "-pno:%s" % plugin)
1860 assert result.ret == ExitCode.TESTS_FAILED
1861 if plugin != "terminal":
1862 result.stdout.fnmatch_lines(["* 1 failed in *"])
1863 else:
1864 assert result.stdout.lines == []
1865
1866
1867class TestSetupCfg:

Callers

nothing calls this directly

Calls 3

fnmatch_linesMethod · 0.80
makepyfileMethod · 0.45
runpytestMethod · 0.45

Tested by

no test coverage detected