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_modimport.py | |
parent | Initial commit. (diff) | |
download | firefox-upstream.tar.xz firefox-upstream.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_modimport.py')
-rw-r--r-- | third_party/python/pytest/testing/test_modimport.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/third_party/python/pytest/testing/test_modimport.py b/third_party/python/pytest/testing/test_modimport.py new file mode 100644 index 0000000000..f7b92a0b6f --- /dev/null +++ b/third_party/python/pytest/testing/test_modimport.py @@ -0,0 +1,29 @@ +import py +import subprocess +import sys +import pytest +import _pytest + +MODSET = [ + x + for x in py.path.local(_pytest.__file__).dirpath().visit("*.py") + if x.purebasename != "__init__" +] + + +@pytest.mark.parametrize("modfile", MODSET, ids=lambda x: x.purebasename) +def test_fileimport(modfile): + # this test ensures all internal packages can import + # without needing the pytest namespace being set + # this is critical for the initialization of xdist + + res = subprocess.call( + [ + sys.executable, + "-c", + "import sys, py; py.path.local(sys.argv[1]).pyimport()", + modfile.strpath, + ] + ) + if res: + pytest.fail("command result %s" % res) |