diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
commit | 2aa4a82499d4becd2284cdb482213d541b8804dd (patch) | |
tree | b80bf8bf13c3766139fbacc530efd0dd9d54394c /third_party/python/pytest/testing/test_helpconfig.py | |
parent | Initial commit. (diff) | |
download | firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.tar.xz firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.zip |
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/python/pytest/testing/test_helpconfig.py')
-rw-r--r-- | third_party/python/pytest/testing/test_helpconfig.py | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/third_party/python/pytest/testing/test_helpconfig.py b/third_party/python/pytest/testing/test_helpconfig.py new file mode 100644 index 0000000000..b5424235b1 --- /dev/null +++ b/third_party/python/pytest/testing/test_helpconfig.py @@ -0,0 +1,72 @@ +from __future__ import absolute_import, division, print_function +from _pytest.main import EXIT_NOTESTSCOLLECTED +import pytest + + +def test_version(testdir, pytestconfig): + result = testdir.runpytest("--version") + assert result.ret == 0 + # p = py.path.local(py.__file__).dirpath() + result.stderr.fnmatch_lines(["*pytest*%s*imported from*" % (pytest.__version__,)]) + if pytestconfig.pluginmanager.list_plugin_distinfo(): + result.stderr.fnmatch_lines(["*setuptools registered plugins:", "*at*"]) + + +def test_help(testdir): + result = testdir.runpytest("--help") + assert result.ret == 0 + result.stdout.fnmatch_lines( + """ + *-v*verbose* + *setup.cfg* + *minversion* + *to see*markers*pytest --markers* + *to see*fixtures*pytest --fixtures* + """ + ) + + +def test_hookvalidation_unknown(testdir): + testdir.makeconftest( + """ + def pytest_hello(xyz): + pass + """ + ) + result = testdir.runpytest() + assert result.ret != 0 + result.stdout.fnmatch_lines(["*unknown hook*pytest_hello*"]) + + +def test_hookvalidation_optional(testdir): + testdir.makeconftest( + """ + import pytest + @pytest.hookimpl(optionalhook=True) + def pytest_hello(xyz): + pass + """ + ) + result = testdir.runpytest() + assert result.ret == EXIT_NOTESTSCOLLECTED + + +def test_traceconfig(testdir): + result = testdir.runpytest("--traceconfig") + result.stdout.fnmatch_lines(["*using*pytest*py*", "*active plugins*"]) + + +def test_debug(testdir, monkeypatch): + result = testdir.runpytest_subprocess("--debug") + assert result.ret == EXIT_NOTESTSCOLLECTED + p = testdir.tmpdir.join("pytestdebug.log") + assert "pytest_sessionstart" in p.read() + + +def test_PYTEST_DEBUG(testdir, monkeypatch): + monkeypatch.setenv("PYTEST_DEBUG", "1") + result = testdir.runpytest_subprocess() + assert result.ret == EXIT_NOTESTSCOLLECTED + result.stderr.fnmatch_lines( + ["*pytest_plugin_registered*", "*manager*PluginManager*"] + ) |