-
-
Notifications
You must be signed in to change notification settings - Fork 438
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
6.3.3: pytest is failing with INTERNALERROR #1373
Comments
It looks like coverage can't find a place to write a .pth file. Are none of the directories in sys.path writable? |
Just found new 6.4 version and tested that using strace + PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ strace -fe trace=file /usr/bin/pytest -ra
execve("/usr/bin/pytest", ["/usr/bin/pytest", "-ra"], 0x7fff733e6328 /* 73 vars */) = 0
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4-2.fc35.x86_64/usr/lib64/glibc-hwcaps/x86-64-v4/libpython3.8.so.1.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4-2.fc35.x86_64/usr/lib64/glibc-hwcaps/x86-64-v4", 0x7ffe68d2e570, 0) = -1 ENOENT (No such file or directory)
[..]
readlink("/home", 0x7ffe68d2bec0, 4096) = -1 EINVAL (Invalid argument)
readlink("/home/tkloczko", 0x7ffe68d2bec0, 4096) = -1 EINVAL (Invalid argument)
readlink("/home/tkloczko/rpmbuild", 0x7ffe68d2bec0, 4096) = -1 EINVAL (Invalid argument)
readlink("/home/tkloczko/rpmbuild/BUILD", 0x7ffe68d2bec0, 4096) = -1 EINVAL (Invalid argument)
readlink("/home/tkloczko/rpmbuild/BUILD/coveragepy-6.4", 0x7ffe68d2bec0, 4096) = -1 EINVAL (Invalid argument)
newfstatat(AT_FDCWD, "/home/tkloczko/rpmbuild/BUILD/coveragepy-6.4/tmp/tests_csv", 0x7ffe68d2d410, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/home/tkloczko/rpmbuild/BUILD/coveragepy-6.4", {st_mode=S_IFDIR|0755, st_size=702, ...}, 0) = 0
openat(AT_FDCWD, "/home/tkloczko/rpmbuild/BUILD/coveragepy-6.4", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 13
newfstatat(13, "", {st_mode=S_IFDIR|0755, st_size=702, ...}, AT_EMPTY_PATH) = 0
newfstatat(AT_FDCWD, "/usr/bin", {st_mode=S_IFDIR|0555, st_size=66524, ...}, 0) = 0
openat(AT_FDCWD, "/usr/bin", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 13
newfstatat(13, "", {st_mode=S_IFDIR|0555, st_size=66524, ...}, AT_EMPTY_PATH) = 0
newfstatat(AT_FDCWD, "/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4-2.fc35.x86_64/usr/lib64/python3.8/site-packages", {st_mode=S_IFDIR|0755, st_size=60, ...}, 0) = 0
openat(AT_FDCWD, "/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4-2.fc35.x86_64/usr/lib64/python3.8/site-packages", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 13
newfstatat(13, "", {st_mode=S_IFDIR|0755, st_size=60, ...}, AT_EMPTY_PATH) = 0
newfstatat(AT_FDCWD, "/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4-2.fc35.x86_64/usr/lib/python3.8/site-packages", 0x7ffe68d2cec0, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/usr/lib64/python38.zip", 0x7ffe68d2cec0, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/usr/lib64/python3.8", {st_mode=S_IFDIR|0755, st_size=4164, ...}, 0) = 0
openat(AT_FDCWD, "/usr/lib64/python3.8", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 13
newfstatat(13, "", {st_mode=S_IFDIR|0755, st_size=4164, ...}, AT_EMPTY_PATH) = 0
newfstatat(AT_FDCWD, "/usr/lib64/python3.8/lib-dynload", {st_mode=S_IFDIR|0755, st_size=5116, ...}, 0) = 0
openat(AT_FDCWD, "/usr/lib64/python3.8/lib-dynload", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 13
newfstatat(13, "", {st_mode=S_IFDIR|0755, st_size=5116, ...}, AT_EMPTY_PATH) = 0
newfstatat(AT_FDCWD, "/usr/lib64/python3.8/site-packages", {st_mode=S_IFDIR|0755, st_size=1184, ...}, 0) = 0
openat(AT_FDCWD, "/usr/lib64/python3.8/site-packages", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 13
newfstatat(13, "", {st_mode=S_IFDIR|0755, st_size=1184, ...}, AT_EMPTY_PATH) = 0
openat(AT_FDCWD, "/usr/lib64/python3.8/site-packages/touch_none.it", O_WRONLY|O_CREAT|O_TRUNC|O_CLOEXEC, 0666) = -1 EACCES (Permission denied)
newfstatat(AT_FDCWD, "/usr/lib/python3.8/site-packages", {st_mode=S_IFDIR|0755, st_size=5240, ...}, 0) = 0
openat(AT_FDCWD, "/usr/lib/python3.8/site-packages", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 13
newfstatat(13, "", {st_mode=S_IFDIR|0755, st_size=5240, ...}, AT_EMPTY_PATH) = 0
openat(AT_FDCWD, "/usr/lib/python3.8/site-packages/touch_none.it", O_WRONLY|O_CREAT|O_TRUNC|O_CLOEXEC, 0666) = -1 EACCES (Permission denied)
newfstatat(AT_FDCWD, "/home/tkloczko/rpmbuild/BUILD/coveragepy-6.4", {st_mode=S_IFDIR|0755, st_size=702, ...}, 0) = 0
newfstatat(AT_FDCWD, "/usr/bin", {st_mode=S_IFDIR|0555, st_size=66524, ...}, 0) = 0
newfstatat(AT_FDCWD, "/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4-2.fc35.x86_64/usr/lib64/python3.8/site-packages", {st_mode=S_IFDIR|0755, st_size=60, ...}, 0) = 0
newfstatat(AT_FDCWD, "/usr/lib64/python3.8", {st_mode=S_IFDIR|0755, st_size=4164, ...}, 0) = 0
newfstatat(AT_FDCWD, "/usr/lib64/python3.8/_sysconfigdata__linux_x86_64-linux-gnu.py", {st_mode=S_IFREG|0644, st_size=41556, ...}, 0) = 0
newfstatat(AT_FDCWD, "/usr/lib64/python3.8/_sysconfigdata__linux_x86_64-linux-gnu.py", {st_mode=S_IFREG|0644, st_size=41556, ...}, 0) = 0
openat(AT_FDCWD, "/usr/lib64/python3.8/__pycache__/_sysconfigdata__linux_x86_64-linux-gnu.cpython-38.pyc", O_RDONLY|O_CLOEXEC) = 13
newfstatat(13, "", {st_mode=S_IFREG|0644, st_size=30703, ...}, AT_EMPTY_PATH) = 0
newfstatat(13, "", {st_mode=S_IFREG|0644, st_size=30703, ...}, AT_EMPTY_PATH) = 0
newfstatat(AT_FDCWD, "/usr", {st_mode=S_IFDIR|0755, st_size=106, ...}, AT_SYMLINK_NOFOLLOW) = 0
newfstatat(AT_FDCWD, "/usr/lib64", {st_mode=S_IFDIR|0555, st_size=163562, ...}, AT_SYMLINK_NOFOLLOW) = 0
newfstatat(AT_FDCWD, "/usr/lib64/python3.8", {st_mode=S_IFDIR|0755, st_size=4164, ...}, AT_SYMLINK_NOFOLLOW) = 0
newfstatat(AT_FDCWD, "/usr/lib64/python3.8/config-3.8-x86_64-linux-gnu", {st_mode=S_IFDIR|0755, st_size=194, ...}, AT_SYMLINK_NOFOLLOW) = 0
openat(AT_FDCWD, "/usr/lib/python3.8/site-packages/touch_none.it", O_WRONLY|O_CREAT|O_TRUNC|O_CLOEXEC, 0666) = -1 EACCES (Permission denied)
newfstatat(AT_FDCWD, "/usr/lib/python3.8/site-packages/_pytest/main.py", {st_mode=S_IFREG|0644, st_size=32281, ...}, 0) = 0
openat(AT_FDCWD, "/usr/lib/python3.8/site-packages/_pytest/main.py", O_RDONLY|O_CLOEXEC) = 13
newfstatat(13, "", {st_mode=S_IFREG|0644, st_size=32281, ...}, AT_EMPTY_PATH) = 0
newfstatat(AT_FDCWD, "/usr/lib/python3.8/site-packages/pluggy/_hooks.py", {st_mode=S_IFREG|0644, st_size=11496, ...}, 0) = 0
openat(AT_FDCWD, "/usr/lib/python3.8/site-packages/pluggy/_hooks.py", O_RDONLY|O_CLOEXEC) = 13
newfstatat(13, "", {st_mode=S_IFREG|0644, st_size=11496, ...}, AT_EMPTY_PATH) = 0
newfstatat(AT_FDCWD, "/usr/lib/python3.8/site-packages/pluggy/_manager.py", {st_mode=S_IFREG|0644, st_size=14752, ...}, 0) = 0
openat(AT_FDCWD, "/usr/lib/python3.8/site-packages/pluggy/_manager.py", O_RDONLY|O_CLOEXEC) = 13
newfstatat(13, "", {st_mode=S_IFREG|0644, st_size=14752, ...}, AT_EMPTY_PATH) = 0
newfstatat(AT_FDCWD, "/usr/lib/python3.8/site-packages/pluggy/_callers.py", {st_mode=S_IFREG|0644, st_size=2097, ...}, 0) = 0
openat(AT_FDCWD, "/usr/lib/python3.8/site-packages/pluggy/_callers.py", O_RDONLY|O_CLOEXEC) = 13
newfstatat(13, "", {st_mode=S_IFREG|0644, st_size=2097, ...}, AT_EMPTY_PATH) = 0
newfstatat(AT_FDCWD, "/usr/lib/python3.8/site-packages/pluggy/_result.py", {st_mode=S_IFREG|0644, st_size=1535, ...}, 0) = 0
openat(AT_FDCWD, "/usr/lib/python3.8/site-packages/pluggy/_result.py", O_RDONLY|O_CLOEXEC) = 13
newfstatat(13, "", {st_mode=S_IFREG|0644, st_size=1535, ...}, AT_EMPTY_PATH) = 0
newfstatat(AT_FDCWD, "/home/tkloczko/rpmbuild/BUILD/coveragepy-6.4/tests/conftest.py", {st_mode=S_IFREG|0644, st_size=4480, ...}, 0) = 0
openat(AT_FDCWD, "/home/tkloczko/rpmbuild/BUILD/coveragepy-6.4/tests/conftest.py", O_RDONLY|O_CLOEXEC) = 13
newfstatat(13, "", {st_mode=S_IFREG|0644, st_size=4480, ...}, AT_EMPTY_PATH) = 0
newfstatat(6, "", {st_mode=S_IFREG|0600, st_size=0, ...}, AT_EMPTY_PATH) = 0
newfstatat(8, "", {st_mode=S_IFREG|0600, st_size=0, ...}, AT_EMPTY_PATH) = 0
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR> File "/usr/lib/python3.8/site-packages/_pytest/main.py", line 266, in wrap_session
INTERNALERROR> config.hook.pytest_sessionstart(session=session)
INTERNALERROR> File "/usr/lib/python3.8/site-packages/pluggy/_hooks.py", line 265, in __call__
INTERNALERROR> return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
INTERNALERROR> File "/usr/lib/python3.8/site-packages/pluggy/_manager.py", line 80, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR> File "/usr/lib/python3.8/site-packages/pluggy/_callers.py", line 60, in _multicall
INTERNALERROR> return outcome.get_result()
INTERNALERROR> File "/usr/lib/python3.8/site-packages/pluggy/_result.py", line 60, in get_result
INTERNALERROR> raise ex[1].with_traceback(ex[2])
INTERNALERROR> File "/usr/lib/python3.8/site-packages/pluggy/_callers.py", line 39, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> File "/home/tkloczko/rpmbuild/BUILD/coveragepy-6.4/tests/conftest.py", line 89, in pytest_sessionstart
INTERNALERROR> assert pth_dir
INTERNALERROR> AssertionError: assert None
chdir("/home/tkloczko/rpmbuild/BUILD/coveragepy-6.4") = 0
+++ exited with 3 +++ Question is why in this case pytest executed from non-root account is trying to write something in system image? 🤔 openat(AT_FDCWD, "/usr/lib64/python3.8/site-packages/touch_none.it", O_WRONLY|O_CREAT|O_TRUNC|O_CLOEXEC, 0666) = -1 EACCES (Permission denied)
openat(AT_FDCWD, "/usr/lib/python3.8/site-packages/touch_none.it", O_WRONLY|O_CREAT|O_TRUNC|O_CLOEXEC, 0666) = -1 EACCES (Permission denied)
openat(AT_FDCWD, "/usr/lib/python3.8/site-packages/touch_none.it", O_WRONLY|O_CREAT|O_TRUNC|O_CLOEXEC, 0666) = -1 EACCES (Permission denied) I have already +940 modules packaged as rpm packages and in 8/9 of those packaging procedures as part pf the packaging procedures pytest is used and cannot find in the logs similar case 🤔 |
Hmm just tested .. [tkloczko@devel-g2v coveragepy-6.4]$ grep -r touch_none
[tkloczko@devel-g2v coveragepy-6.4]$ grep -r touch_none /usr/lib/python3.8/site-packages/ /usr/lib64/python3.8/
[tkloczko@devel-g2v coveragepy-6.4]$ |
Any update? |
"touch_none.it" is a file name I try to write to see if I can write a .pth file that is needed to run all the coverage.py tests. Can you print the contents of sys.path, and also the "ls -l" for each of those directories? As a drastic step, I suppose the coverage.py test suite could skip tests that need the .pth file if it couldn't be written. |
OK .. but which one directories? 😋 + PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.3.3-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.3.3-2.fc35.x86_64/usr/lib/python3.8/site-packages
Issue is that in this case pytest is failing on collecting units 😃 |
I'm interested in the sys.path that coverage.py is using, so including the environment variable. Can you add some print statements to the code to see what directories it's considering, and what files are in them? If we need to skip tests, we'd do it by changing the failure to a flag, and use the flag to skip. But it would be better to find a new place for the .pth file. |
Just tesated 6.4.2. Looks like it is better now becaus pytest is able to collect unit ad start testing. + PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4.2-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra
bringing up nodes...
.......................................................................................................................................s.x.....s..............x...... [ 14%]
.s..............................................................................................................................................Fs.F.s...s.......... [ 28%]
.sF...s...FF....ss.s...s..s...........................................................F..........................F.................................................. [ 42%]
..........................................................................F.........................................................................s............... [ 56%]
...........................................................s.s....s...................s...........................s...s.....s...............................s....... [ 70%]
..................................s........................F............F...........F.............FF..F..F.....F.F..F...F............FF....................F........ [ 84%]
...............................F.....................................F.................s.E........E.........E....EF..F.E.....E...........E....E.E...E..E...E......... [ 98%]
.......F...... [100%]
================================================================================== ERRORS ==================================================================================
______________________________________________ ERROR at setup of VirtualenvTest.test_third_party_venv_isnt_measured[coverage] ______________________________________________
[gw25] linux -- Python 3.8.13 /usr/bin/python3
tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-311/popen-gw25'), _trace=<pluggy._tracing.TagTracerSub object at 0x7f111a459f70>, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-311/popen-gw25'))
@pytest.fixture(scope="session", name="venv_world")
def venv_world_fixture(tmp_path_factory):
"""Create a virtualenv with a few test packages for VirtualenvTest to use.
Returns the directory containing the "venv" virtualenv.
"""
venv_world = tmp_path_factory.mktemp("venv_world")
with change_dir(venv_world):
# Create a virtualenv.
run_command("python -m venv venv")
# A third-party package that installs a few different packages.
make_file("third_pkg/third/__init__.py", """\
import fourth
def third(x):
return 3 * x
""")
# Use plugin2.py as third.plugin
with open(os.path.join(os.path.dirname(__file__), "plugin2.py")) as f:
make_file("third_pkg/third/plugin.py", f.read())
# A render function for plugin2 to use for dynamic file names.
make_file("third_pkg/third/render.py", """\
def render(filename, linenum):
return "HTML: {}@{}".format(filename, linenum)
""")
# Another package that third can use.
make_file("third_pkg/fourth/__init__.py", """\
def fourth(x):
return 4 * x
""")
# Some namespace packages.
make_file("third_pkg/nspkg/fifth/__init__.py", """\
def fifth(x):
return 5 * x
""")
# The setup.py to install everything.
make_file("third_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="third",
packages=["third", "fourth", "nspkg.fifth"],
)
""")
# Some namespace packages.
make_file("another_pkg/nspkg/sixth/__init__.py", """\
def sixth(x):
return 6 * x
""")
make_file("another_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="another",
packages=["nspkg.sixth"],
)
""")
# Bug888 code.
make_file("bug888/app/setup.py", """\
from setuptools import setup
setup(
name='testcov',
packages=['testcov'],
namespace_packages=['testcov'],
)
""")
make_file("bug888/app/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/app/testcov/main.py", """\
import pkg_resources
for entry_point in pkg_resources.iter_entry_points('plugins'):
entry_point.load()()
""")
make_file("bug888/plugin/setup.py", """\
from setuptools import setup
setup(
name='testcov-plugin',
packages=['testcov'],
namespace_packages=['testcov'],
entry_points={'plugins': ['testp = testcov.plugin:testp']},
)
""")
make_file("bug888/plugin/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/plugin/testcov/plugin.py", """\
def testp():
print("Plugin here")
""")
# Install everything.
> run_in_venv(
"python -m pip install --no-index " +
"./third_pkg " +
"-e ./another_pkg " +
"-e ./bug888/app -e ./bug888/plugin " +
COVERAGE_INSTALL_ARGS
)
tests/test_venv.py:141:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cmd = 'python -m pip install --no-index ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-6.4.2'
def run_in_venv(cmd):
r"""Run `cmd` in the virtualenv at `venv`.
The first word of the command will be adjusted to run it from the
venv/bin or venv\Scripts directory.
Returns the text output of the command.
"""
words = cmd.split()
if env.WINDOWS:
words[0] = fr"venv\Scripts\{words[0]}.exe"
else:
words[0] = fr"venv/bin/{words[0]}"
status, output = run_command(" ".join(words))
# Print the output so if it fails, we can tell what happened.
print(output)
> assert status == 0
E assert 127 == 0
tests/test_venv.py:36: AssertionError
-------------------------------------------------------------------------- Captured stdout setup ---------------------------------------------------------------------------
/bin/sh: line 1: venv/bin/python: No such file or directory
_________________________________________ ERROR at setup of VirtualenvTest.test_third_party_venv_isnt_measured[python -m coverage] _________________________________________
[gw25] linux -- Python 3.8.13 /usr/bin/python3
tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-311/popen-gw25'), _trace=<pluggy._tracing.TagTracerSub object at 0x7f111a459f70>, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-311/popen-gw25'))
@pytest.fixture(scope="session", name="venv_world")
def venv_world_fixture(tmp_path_factory):
"""Create a virtualenv with a few test packages for VirtualenvTest to use.
Returns the directory containing the "venv" virtualenv.
"""
venv_world = tmp_path_factory.mktemp("venv_world")
with change_dir(venv_world):
# Create a virtualenv.
run_command("python -m venv venv")
# A third-party package that installs a few different packages.
make_file("third_pkg/third/__init__.py", """\
import fourth
def third(x):
return 3 * x
""")
# Use plugin2.py as third.plugin
with open(os.path.join(os.path.dirname(__file__), "plugin2.py")) as f:
make_file("third_pkg/third/plugin.py", f.read())
# A render function for plugin2 to use for dynamic file names.
make_file("third_pkg/third/render.py", """\
def render(filename, linenum):
return "HTML: {}@{}".format(filename, linenum)
""")
# Another package that third can use.
make_file("third_pkg/fourth/__init__.py", """\
def fourth(x):
return 4 * x
""")
# Some namespace packages.
make_file("third_pkg/nspkg/fifth/__init__.py", """\
def fifth(x):
return 5 * x
""")
# The setup.py to install everything.
make_file("third_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="third",
packages=["third", "fourth", "nspkg.fifth"],
)
""")
# Some namespace packages.
make_file("another_pkg/nspkg/sixth/__init__.py", """\
def sixth(x):
return 6 * x
""")
make_file("another_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="another",
packages=["nspkg.sixth"],
)
""")
# Bug888 code.
make_file("bug888/app/setup.py", """\
from setuptools import setup
setup(
name='testcov',
packages=['testcov'],
namespace_packages=['testcov'],
)
""")
make_file("bug888/app/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/app/testcov/main.py", """\
import pkg_resources
for entry_point in pkg_resources.iter_entry_points('plugins'):
entry_point.load()()
""")
make_file("bug888/plugin/setup.py", """\
from setuptools import setup
setup(
name='testcov-plugin',
packages=['testcov'],
namespace_packages=['testcov'],
entry_points={'plugins': ['testp = testcov.plugin:testp']},
)
""")
make_file("bug888/plugin/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/plugin/testcov/plugin.py", """\
def testp():
print("Plugin here")
""")
# Install everything.
> run_in_venv(
"python -m pip install --no-index " +
"./third_pkg " +
"-e ./another_pkg " +
"-e ./bug888/app -e ./bug888/plugin " +
COVERAGE_INSTALL_ARGS
)
tests/test_venv.py:141:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cmd = 'python -m pip install --no-index ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-6.4.2'
def run_in_venv(cmd):
r"""Run `cmd` in the virtualenv at `venv`.
The first word of the command will be adjusted to run it from the
venv/bin or venv\Scripts directory.
Returns the text output of the command.
"""
words = cmd.split()
if env.WINDOWS:
words[0] = fr"venv\Scripts\{words[0]}.exe"
else:
words[0] = fr"venv/bin/{words[0]}"
status, output = run_command(" ".join(words))
# Print the output so if it fails, we can tell what happened.
print(output)
> assert status == 0
E assert 127 == 0
tests/test_venv.py:36: AssertionError
_________________________________________________ ERROR at setup of VirtualenvTest.test_us_in_venv_isnt_measured[coverage] _________________________________________________
[gw25] linux -- Python 3.8.13 /usr/bin/python3
tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-311/popen-gw25'), _trace=<pluggy._tracing.TagTracerSub object at 0x7f111a459f70>, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-311/popen-gw25'))
@pytest.fixture(scope="session", name="venv_world")
def venv_world_fixture(tmp_path_factory):
"""Create a virtualenv with a few test packages for VirtualenvTest to use.
Returns the directory containing the "venv" virtualenv.
"""
venv_world = tmp_path_factory.mktemp("venv_world")
with change_dir(venv_world):
# Create a virtualenv.
run_command("python -m venv venv")
# A third-party package that installs a few different packages.
make_file("third_pkg/third/__init__.py", """\
import fourth
def third(x):
return 3 * x
""")
# Use plugin2.py as third.plugin
with open(os.path.join(os.path.dirname(__file__), "plugin2.py")) as f:
make_file("third_pkg/third/plugin.py", f.read())
# A render function for plugin2 to use for dynamic file names.
make_file("third_pkg/third/render.py", """\
def render(filename, linenum):
return "HTML: {}@{}".format(filename, linenum)
""")
# Another package that third can use.
make_file("third_pkg/fourth/__init__.py", """\
def fourth(x):
return 4 * x
""")
# Some namespace packages.
make_file("third_pkg/nspkg/fifth/__init__.py", """\
def fifth(x):
return 5 * x
""")
# The setup.py to install everything.
make_file("third_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="third",
packages=["third", "fourth", "nspkg.fifth"],
)
""")
# Some namespace packages.
make_file("another_pkg/nspkg/sixth/__init__.py", """\
def sixth(x):
return 6 * x
""")
make_file("another_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="another",
packages=["nspkg.sixth"],
)
""")
# Bug888 code.
make_file("bug888/app/setup.py", """\
from setuptools import setup
setup(
name='testcov',
packages=['testcov'],
namespace_packages=['testcov'],
)
""")
make_file("bug888/app/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/app/testcov/main.py", """\
import pkg_resources
for entry_point in pkg_resources.iter_entry_points('plugins'):
entry_point.load()()
""")
make_file("bug888/plugin/setup.py", """\
from setuptools import setup
setup(
name='testcov-plugin',
packages=['testcov'],
namespace_packages=['testcov'],
entry_points={'plugins': ['testp = testcov.plugin:testp']},
)
""")
make_file("bug888/plugin/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/plugin/testcov/plugin.py", """\
def testp():
print("Plugin here")
""")
# Install everything.
> run_in_venv(
"python -m pip install --no-index " +
"./third_pkg " +
"-e ./another_pkg " +
"-e ./bug888/app -e ./bug888/plugin " +
COVERAGE_INSTALL_ARGS
)
tests/test_venv.py:141:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cmd = 'python -m pip install --no-index ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-6.4.2'
def run_in_venv(cmd):
r"""Run `cmd` in the virtualenv at `venv`.
The first word of the command will be adjusted to run it from the
venv/bin or venv\Scripts directory.
Returns the text output of the command.
"""
words = cmd.split()
if env.WINDOWS:
words[0] = fr"venv\Scripts\{words[0]}.exe"
else:
words[0] = fr"venv/bin/{words[0]}"
status, output = run_command(" ".join(words))
# Print the output so if it fails, we can tell what happened.
print(output)
> assert status == 0
E assert 127 == 0
tests/test_venv.py:36: AssertionError
____________________________________________ ERROR at setup of VirtualenvTest.test_us_in_venv_isnt_measured[python -m coverage] ____________________________________________
[gw25] linux -- Python 3.8.13 /usr/bin/python3
tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-311/popen-gw25'), _trace=<pluggy._tracing.TagTracerSub object at 0x7f111a459f70>, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-311/popen-gw25'))
@pytest.fixture(scope="session", name="venv_world")
def venv_world_fixture(tmp_path_factory):
"""Create a virtualenv with a few test packages for VirtualenvTest to use.
Returns the directory containing the "venv" virtualenv.
"""
venv_world = tmp_path_factory.mktemp("venv_world")
with change_dir(venv_world):
# Create a virtualenv.
run_command("python -m venv venv")
# A third-party package that installs a few different packages.
make_file("third_pkg/third/__init__.py", """\
import fourth
def third(x):
return 3 * x
""")
# Use plugin2.py as third.plugin
with open(os.path.join(os.path.dirname(__file__), "plugin2.py")) as f:
make_file("third_pkg/third/plugin.py", f.read())
# A render function for plugin2 to use for dynamic file names.
make_file("third_pkg/third/render.py", """\
def render(filename, linenum):
return "HTML: {}@{}".format(filename, linenum)
""")
# Another package that third can use.
make_file("third_pkg/fourth/__init__.py", """\
def fourth(x):
return 4 * x
""")
# Some namespace packages.
make_file("third_pkg/nspkg/fifth/__init__.py", """\
def fifth(x):
return 5 * x
""")
# The setup.py to install everything.
make_file("third_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="third",
packages=["third", "fourth", "nspkg.fifth"],
)
""")
# Some namespace packages.
make_file("another_pkg/nspkg/sixth/__init__.py", """\
def sixth(x):
return 6 * x
""")
make_file("another_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="another",
packages=["nspkg.sixth"],
)
""")
# Bug888 code.
make_file("bug888/app/setup.py", """\
from setuptools import setup
setup(
name='testcov',
packages=['testcov'],
namespace_packages=['testcov'],
)
""")
make_file("bug888/app/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/app/testcov/main.py", """\
import pkg_resources
for entry_point in pkg_resources.iter_entry_points('plugins'):
entry_point.load()()
""")
make_file("bug888/plugin/setup.py", """\
from setuptools import setup
setup(
name='testcov-plugin',
packages=['testcov'],
namespace_packages=['testcov'],
entry_points={'plugins': ['testp = testcov.plugin:testp']},
)
""")
make_file("bug888/plugin/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/plugin/testcov/plugin.py", """\
def testp():
print("Plugin here")
""")
# Install everything.
> run_in_venv(
"python -m pip install --no-index " +
"./third_pkg " +
"-e ./another_pkg " +
"-e ./bug888/app -e ./bug888/plugin " +
COVERAGE_INSTALL_ARGS
)
tests/test_venv.py:141:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cmd = 'python -m pip install --no-index ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-6.4.2'
def run_in_venv(cmd):
r"""Run `cmd` in the virtualenv at `venv`.
The first word of the command will be adjusted to run it from the
venv/bin or venv\Scripts directory.
Returns the text output of the command.
"""
words = cmd.split()
if env.WINDOWS:
words[0] = fr"venv\Scripts\{words[0]}.exe"
else:
words[0] = fr"venv/bin/{words[0]}"
status, output = run_command(" ".join(words))
# Print the output so if it fails, we can tell what happened.
print(output)
> assert status == 0
E assert 127 == 0
tests/test_venv.py:36: AssertionError
____________________________________________________ ERROR at setup of VirtualenvTest.test_venv_isnt_measured[coverage] ____________________________________________________
[gw25] linux -- Python 3.8.13 /usr/bin/python3
tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-311/popen-gw25'), _trace=<pluggy._tracing.TagTracerSub object at 0x7f111a459f70>, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-311/popen-gw25'))
@pytest.fixture(scope="session", name="venv_world")
def venv_world_fixture(tmp_path_factory):
"""Create a virtualenv with a few test packages for VirtualenvTest to use.
Returns the directory containing the "venv" virtualenv.
"""
venv_world = tmp_path_factory.mktemp("venv_world")
with change_dir(venv_world):
# Create a virtualenv.
run_command("python -m venv venv")
# A third-party package that installs a few different packages.
make_file("third_pkg/third/__init__.py", """\
import fourth
def third(x):
return 3 * x
""")
# Use plugin2.py as third.plugin
with open(os.path.join(os.path.dirname(__file__), "plugin2.py")) as f:
make_file("third_pkg/third/plugin.py", f.read())
# A render function for plugin2 to use for dynamic file names.
make_file("third_pkg/third/render.py", """\
def render(filename, linenum):
return "HTML: {}@{}".format(filename, linenum)
""")
# Another package that third can use.
make_file("third_pkg/fourth/__init__.py", """\
def fourth(x):
return 4 * x
""")
# Some namespace packages.
make_file("third_pkg/nspkg/fifth/__init__.py", """\
def fifth(x):
return 5 * x
""")
# The setup.py to install everything.
make_file("third_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="third",
packages=["third", "fourth", "nspkg.fifth"],
)
""")
# Some namespace packages.
make_file("another_pkg/nspkg/sixth/__init__.py", """\
def sixth(x):
return 6 * x
""")
make_file("another_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="another",
packages=["nspkg.sixth"],
)
""")
# Bug888 code.
make_file("bug888/app/setup.py", """\
from setuptools import setup
setup(
name='testcov',
packages=['testcov'],
namespace_packages=['testcov'],
)
""")
make_file("bug888/app/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/app/testcov/main.py", """\
import pkg_resources
for entry_point in pkg_resources.iter_entry_points('plugins'):
entry_point.load()()
""")
make_file("bug888/plugin/setup.py", """\
from setuptools import setup
setup(
name='testcov-plugin',
packages=['testcov'],
namespace_packages=['testcov'],
entry_points={'plugins': ['testp = testcov.plugin:testp']},
)
""")
make_file("bug888/plugin/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/plugin/testcov/plugin.py", """\
def testp():
print("Plugin here")
""")
# Install everything.
> run_in_venv(
"python -m pip install --no-index " +
"./third_pkg " +
"-e ./another_pkg " +
"-e ./bug888/app -e ./bug888/plugin " +
COVERAGE_INSTALL_ARGS
)
tests/test_venv.py:141:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cmd = 'python -m pip install --no-index ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-6.4.2'
def run_in_venv(cmd):
r"""Run `cmd` in the virtualenv at `venv`.
The first word of the command will be adjusted to run it from the
venv/bin or venv\Scripts directory.
Returns the text output of the command.
"""
words = cmd.split()
if env.WINDOWS:
words[0] = fr"venv\Scripts\{words[0]}.exe"
else:
words[0] = fr"venv/bin/{words[0]}"
status, output = run_command(" ".join(words))
# Print the output so if it fails, we can tell what happened.
print(output)
> assert status == 0
E assert 127 == 0
tests/test_venv.py:36: AssertionError
_______________________________________________ ERROR at setup of VirtualenvTest.test_venv_isnt_measured[python -m coverage] _______________________________________________
[gw25] linux -- Python 3.8.13 /usr/bin/python3
tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-311/popen-gw25'), _trace=<pluggy._tracing.TagTracerSub object at 0x7f111a459f70>, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-311/popen-gw25'))
@pytest.fixture(scope="session", name="venv_world")
def venv_world_fixture(tmp_path_factory):
"""Create a virtualenv with a few test packages for VirtualenvTest to use.
Returns the directory containing the "venv" virtualenv.
"""
venv_world = tmp_path_factory.mktemp("venv_world")
with change_dir(venv_world):
# Create a virtualenv.
run_command("python -m venv venv")
# A third-party package that installs a few different packages.
make_file("third_pkg/third/__init__.py", """\
import fourth
def third(x):
return 3 * x
""")
# Use plugin2.py as third.plugin
with open(os.path.join(os.path.dirname(__file__), "plugin2.py")) as f:
make_file("third_pkg/third/plugin.py", f.read())
# A render function for plugin2 to use for dynamic file names.
make_file("third_pkg/third/render.py", """\
def render(filename, linenum):
return "HTML: {}@{}".format(filename, linenum)
""")
# Another package that third can use.
make_file("third_pkg/fourth/__init__.py", """\
def fourth(x):
return 4 * x
""")
# Some namespace packages.
make_file("third_pkg/nspkg/fifth/__init__.py", """\
def fifth(x):
return 5 * x
""")
# The setup.py to install everything.
make_file("third_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="third",
packages=["third", "fourth", "nspkg.fifth"],
)
""")
# Some namespace packages.
make_file("another_pkg/nspkg/sixth/__init__.py", """\
def sixth(x):
return 6 * x
""")
make_file("another_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="another",
packages=["nspkg.sixth"],
)
""")
# Bug888 code.
make_file("bug888/app/setup.py", """\
from setuptools import setup
setup(
name='testcov',
packages=['testcov'],
namespace_packages=['testcov'],
)
""")
make_file("bug888/app/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/app/testcov/main.py", """\
import pkg_resources
for entry_point in pkg_resources.iter_entry_points('plugins'):
entry_point.load()()
""")
make_file("bug888/plugin/setup.py", """\
from setuptools import setup
setup(
name='testcov-plugin',
packages=['testcov'],
namespace_packages=['testcov'],
entry_points={'plugins': ['testp = testcov.plugin:testp']},
)
""")
make_file("bug888/plugin/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/plugin/testcov/plugin.py", """\
def testp():
print("Plugin here")
""")
# Install everything.
> run_in_venv(
"python -m pip install --no-index " +
"./third_pkg " +
"-e ./another_pkg " +
"-e ./bug888/app -e ./bug888/plugin " +
COVERAGE_INSTALL_ARGS
)
tests/test_venv.py:141:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cmd = 'python -m pip install --no-index ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-6.4.2'
def run_in_venv(cmd):
r"""Run `cmd` in the virtualenv at `venv`.
The first word of the command will be adjusted to run it from the
venv/bin or venv\Scripts directory.
Returns the text output of the command.
"""
words = cmd.split()
if env.WINDOWS:
words[0] = fr"venv\Scripts\{words[0]}.exe"
else:
words[0] = fr"venv/bin/{words[0]}"
status, output = run_command(" ".join(words))
# Print the output so if it fails, we can tell what happened.
print(output)
> assert status == 0
E assert 127 == 0
tests/test_venv.py:36: AssertionError
_________________________________________________ ERROR at setup of VirtualenvTest.test_venv_with_dynamic_plugin[coverage] _________________________________________________
[gw25] linux -- Python 3.8.13 /usr/bin/python3
tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-311/popen-gw25'), _trace=<pluggy._tracing.TagTracerSub object at 0x7f111a459f70>, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-311/popen-gw25'))
@pytest.fixture(scope="session", name="venv_world")
def venv_world_fixture(tmp_path_factory):
"""Create a virtualenv with a few test packages for VirtualenvTest to use.
Returns the directory containing the "venv" virtualenv.
"""
venv_world = tmp_path_factory.mktemp("venv_world")
with change_dir(venv_world):
# Create a virtualenv.
run_command("python -m venv venv")
# A third-party package that installs a few different packages.
make_file("third_pkg/third/__init__.py", """\
import fourth
def third(x):
return 3 * x
""")
# Use plugin2.py as third.plugin
with open(os.path.join(os.path.dirname(__file__), "plugin2.py")) as f:
make_file("third_pkg/third/plugin.py", f.read())
# A render function for plugin2 to use for dynamic file names.
make_file("third_pkg/third/render.py", """\
def render(filename, linenum):
return "HTML: {}@{}".format(filename, linenum)
""")
# Another package that third can use.
make_file("third_pkg/fourth/__init__.py", """\
def fourth(x):
return 4 * x
""")
# Some namespace packages.
make_file("third_pkg/nspkg/fifth/__init__.py", """\
def fifth(x):
return 5 * x
""")
# The setup.py to install everything.
make_file("third_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="third",
packages=["third", "fourth", "nspkg.fifth"],
)
""")
# Some namespace packages.
make_file("another_pkg/nspkg/sixth/__init__.py", """\
def sixth(x):
return 6 * x
""")
make_file("another_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="another",
packages=["nspkg.sixth"],
)
""")
# Bug888 code.
make_file("bug888/app/setup.py", """\
from setuptools import setup
setup(
name='testcov',
packages=['testcov'],
namespace_packages=['testcov'],
)
""")
make_file("bug888/app/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/app/testcov/main.py", """\
import pkg_resources
for entry_point in pkg_resources.iter_entry_points('plugins'):
entry_point.load()()
""")
make_file("bug888/plugin/setup.py", """\
from setuptools import setup
setup(
name='testcov-plugin',
packages=['testcov'],
namespace_packages=['testcov'],
entry_points={'plugins': ['testp = testcov.plugin:testp']},
)
""")
make_file("bug888/plugin/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/plugin/testcov/plugin.py", """\
def testp():
print("Plugin here")
""")
# Install everything.
> run_in_venv(
"python -m pip install --no-index " +
"./third_pkg " +
"-e ./another_pkg " +
"-e ./bug888/app -e ./bug888/plugin " +
COVERAGE_INSTALL_ARGS
)
tests/test_venv.py:141:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cmd = 'python -m pip install --no-index ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-6.4.2'
def run_in_venv(cmd):
r"""Run `cmd` in the virtualenv at `venv`.
The first word of the command will be adjusted to run it from the
venv/bin or venv\Scripts directory.
Returns the text output of the command.
"""
words = cmd.split()
if env.WINDOWS:
words[0] = fr"venv\Scripts\{words[0]}.exe"
else:
words[0] = fr"venv/bin/{words[0]}"
status, output = run_command(" ".join(words))
# Print the output so if it fails, we can tell what happened.
print(output)
> assert status == 0
E assert 127 == 0
tests/test_venv.py:36: AssertionError
____________________________________________ ERROR at setup of VirtualenvTest.test_venv_with_dynamic_plugin[python -m coverage] ____________________________________________
[gw25] linux -- Python 3.8.13 /usr/bin/python3
tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-311/popen-gw25'), _trace=<pluggy._tracing.TagTracerSub object at 0x7f111a459f70>, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-311/popen-gw25'))
@pytest.fixture(scope="session", name="venv_world")
def venv_world_fixture(tmp_path_factory):
"""Create a virtualenv with a few test packages for VirtualenvTest to use.
Returns the directory containing the "venv" virtualenv.
"""
venv_world = tmp_path_factory.mktemp("venv_world")
with change_dir(venv_world):
# Create a virtualenv.
run_command("python -m venv venv")
# A third-party package that installs a few different packages.
make_file("third_pkg/third/__init__.py", """\
import fourth
def third(x):
return 3 * x
""")
# Use plugin2.py as third.plugin
with open(os.path.join(os.path.dirname(__file__), "plugin2.py")) as f:
make_file("third_pkg/third/plugin.py", f.read())
# A render function for plugin2 to use for dynamic file names.
make_file("third_pkg/third/render.py", """\
def render(filename, linenum):
return "HTML: {}@{}".format(filename, linenum)
""")
# Another package that third can use.
make_file("third_pkg/fourth/__init__.py", """\
def fourth(x):
return 4 * x
""")
# Some namespace packages.
make_file("third_pkg/nspkg/fifth/__init__.py", """\
def fifth(x):
return 5 * x
""")
# The setup.py to install everything.
make_file("third_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="third",
packages=["third", "fourth", "nspkg.fifth"],
)
""")
# Some namespace packages.
make_file("another_pkg/nspkg/sixth/__init__.py", """\
def sixth(x):
return 6 * x
""")
make_file("another_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="another",
packages=["nspkg.sixth"],
)
""")
# Bug888 code.
make_file("bug888/app/setup.py", """\
from setuptools import setup
setup(
name='testcov',
packages=['testcov'],
namespace_packages=['testcov'],
)
""")
make_file("bug888/app/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/app/testcov/main.py", """\
import pkg_resources
for entry_point in pkg_resources.iter_entry_points('plugins'):
entry_point.load()()
""")
make_file("bug888/plugin/setup.py", """\
from setuptools import setup
setup(
name='testcov-plugin',
packages=['testcov'],
namespace_packages=['testcov'],
entry_points={'plugins': ['testp = testcov.plugin:testp']},
)
""")
make_file("bug888/plugin/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/plugin/testcov/plugin.py", """\
def testp():
print("Plugin here")
""")
# Install everything.
> run_in_venv(
"python -m pip install --no-index " +
"./third_pkg " +
"-e ./another_pkg " +
"-e ./bug888/app -e ./bug888/plugin " +
COVERAGE_INSTALL_ARGS
)
tests/test_venv.py:141:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cmd = 'python -m pip install --no-index ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-6.4.2'
def run_in_venv(cmd):
r"""Run `cmd` in the virtualenv at `venv`.
The first word of the command will be adjusted to run it from the
venv/bin or venv\Scripts directory.
Returns the text output of the command.
"""
words = cmd.split()
if env.WINDOWS:
words[0] = fr"venv\Scripts\{words[0]}.exe"
else:
words[0] = fr"venv/bin/{words[0]}"
status, output = run_command(" ".join(words))
# Print the output so if it fails, we can tell what happened.
print(output)
> assert status == 0
E assert 127 == 0
tests/test_venv.py:36: AssertionError
_______________________________________________ ERROR at setup of VirtualenvTest.test_installed_namespace_packages[coverage] _______________________________________________
[gw25] linux -- Python 3.8.13 /usr/bin/python3
tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-311/popen-gw25'), _trace=<pluggy._tracing.TagTracerSub object at 0x7f111a459f70>, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-311/popen-gw25'))
@pytest.fixture(scope="session", name="venv_world")
def venv_world_fixture(tmp_path_factory):
"""Create a virtualenv with a few test packages for VirtualenvTest to use.
Returns the directory containing the "venv" virtualenv.
"""
venv_world = tmp_path_factory.mktemp("venv_world")
with change_dir(venv_world):
# Create a virtualenv.
run_command("python -m venv venv")
# A third-party package that installs a few different packages.
make_file("third_pkg/third/__init__.py", """\
import fourth
def third(x):
return 3 * x
""")
# Use plugin2.py as third.plugin
with open(os.path.join(os.path.dirname(__file__), "plugin2.py")) as f:
make_file("third_pkg/third/plugin.py", f.read())
# A render function for plugin2 to use for dynamic file names.
make_file("third_pkg/third/render.py", """\
def render(filename, linenum):
return "HTML: {}@{}".format(filename, linenum)
""")
# Another package that third can use.
make_file("third_pkg/fourth/__init__.py", """\
def fourth(x):
return 4 * x
""")
# Some namespace packages.
make_file("third_pkg/nspkg/fifth/__init__.py", """\
def fifth(x):
return 5 * x
""")
# The setup.py to install everything.
make_file("third_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="third",
packages=["third", "fourth", "nspkg.fifth"],
)
""")
# Some namespace packages.
make_file("another_pkg/nspkg/sixth/__init__.py", """\
def sixth(x):
return 6 * x
""")
make_file("another_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="another",
packages=["nspkg.sixth"],
)
""")
# Bug888 code.
make_file("bug888/app/setup.py", """\
from setuptools import setup
setup(
name='testcov',
packages=['testcov'],
namespace_packages=['testcov'],
)
""")
make_file("bug888/app/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/app/testcov/main.py", """\
import pkg_resources
for entry_point in pkg_resources.iter_entry_points('plugins'):
entry_point.load()()
""")
make_file("bug888/plugin/setup.py", """\
from setuptools import setup
setup(
name='testcov-plugin',
packages=['testcov'],
namespace_packages=['testcov'],
entry_points={'plugins': ['testp = testcov.plugin:testp']},
)
""")
make_file("bug888/plugin/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/plugin/testcov/plugin.py", """\
def testp():
print("Plugin here")
""")
# Install everything.
> run_in_venv(
"python -m pip install --no-index " +
"./third_pkg " +
"-e ./another_pkg " +
"-e ./bug888/app -e ./bug888/plugin " +
COVERAGE_INSTALL_ARGS
)
tests/test_venv.py:141:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cmd = 'python -m pip install --no-index ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-6.4.2'
def run_in_venv(cmd):
r"""Run `cmd` in the virtualenv at `venv`.
The first word of the command will be adjusted to run it from the
venv/bin or venv\Scripts directory.
Returns the text output of the command.
"""
words = cmd.split()
if env.WINDOWS:
words[0] = fr"venv\Scripts\{words[0]}.exe"
else:
words[0] = fr"venv/bin/{words[0]}"
status, output = run_command(" ".join(words))
# Print the output so if it fails, we can tell what happened.
print(output)
> assert status == 0
E assert 127 == 0
tests/test_venv.py:36: AssertionError
__________________________________________ ERROR at setup of VirtualenvTest.test_installed_namespace_packages[python -m coverage] __________________________________________
[gw25] linux -- Python 3.8.13 /usr/bin/python3
tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-311/popen-gw25'), _trace=<pluggy._tracing.TagTracerSub object at 0x7f111a459f70>, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-311/popen-gw25'))
@pytest.fixture(scope="session", name="venv_world")
def venv_world_fixture(tmp_path_factory):
"""Create a virtualenv with a few test packages for VirtualenvTest to use.
Returns the directory containing the "venv" virtualenv.
"""
venv_world = tmp_path_factory.mktemp("venv_world")
with change_dir(venv_world):
# Create a virtualenv.
run_command("python -m venv venv")
# A third-party package that installs a few different packages.
make_file("third_pkg/third/__init__.py", """\
import fourth
def third(x):
return 3 * x
""")
# Use plugin2.py as third.plugin
with open(os.path.join(os.path.dirname(__file__), "plugin2.py")) as f:
make_file("third_pkg/third/plugin.py", f.read())
# A render function for plugin2 to use for dynamic file names.
make_file("third_pkg/third/render.py", """\
def render(filename, linenum):
return "HTML: {}@{}".format(filename, linenum)
""")
# Another package that third can use.
make_file("third_pkg/fourth/__init__.py", """\
def fourth(x):
return 4 * x
""")
# Some namespace packages.
make_file("third_pkg/nspkg/fifth/__init__.py", """\
def fifth(x):
return 5 * x
""")
# The setup.py to install everything.
make_file("third_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="third",
packages=["third", "fourth", "nspkg.fifth"],
)
""")
# Some namespace packages.
make_file("another_pkg/nspkg/sixth/__init__.py", """\
def sixth(x):
return 6 * x
""")
make_file("another_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="another",
packages=["nspkg.sixth"],
)
""")
# Bug888 code.
make_file("bug888/app/setup.py", """\
from setuptools import setup
setup(
name='testcov',
packages=['testcov'],
namespace_packages=['testcov'],
)
""")
make_file("bug888/app/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/app/testcov/main.py", """\
import pkg_resources
for entry_point in pkg_resources.iter_entry_points('plugins'):
entry_point.load()()
""")
make_file("bug888/plugin/setup.py", """\
from setuptools import setup
setup(
name='testcov-plugin',
packages=['testcov'],
namespace_packages=['testcov'],
entry_points={'plugins': ['testp = testcov.plugin:testp']},
)
""")
make_file("bug888/plugin/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/plugin/testcov/plugin.py", """\
def testp():
print("Plugin here")
""")
# Install everything.
> run_in_venv(
"python -m pip install --no-index " +
"./third_pkg " +
"-e ./another_pkg " +
"-e ./bug888/app -e ./bug888/plugin " +
COVERAGE_INSTALL_ARGS
)
tests/test_venv.py:141:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cmd = 'python -m pip install --no-index ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-6.4.2'
def run_in_venv(cmd):
r"""Run `cmd` in the virtualenv at `venv`.
The first word of the command will be adjusted to run it from the
venv/bin or venv\Scripts directory.
Returns the text output of the command.
"""
words = cmd.split()
if env.WINDOWS:
words[0] = fr"venv\Scripts\{words[0]}.exe"
else:
words[0] = fr"venv/bin/{words[0]}"
status, output = run_command(" ".join(words))
# Print the output so if it fails, we can tell what happened.
print(output)
> assert status == 0
E assert 127 == 0
tests/test_venv.py:36: AssertionError
_________________________________________________________ ERROR at setup of VirtualenvTest.test_bug_888[coverage] __________________________________________________________
[gw25] linux -- Python 3.8.13 /usr/bin/python3
tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-311/popen-gw25'), _trace=<pluggy._tracing.TagTracerSub object at 0x7f111a459f70>, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-311/popen-gw25'))
@pytest.fixture(scope="session", name="venv_world")
def venv_world_fixture(tmp_path_factory):
"""Create a virtualenv with a few test packages for VirtualenvTest to use.
Returns the directory containing the "venv" virtualenv.
"""
venv_world = tmp_path_factory.mktemp("venv_world")
with change_dir(venv_world):
# Create a virtualenv.
run_command("python -m venv venv")
# A third-party package that installs a few different packages.
make_file("third_pkg/third/__init__.py", """\
import fourth
def third(x):
return 3 * x
""")
# Use plugin2.py as third.plugin
with open(os.path.join(os.path.dirname(__file__), "plugin2.py")) as f:
make_file("third_pkg/third/plugin.py", f.read())
# A render function for plugin2 to use for dynamic file names.
make_file("third_pkg/third/render.py", """\
def render(filename, linenum):
return "HTML: {}@{}".format(filename, linenum)
""")
# Another package that third can use.
make_file("third_pkg/fourth/__init__.py", """\
def fourth(x):
return 4 * x
""")
# Some namespace packages.
make_file("third_pkg/nspkg/fifth/__init__.py", """\
def fifth(x):
return 5 * x
""")
# The setup.py to install everything.
make_file("third_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="third",
packages=["third", "fourth", "nspkg.fifth"],
)
""")
# Some namespace packages.
make_file("another_pkg/nspkg/sixth/__init__.py", """\
def sixth(x):
return 6 * x
""")
make_file("another_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="another",
packages=["nspkg.sixth"],
)
""")
# Bug888 code.
make_file("bug888/app/setup.py", """\
from setuptools import setup
setup(
name='testcov',
packages=['testcov'],
namespace_packages=['testcov'],
)
""")
make_file("bug888/app/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/app/testcov/main.py", """\
import pkg_resources
for entry_point in pkg_resources.iter_entry_points('plugins'):
entry_point.load()()
""")
make_file("bug888/plugin/setup.py", """\
from setuptools import setup
setup(
name='testcov-plugin',
packages=['testcov'],
namespace_packages=['testcov'],
entry_points={'plugins': ['testp = testcov.plugin:testp']},
)
""")
make_file("bug888/plugin/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/plugin/testcov/plugin.py", """\
def testp():
print("Plugin here")
""")
# Install everything.
> run_in_venv(
"python -m pip install --no-index " +
"./third_pkg " +
"-e ./another_pkg " +
"-e ./bug888/app -e ./bug888/plugin " +
COVERAGE_INSTALL_ARGS
)
tests/test_venv.py:141:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cmd = 'python -m pip install --no-index ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-6.4.2'
def run_in_venv(cmd):
r"""Run `cmd` in the virtualenv at `venv`.
The first word of the command will be adjusted to run it from the
venv/bin or venv\Scripts directory.
Returns the text output of the command.
"""
words = cmd.split()
if env.WINDOWS:
words[0] = fr"venv\Scripts\{words[0]}.exe"
else:
words[0] = fr"venv/bin/{words[0]}"
status, output = run_command(" ".join(words))
# Print the output so if it fails, we can tell what happened.
print(output)
> assert status == 0
E assert 127 == 0
tests/test_venv.py:36: AssertionError
____________________________________________________ ERROR at setup of VirtualenvTest.test_bug_888[python -m coverage] _____________________________________________________
[gw25] linux -- Python 3.8.13 /usr/bin/python3
tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-311/popen-gw25'), _trace=<pluggy._tracing.TagTracerSub object at 0x7f111a459f70>, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-311/popen-gw25'))
@pytest.fixture(scope="session", name="venv_world")
def venv_world_fixture(tmp_path_factory):
"""Create a virtualenv with a few test packages for VirtualenvTest to use.
Returns the directory containing the "venv" virtualenv.
"""
venv_world = tmp_path_factory.mktemp("venv_world")
with change_dir(venv_world):
# Create a virtualenv.
run_command("python -m venv venv")
# A third-party package that installs a few different packages.
make_file("third_pkg/third/__init__.py", """\
import fourth
def third(x):
return 3 * x
""")
# Use plugin2.py as third.plugin
with open(os.path.join(os.path.dirname(__file__), "plugin2.py")) as f:
make_file("third_pkg/third/plugin.py", f.read())
# A render function for plugin2 to use for dynamic file names.
make_file("third_pkg/third/render.py", """\
def render(filename, linenum):
return "HTML: {}@{}".format(filename, linenum)
""")
# Another package that third can use.
make_file("third_pkg/fourth/__init__.py", """\
def fourth(x):
return 4 * x
""")
# Some namespace packages.
make_file("third_pkg/nspkg/fifth/__init__.py", """\
def fifth(x):
return 5 * x
""")
# The setup.py to install everything.
make_file("third_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="third",
packages=["third", "fourth", "nspkg.fifth"],
)
""")
# Some namespace packages.
make_file("another_pkg/nspkg/sixth/__init__.py", """\
def sixth(x):
return 6 * x
""")
make_file("another_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="another",
packages=["nspkg.sixth"],
)
""")
# Bug888 code.
make_file("bug888/app/setup.py", """\
from setuptools import setup
setup(
name='testcov',
packages=['testcov'],
namespace_packages=['testcov'],
)
""")
make_file("bug888/app/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/app/testcov/main.py", """\
import pkg_resources
for entry_point in pkg_resources.iter_entry_points('plugins'):
entry_point.load()()
""")
make_file("bug888/plugin/setup.py", """\
from setuptools import setup
setup(
name='testcov-plugin',
packages=['testcov'],
namespace_packages=['testcov'],
entry_points={'plugins': ['testp = testcov.plugin:testp']},
)
""")
make_file("bug888/plugin/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/plugin/testcov/plugin.py", """\
def testp():
print("Plugin here")
""")
# Install everything.
> run_in_venv(
"python -m pip install --no-index " +
"./third_pkg " +
"-e ./another_pkg " +
"-e ./bug888/app -e ./bug888/plugin " +
COVERAGE_INSTALL_ARGS
)
tests/test_venv.py:141:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cmd = 'python -m pip install --no-index ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-6.4.2'
def run_in_venv(cmd):
r"""Run `cmd` in the virtualenv at `venv`.
The first word of the command will be adjusted to run it from the
venv/bin or venv\Scripts directory.
Returns the text output of the command.
"""
words = cmd.split()
if env.WINDOWS:
words[0] = fr"venv\Scripts\{words[0]}.exe"
else:
words[0] = fr"venv/bin/{words[0]}"
status, output = run_command(" ".join(words))
# Print the output so if it fails, we can tell what happened.
print(output)
> assert status == 0
E assert 127 == 0
tests/test_venv.py:36: AssertionError
================================================================================= FAILURES =================================================================================
_____________________________________________________________________ ConfigTest.test_toml_config_file _____________________________________________________________________
[gw12] linux -- Python 3.8.13 /usr/bin/python3
self = <tests.test_config.ConfigTest object at 0x7fe5cc0b6970>
def test_toml_config_file(self):
# A .coveragerc file will be read into the configuration.
self.make_file("pyproject.toml", """\
# This is just a bogus toml file for testing.
[tool.somethingelse]
authors = ["Joe D'Ávila <joe@gmail.com>"]
[tool.coverage.run]
concurrency = ["a", "b"]
timid = true
data_file = ".hello_kitty.data"
plugins = ["plugins.a_plugin"]
[tool.coverage.report]
precision = 3
fail_under = 90.5
[tool.coverage.html]
title = "tabblo & «ταБЬℓσ»"
[tool.coverage.plugins.a_plugin]
hello = "world"
""")
> cov = coverage.Coverage(config_file="pyproject.toml")
/home/tkloczko/rpmbuild/BUILD/coveragepy-6.4.2/tests/test_config.py:84:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages/coverage/control.py:246: in __init__
self.config = read_coverage_config(
/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages/coverage/config.py:561: in read_coverage_config
config_read = config.from_file(fname, warn, our_file=our_file)
/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages/coverage/config.py:277: in from_file
files_read = cp.read(filename)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <coverage.tomlconfig.TomlConfigParser object at 0x7fe5c78beee0>, filenames = 'pyproject.toml'
def read(self, filenames):
# RawConfigParser takes a filename or list of filenames, but we only
# ever call this with a single filename.
assert isinstance(filenames, (bytes, str, os.PathLike))
filename = os.fspath(filenames)
try:
with open(filename, encoding='utf-8') as fp:
toml_text = fp.read()
except OSError:
return []
if tomllib is not None:
toml_text = substitute_variables(toml_text, os.environ)
try:
self.data = tomllib.loads(toml_text)
except tomllib.TOMLDecodeError as err:
raise TomlDecodeError(str(err)) from err
return [filename]
else:
has_toml = re.search(r"^\[tool\.coverage\.", toml_text, flags=re.MULTILINE)
if self.our_file or has_toml:
# Looks like they meant to read TOML, but we can't read it.
msg = "Can't read {!r} without TOML support. Install with [toml] extra"
> raise ConfigError(msg.format(filename))
E coverage.exceptions.ConfigError: Can't read 'pyproject.toml' without TOML support. Install with [toml] extra
/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages/coverage/tomlconfig.py:66: ConfigError
___________________________________________ ConfigTest.test_toml_parse_errors[[tool.coverage.run]\nconcurrency="foo"-not a list] ___________________________________________
[gw22] linux -- Python 3.8.13 /usr/bin/python3
self = <tests.test_config.ConfigTest object at 0x7f1ef0b1ca00>, bad_config = '[tool.coverage.run]\nconcurrency="foo"', msg = 'not a list'
@pytest.mark.parametrize("bad_config, msg", [
("[tool.coverage.run]\ntimid = \"maybe?\"\n", r"maybe[?]"),
("[tool.coverage.run\n", None),
('[tool.coverage.report]\nexclude_lines = ["foo("]\n',
r"Invalid \[tool.coverage.report\].exclude_lines value 'foo\(': " +
r"(unbalanced parenthesis|missing \))"),
('[tool.coverage.report]\npartial_branches = ["foo["]\n',
r"Invalid \[tool.coverage.report\].partial_branches value 'foo\[': " +
r"(unexpected end of regular expression|unterminated character set)"),
('[tool.coverage.report]\npartial_branches_always = ["foo***"]\n',
r"Invalid \[tool.coverage.report\].partial_branches_always value " +
r"'foo\*\*\*': " +
r"multiple repeat"),
('[tool.coverage.run]\nconcurrency="foo"', "not a list"),
("[tool.coverage.report]\nprecision=1.23", "not an integer"),
('[tool.coverage.report]\nfail_under="s"', "not a float"),
])
def test_toml_parse_errors(self, bad_config, msg):
# Im-parsable values raise ConfigError, with details.
self.make_file("pyproject.toml", bad_config)
with pytest.raises(ConfigError, match=msg):
> coverage.Coverage()
/home/tkloczko/rpmbuild/BUILD/coveragepy-6.4.2/tests/test_config.py:209:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <coverage.control.Coverage object at 0x7f1ef024c0d0>, data_file = None, data_suffix = None, cover_pylib = None, auto_data = False, timid = None, branch = None
config_file = True, source = None, source_pkgs = None, omit = None, include = None, debug = None, concurrency = None, check_preimported = False, context = None
messages = False
def __init__(
self, data_file=DEFAULT_DATAFILE, data_suffix=None, cover_pylib=None,
auto_data=False, timid=None, branch=None, config_file=True,
source=None, source_pkgs=None, omit=None, include=None, debug=None,
concurrency=None, check_preimported=False, context=None,
messages=False,
): # pylint: disable=too-many-arguments
"""
Many of these arguments duplicate and override values that can be
provided in a configuration file. Parameters that are missing here
will use values from the config file.
`data_file` is the base name of the data file to use. The config value
defaults to ".coverage". None can be provided to prevent writing a data
file. `data_suffix` is appended (with a dot) to `data_file` to create
the final file name. If `data_suffix` is simply True, then a suffix is
created with the machine and process identity included.
`cover_pylib` is a boolean determining whether Python code installed
with the Python interpreter is measured. This includes the Python
standard library and any packages installed with the interpreter.
If `auto_data` is true, then any existing data file will be read when
coverage measurement starts, and data will be saved automatically when
measurement stops.
If `timid` is true, then a slower and simpler trace function will be
used. This is important for some environments where manipulation of
tracing functions breaks the faster trace function.
If `branch` is true, then branch coverage will be measured in addition
to the usual statement coverage.
`config_file` determines what configuration file to read:
* If it is ".coveragerc", it is interpreted as if it were True,
for backward compatibility.
* If it is a string, it is the name of the file to read. If the
file can't be read, it is an error.
* If it is True, then a few standard files names are tried
(".coveragerc", "setup.cfg", "tox.ini"). It is not an error for
these files to not be found.
* If it is False, then no configuration file is read.
`source` is a list of file paths or package names. Only code located
in the trees indicated by the file paths or package names will be
measured.
`source_pkgs` is a list of package names. It works the same as
`source`, but can be used to name packages where the name can also be
interpreted as a file path.
`include` and `omit` are lists of file name patterns. Files that match
`include` will be measured, files that match `omit` will not. Each
will also accept a single string argument.
`debug` is a list of strings indicating what debugging information is
desired.
`concurrency` is a string indicating the concurrency library being used
in the measured code. Without this, coverage.py will get incorrect
results if these libraries are in use. Valid strings are "greenlet",
"eventlet", "gevent", "multiprocessing", or "thread" (the default).
This can also be a list of these strings.
If `check_preimported` is true, then when coverage is started, the
already-imported files will be checked to see if they should be
measured by coverage. Importing measured files before coverage is
started can mean that code is missed.
`context` is a string to use as the :ref:`static context
<static_contexts>` label for collected data.
If `messages` is true, some messages will be printed to stdout
indicating what is happening.
.. versionadded:: 4.0
The `concurrency` parameter.
.. versionadded:: 4.2
The `concurrency` parameter can now be a list of strings.
.. versionadded:: 5.0
The `check_preimported` and `context` parameters.
.. versionadded:: 5.3
The `source_pkgs` parameter.
.. versionadded:: 6.0
The `messages` parameter.
"""
# data_file=None means no disk file at all. data_file missing means
# use the value from the config file.
self._no_disk = data_file is None
if data_file is DEFAULT_DATAFILE:
data_file = None
self.config = None
# This is injectable by tests.
self._debug_file = None
self._auto_load = self._auto_save = auto_data
self._data_suffix_specified = data_suffix
# Is it ok for no data to be collected?
self._warn_no_data = True
self._warn_unimported_source = True
self._warn_preimported_source = check_preimported
self._no_warn_slugs = None
self._messages = messages
# A record of all the warnings that have been issued.
self._warnings = []
# Other instance attributes, set later.
self._data = self._collector = None
self._plugins = None
self._inorout = None
self._data_suffix = self._run_suffix = None
self._exclude_re = None
self._debug = None
self._file_mapper = None
self._old_sigterm = None
# State machine variables:
# Have we initialized everything?
self._inited = False
self._inited_for_start = False
# Have we started collecting and not stopped it?
self._started = False
# Should we write the debug output?
self._should_write_debug = True
# Build our configuration from a number of sources.
> self.config = read_coverage_config(
config_file=config_file, warn=self._warn,
data_file=data_file, cover_pylib=cover_pylib, timid=timid,
branch=branch, parallel=bool_or_none(data_suffix),
source=source, source_pkgs=source_pkgs, run_omit=omit, run_include=include, debug=debug,
report_omit=omit, report_include=include,
concurrency=concurrency, context=context,
)
/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages/coverage/control.py:246:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
config_file = True, warn = <bound method Coverage._warn of <coverage.control.Coverage object at 0x7f1ef024c0d0>>
kwargs = {'branch': None, 'concurrency': None, 'context': None, 'cover_pylib': None, ...}, config = <coverage.config.CoverageConfig object at 0x7f1ef024c100>
files_to_try = [('.coveragerc', True, False), ('setup.cfg', False, False), ('tox.ini', False, False), ('pyproject.toml', False, False)], fname = 'pyproject.toml'
our_file = False, specified_file = False, config_read = False
def read_coverage_config(config_file, warn, **kwargs):
"""Read the coverage.py configuration.
Arguments:
config_file: a boolean or string, see the `Coverage` class for the
tricky details.
warn: a function to issue warnings.
all others: keyword arguments from the `Coverage` class, used for
setting values in the configuration.
Returns:
config:
config is a CoverageConfig object read from the appropriate
configuration file.
"""
# Build the configuration from a number of sources:
# 1) defaults:
config = CoverageConfig()
# 2) from a file:
if config_file:
files_to_try = config_files_to_try(config_file)
for fname, our_file, specified_file in files_to_try:
> config_read = config.from_file(fname, warn, our_file=our_file)
/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages/coverage/config.py:561:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <coverage.config.CoverageConfig object at 0x7f1ef024c100>, filename = 'pyproject.toml'
warn = <bound method Coverage._warn of <coverage.control.Coverage object at 0x7f1ef024c0d0>>, our_file = False
@contract(filename=str)
def from_file(self, filename, warn, our_file):
"""Read configuration from a .rc file.
`filename` is a file name to read.
`our_file` is True if this config file is specifically for coverage,
False if we are examining another config file (tox.ini, setup.cfg)
for possible settings.
Returns True or False, whether the file could be read, and it had some
coverage.py settings in it.
"""
_, ext = os.path.splitext(filename)
if ext == '.toml':
cp = TomlConfigParser(our_file)
else:
cp = HandyConfigParser(our_file)
self.attempted_config_files.append(filename)
try:
> files_read = cp.read(filename)
/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages/coverage/config.py:277:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <coverage.tomlconfig.TomlConfigParser object at 0x7f1ef024c430>, filenames = 'pyproject.toml'
def read(self, filenames):
# RawConfigParser takes a filename or list of filenames, but we only
# ever call this with a single filename.
assert isinstance(filenames, (bytes, str, os.PathLike))
filename = os.fspath(filenames)
try:
with open(filename, encoding='utf-8') as fp:
toml_text = fp.read()
except OSError:
return []
if tomllib is not None:
toml_text = substitute_variables(toml_text, os.environ)
try:
self.data = tomllib.loads(toml_text)
except tomllib.TOMLDecodeError as err:
raise TomlDecodeError(str(err)) from err
return [filename]
else:
has_toml = re.search(r"^\[tool\.coverage\.", toml_text, flags=re.MULTILINE)
if self.our_file or has_toml:
# Looks like they meant to read TOML, but we can't read it.
msg = "Can't read {!r} without TOML support. Install with [toml] extra"
> raise ConfigError(msg.format(filename))
E coverage.exceptions.ConfigError: Can't read 'pyproject.toml' without TOML support. Install with [toml] extra
/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages/coverage/tomlconfig.py:66: ConfigError
During handling of the above exception, another exception occurred:
self = <tests.test_config.ConfigTest object at 0x7f1ef0b1ca00>, bad_config = '[tool.coverage.run]\nconcurrency="foo"', msg = 'not a list'
@pytest.mark.parametrize("bad_config, msg", [
("[tool.coverage.run]\ntimid = \"maybe?\"\n", r"maybe[?]"),
("[tool.coverage.run\n", None),
('[tool.coverage.report]\nexclude_lines = ["foo("]\n',
r"Invalid \[tool.coverage.report\].exclude_lines value 'foo\(': " +
r"(unbalanced parenthesis|missing \))"),
('[tool.coverage.report]\npartial_branches = ["foo["]\n',
r"Invalid \[tool.coverage.report\].partial_branches value 'foo\[': " +
r"(unexpected end of regular expression|unterminated character set)"),
('[tool.coverage.report]\npartial_branches_always = ["foo***"]\n',
r"Invalid \[tool.coverage.report\].partial_branches_always value " +
r"'foo\*\*\*': " +
r"multiple repeat"),
('[tool.coverage.run]\nconcurrency="foo"', "not a list"),
("[tool.coverage.report]\nprecision=1.23", "not an integer"),
('[tool.coverage.report]\nfail_under="s"', "not a float"),
])
def test_toml_parse_errors(self, bad_config, msg):
# Im-parsable values raise ConfigError, with details.
self.make_file("pyproject.toml", bad_config)
with pytest.raises(ConfigError, match=msg):
> coverage.Coverage()
E AssertionError: Regex pattern 'not a list' does not match "Can't read 'pyproject.toml' without TOML support. Install with [toml] extra".
/home/tkloczko/rpmbuild/BUILD/coveragepy-6.4.2/tests/test_config.py:209: AssertionError
_ ConfigTest.test_toml_parse_errors[[tool.coverage.report]\npartial_branches_always = ["foo***"]\n-Invalid \\[tool.coverage.report\\].partial_branches_always value 'foo\\*\\*\\*': multiple repeat] _
[gw20] linux -- Python 3.8.13 /usr/bin/python3
self = <tests.test_config.ConfigTest object at 0x7f81d886f670>, bad_config = '[tool.coverage.report]\npartial_branches_always = ["foo***"]\n'
msg = "Invalid \\[tool.coverage.report\\].partial_branches_always value 'foo\\*\\*\\*': multiple repeat"
@pytest.mark.parametrize("bad_config, msg", [
("[tool.coverage.run]\ntimid = \"maybe?\"\n", r"maybe[?]"),
("[tool.coverage.run\n", None),
('[tool.coverage.report]\nexclude_lines = ["foo("]\n',
r"Invalid \[tool.coverage.report\].exclude_lines value 'foo\(': " +
r"(unbalanced parenthesis|missing \))"),
('[tool.coverage.report]\npartial_branches = ["foo["]\n',
r"Invalid \[tool.coverage.report\].partial_branches value 'foo\[': " +
r"(unexpected end of regular expression|unterminated character set)"),
('[tool.coverage.report]\npartial_branches_always = ["foo***"]\n',
r"Invalid \[tool.coverage.report\].partial_branches_always value " +
r"'foo\*\*\*': " +
r"multiple repeat"),
('[tool.coverage.run]\nconcurrency="foo"', "not a list"),
("[tool.coverage.report]\nprecision=1.23", "not an integer"),
('[tool.coverage.report]\nfail_under="s"', "not a float"),
])
def test_toml_parse_errors(self, bad_config, msg):
# Im-parsable values raise ConfigError, with details.
self.make_file("pyproject.toml", bad_config)
with pytest.raises(ConfigError, match=msg):
> coverage.Coverage()
/home/tkloczko/rpmbuild/BUILD/coveragepy-6.4.2/tests/test_config.py:209:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <coverage.control.Coverage object at 0x7f81d3face50>, data_file = None, data_suffix = None, cover_pylib = None, auto_data = False, timid = None, branch = None
config_file = True, source = None, source_pkgs = None, omit = None, include = None, debug = None, concurrency = None, check_preimported = False, context = None
messages = False
def __init__(
self, data_file=DEFAULT_DATAFILE, data_suffix=None, cover_pylib=None,
auto_data=False, timid=None, branch=None, config_file=True,
source=None, source_pkgs=None, omit=None, include=None, debug=None,
concurrency=None, check_preimported=False, context=None,
messages=False,
): # pylint: disable=too-many-arguments
"""
Many of these arguments duplicate and override values that can be
provided in a configuration file. Parameters that are missing here
will use values from the config file.
`data_file` is the base name of the data file to use. The config value
defaults to ".coverage". None can be provided to prevent writing a data
file. `data_suffix` is appended (with a dot) to `data_file` to create
the final file name. If `data_suffix` is simply True, then a suffix is
created with the machine and process identity included.
`cover_pylib` is a boolean determining whether Python code installed
with the Python interpreter is measured. This includes the Python
standard library and any packages installed with the interpreter.
If `auto_data` is true, then any existing data file will be read when
coverage measurement starts, and data will be saved automatically when
measurement stops.
If `timid` is true, then a slower and simpler trace function will be
used. This is important for some environments where manipulation of
tracing functions breaks the faster trace function.
If `branch` is true, then branch coverage will be measured in addition
to the usual statement coverage.
`config_file` determines what configuration file to read:
* If it is ".coveragerc", it is interpreted as if it were True,
for backward compatibility.
* If it is a string, it is the name of the file to read. If the
file can't be read, it is an error.
* If it is True, then a few standard files names are tried
(".coveragerc", "setup.cfg", "tox.ini"). It is not an error for
these files to not be found.
* If it is False, then no configuration file is read.
`source` is a list of file paths or package names. Only code located
in the trees indicated by the file paths or package names will be
measured.
`source_pkgs` is a list of package names. It works the same as
`source`, but can be used to name packages where the name can also be
interpreted as a file path.
`include` and `omit` are lists of file name patterns. Files that match
`include` will be measured, files that match `omit` will not. Each
will also accept a single string argument.
`debug` is a list of strings indicating what debugging information is
desired.
`concurrency` is a string indicating the concurrency library being used
in the measured code. Without this, coverage.py will get incorrect
results if these libraries are in use. Valid strings are "greenlet",
"eventlet", "gevent", "multiprocessing", or "thread" (the default).
This can also be a list of these strings.
If `check_preimported` is true, then when coverage is started, the
already-imported files will be checked to see if they should be
measured by coverage. Importing measured files before coverage is
started can mean that code is missed.
`context` is a string to use as the :ref:`static context
<static_contexts>` label for collected data.
If `messages` is true, some messages will be printed to stdout
indicating what is happening.
.. versionadded:: 4.0
The `concurrency` parameter.
.. versionadded:: 4.2
The `concurrency` parameter can now be a list of strings.
.. versionadded:: 5.0
The `check_preimported` and `context` parameters.
.. versionadded:: 5.3
The `source_pkgs` parameter.
.. versionadded:: 6.0
The `messages` parameter.
"""
# data_file=None means no disk file at all. data_file missing means
# use the value from the config file.
self._no_disk = data_file is None
if data_file is DEFAULT_DATAFILE:
data_file = None
self.config = None
# This is injectable by tests.
self._debug_file = None
self._auto_load = self._auto_save = auto_data
self._data_suffix_specified = data_suffix
# Is it ok for no data to be collected?
self._warn_no_data = True
self._warn_unimported_source = True
self._warn_preimported_source = check_preimported
self._no_warn_slugs = None
self._messages = messages
# A record of all the warnings that have been issued.
self._warnings = []
# Other instance attributes, set later.
self._data = self._collector = None
self._plugins = None
self._inorout = None
self._data_suffix = self._run_suffix = None
self._exclude_re = None
self._debug = None
self._file_mapper = None
self._old_sigterm = None
# State machine variables:
# Have we initialized everything?
self._inited = False
self._inited_for_start = False
# Have we started collecting and not stopped it?
self._started = False
# Should we write the debug output?
self._should_write_debug = True
# Build our configuration from a number of sources.
> self.config = read_coverage_config(
config_file=config_file, warn=self._warn,
data_file=data_file, cover_pylib=cover_pylib, timid=timid,
branch=branch, parallel=bool_or_none(data_suffix),
source=source, source_pkgs=source_pkgs, run_omit=omit, run_include=include, debug=debug,
report_omit=omit, report_include=include,
concurrency=concurrency, context=context,
)
/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages/coverage/control.py:246:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
config_file = True, warn = <bound method Coverage._warn of <coverage.control.Coverage object at 0x7f81d3face50>>
kwargs = {'branch': None, 'concurrency': None, 'context': None, 'cover_pylib': None, ...}, config = <coverage.config.CoverageConfig object at 0x7f81d3face20>
files_to_try = [('.coveragerc', True, False), ('setup.cfg', False, False), ('tox.ini', False, False), ('pyproject.toml', False, False)], fname = 'pyproject.toml'
our_file = False, specified_file = False, config_read = False
def read_coverage_config(config_file, warn, **kwargs):
"""Read the coverage.py configuration.
Arguments:
config_file: a boolean or string, see the `Coverage` class for the
tricky details.
warn: a function to issue warnings.
all others: keyword arguments from the `Coverage` class, used for
setting values in the configuration.
Returns:
config:
config is a CoverageConfig object read from the appropriate
configuration file.
"""
# Build the configuration from a number of sources:
# 1) defaults:
config = CoverageConfig()
# 2) from a file:
if config_file:
files_to_try = config_files_to_try(config_file)
for fname, our_file, specified_file in files_to_try:
> config_read = config.from_file(fname, warn, our_file=our_file)
/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages/coverage/config.py:561:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <coverage.config.CoverageConfig object at 0x7f81d3face20>, filename = 'pyproject.toml'
warn = <bound method Coverage._warn of <coverage.control.Coverage object at 0x7f81d3face50>>, our_file = False
@contract(filename=str)
def from_file(self, filename, warn, our_file):
"""Read configuration from a .rc file.
`filename` is a file name to read.
`our_file` is True if this config file is specifically for coverage,
False if we are examining another config file (tox.ini, setup.cfg)
for possible settings.
Returns True or False, whether the file could be read, and it had some
coverage.py settings in it.
"""
_, ext = os.path.splitext(filename)
if ext == '.toml':
cp = TomlConfigParser(our_file)
else:
cp = HandyConfigParser(our_file)
self.attempted_config_files.append(filename)
try:
> files_read = cp.read(filename)
/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages/coverage/config.py:277:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <coverage.tomlconfig.TomlConfigParser object at 0x7f81d3facb50>, filenames = 'pyproject.toml'
def read(self, filenames):
# RawConfigParser takes a filename or list of filenames, but we only
# ever call this with a single filename.
assert isinstance(filenames, (bytes, str, os.PathLike))
filename = os.fspath(filenames)
try:
with open(filename, encoding='utf-8') as fp:
toml_text = fp.read()
except OSError:
return []
if tomllib is not None:
toml_text = substitute_variables(toml_text, os.environ)
try:
self.data = tomllib.loads(toml_text)
except tomllib.TOMLDecodeError as err:
raise TomlDecodeError(str(err)) from err
return [filename]
else:
has_toml = re.search(r"^\[tool\.coverage\.", toml_text, flags=re.MULTILINE)
if self.our_file or has_toml:
# Looks like they meant to read TOML, but we can't read it.
msg = "Can't read {!r} without TOML support. Install with [toml] extra"
> raise ConfigError(msg.format(filename))
E coverage.exceptions.ConfigError: Can't read 'pyproject.toml' without TOML support. Install with [toml] extra
/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages/coverage/tomlconfig.py:66: ConfigError
During handling of the above exception, another exception occurred:
self = <tests.test_config.ConfigTest object at 0x7f81d886f670>, bad_config = '[tool.coverage.report]\npartial_branches_always = ["foo***"]\n'
msg = "Invalid \\[tool.coverage.report\\].partial_branches_always value 'foo\\*\\*\\*': multiple repeat"
@pytest.mark.parametrize("bad_config, msg", [
("[tool.coverage.run]\ntimid = \"maybe?\"\n", r"maybe[?]"),
("[tool.coverage.run\n", None),
('[tool.coverage.report]\nexclude_lines = ["foo("]\n',
r"Invalid \[tool.coverage.report\].exclude_lines value 'foo\(': " +
r"(unbalanced parenthesis|missing \))"),
('[tool.coverage.report]\npartial_branches = ["foo["]\n',
r"Invalid \[tool.coverage.report\].partial_branches value 'foo\[': " +
r"(unexpected end of regular expression|unterminated character set)"),
('[tool.coverage.report]\npartial_branches_always = ["foo***"]\n',
r"Invalid \[tool.coverage.report\].partial_branches_always value " +
r"'foo\*\*\*': " +
r"multiple repeat"),
('[tool.coverage.run]\nconcurrency="foo"', "not a list"),
("[tool.coverage.report]\nprecision=1.23", "not an integer"),
('[tool.coverage.report]\nfail_under="s"', "not a float"),
])
def test_toml_parse_errors(self, bad_config, msg):
# Im-parsable values raise ConfigError, with details.
self.make_file("pyproject.toml", bad_config)
with pytest.raises(ConfigError, match=msg):
> coverage.Coverage()
E AssertionError: Regex pattern "Invalid \\[tool.coverage.report\\].partial_branches_always value 'foo\\*\\*\\*': multiple repeat" does not match "Can't read 'pyproject.toml' without TOML support. Install with [toml] extra".
/home/tkloczko/rpmbuild/BUILD/coveragepy-6.4.2/tests/test_config.py:209: AssertionError
_ ConfigTest.test_toml_parse_errors[[tool.coverage.report]\npartial_branches = ["foo["]\n-Invalid \\[tool.coverage.report\\].partial_branches value 'foo\\[': (unexpected end of regular expression|unterminated character set)] _
[gw19] linux -- Python 3.8.13 /usr/bin/python3
self = <tests.test_config.ConfigTest object at 0x7f4df68b3f40>, bad_config = '[tool.coverage.report]\npartial_branches = ["foo["]\n'
msg = "Invalid \\[tool.coverage.report\\].partial_branches value 'foo\\[': (unexpected end of regular expression|unterminated character set)"
@pytest.mark.parametrize("bad_config, msg", [
("[tool.coverage.run]\ntimid = \"maybe?\"\n", r"maybe[?]"),
("[tool.coverage.run\n", None),
('[tool.coverage.report]\nexclude_lines = ["foo("]\n',
r"Invalid \[tool.coverage.report\].exclude_lines value 'foo\(': " +
r"(unbalanced parenthesis|missing \))"),
('[tool.coverage.report]\npartial_branches = ["foo["]\n',
r"Invalid \[tool.coverage.report\].partial_branches value 'foo\[': " +
r"(unexpected end of regular expression|unterminated character set)"),
('[tool.coverage.report]\npartial_branches_always = ["foo***"]\n',
r"Invalid \[tool.coverage.report\].partial_branches_always value " +
r"'foo\*\*\*': " +
r"multiple repeat"),
('[tool.coverage.run]\nconcurrency="foo"', "not a list"),
("[tool.coverage.report]\nprecision=1.23", "not an integer"),
('[tool.coverage.report]\nfail_under="s"', "not a float"),
])
def test_toml_parse_errors(self, bad_config, msg):
# Im-parsable values raise ConfigError, with details.
self.make_file("pyproject.toml", bad_config)
with pytest.raises(ConfigError, match=msg):
> coverage.Coverage()
/home/tkloczko/rpmbuild/BUILD/coveragepy-6.4.2/tests/test_config.py:209:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <coverage.control.Coverage object at 0x7f4df5f9bd00>, data_file = None, data_suffix = None, cover_pylib = None, auto_data = False, timid = None, branch = None
config_file = True, source = None, source_pkgs = None, omit = None, include = None, debug = None, concurrency = None, check_preimported = False, context = None
messages = False
def __init__(
self, data_file=DEFAULT_DATAFILE, data_suffix=None, cover_pylib=None,
auto_data=False, timid=None, branch=None, config_file=True,
source=None, source_pkgs=None, omit=None, include=None, debug=None,
concurrency=None, check_preimported=False, context=None,
messages=False,
): # pylint: disable=too-many-arguments
"""
Many of these arguments duplicate and override values that can be
provided in a configuration file. Parameters that are missing here
will use values from the config file.
`data_file` is the base name of the data file to use. The config value
defaults to ".coverage". None can be provided to prevent writing a data
file. `data_suffix` is appended (with a dot) to `data_file` to create
the final file name. If `data_suffix` is simply True, then a suffix is
created with the machine and process identity included.
`cover_pylib` is a boolean determining whether Python code installed
with the Python interpreter is measured. This includes the Python
standard library and any packages installed with the interpreter.
If `auto_data` is true, then any existing data file will be read when
coverage measurement starts, and data will be saved automatically when
measurement stops.
If `timid` is true, then a slower and simpler trace function will be
used. This is important for some environments where manipulation of
tracing functions breaks the faster trace function.
If `branch` is true, then branch coverage will be measured in addition
to the usual statement coverage.
`config_file` determines what configuration file to read:
* If it is ".coveragerc", it is interpreted as if it were True,
for backward compatibility.
* If it is a string, it is the name of the file to read. If the
file can't be read, it is an error.
* If it is True, then a few standard files names are tried
(".coveragerc", "setup.cfg", "tox.ini"). It is not an error for
these files to not be found.
* If it is False, then no configuration file is read.
`source` is a list of file paths or package names. Only code located
in the trees indicated by the file paths or package names will be
measured.
`source_pkgs` is a list of package names. It works the same as
`source`, but can be used to name packages where the name can also be
interpreted as a file path.
`include` and `omit` are lists of file name patterns. Files that match
`include` will be measured, files that match `omit` will not. Each
will also accept a single string argument.
`debug` is a list of strings indicating what debugging information is
desired.
`concurrency` is a string indicating the concurrency library being used
in the measured code. Without this, coverage.py will get incorrect
results if these libraries are in use. Valid strings are "greenlet",
"eventlet", "gevent", "multiprocessing", or "thread" (the default).
This can also be a list of these strings.
If `check_preimported` is true, then when coverage is started, the
already-imported files will be checked to see if they should be
measured by coverage. Importing measured files before coverage is
started can mean that code is missed.
`context` is a string to use as the :ref:`static context
<static_contexts>` label for collected data.
If `messages` is true, some messages will be printed to stdout
indicating what is happening.
.. versionadded:: 4.0
The `concurrency` parameter.
.. versionadded:: 4.2
The `concurrency` parameter can now be a list of strings.
.. versionadded:: 5.0
The `check_preimported` and `context` parameters.
.. versionadded:: 5.3
The `source_pkgs` parameter.
.. versionadded:: 6.0
The `messages` parameter.
"""
# data_file=None means no disk file at all. data_file missing means
# use the value from the config file.
self._no_disk = data_file is None
if data_file is DEFAULT_DATAFILE:
data_file = None
self.config = None
# This is injectable by tests.
self._debug_file = None
self._auto_load = self._auto_save = auto_data
self._data_suffix_specified = data_suffix
# Is it ok for no data to be collected?
self._warn_no_data = True
self._warn_unimported_source = True
self._warn_preimported_source = check_preimported
self._no_warn_slugs = None
self._messages = messages
# A record of all the warnings that have been issued.
self._warnings = []
# Other instance attributes, set later.
self._data = self._collector = None
self._plugins = None
self._inorout = None
self._data_suffix = self._run_suffix = None
self._exclude_re = None
self._debug = None
self._file_mapper = None
self._old_sigterm = None
# State machine variables:
# Have we initialized everything?
self._inited = False
self._inited_for_start = False
# Have we started collecting and not stopped it?
self._started = False
# Should we write the debug output?
self._should_write_debug = True
# Build our configuration from a number of sources.
> self.config = read_coverage_config(
config_file=config_file, warn=self._warn,
data_file=data_file, cover_pylib=cover_pylib, timid=timid,
branch=branch, parallel=bool_or_none(data_suffix),
source=source, source_pkgs=source_pkgs, run_omit=omit, run_include=include, debug=debug,
report_omit=omit, report_include=include,
concurrency=concurrency, context=context,
)
/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages/coverage/control.py:246:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
config_file = True, warn = <bound method Coverage._warn of <coverage.control.Coverage object at 0x7f4df5f9bd00>>
kwargs = {'branch': None, 'concurrency': None, 'context': None, 'cover_pylib': None, ...}, config = <coverage.config.CoverageConfig object at 0x7f4df5f9bcd0>
files_to_try = [('.coveragerc', True, False), ('setup.cfg', False, False), ('tox.ini', False, False), ('pyproject.toml', False, False)], fname = 'pyproject.toml'
our_file = False, specified_file = False, config_read = False
def read_coverage_config(config_file, warn, **kwargs):
"""Read the coverage.py configuration.
Arguments:
config_file: a boolean or string, see the `Coverage` class for the
tricky details.
warn: a function to issue warnings.
all others: keyword arguments from the `Coverage` class, used for
setting values in the configuration.
Returns:
config:
config is a CoverageConfig object read from the appropriate
configuration file.
"""
# Build the configuration from a number of sources:
# 1) defaults:
config = CoverageConfig()
# 2) from a file:
if config_file:
files_to_try = config_files_to_try(config_file)
for fname, our_file, specified_file in files_to_try:
> config_read = config.from_file(fname, warn, our_file=our_file)
/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages/coverage/config.py:561:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <coverage.config.CoverageConfig object at 0x7f4df5f9bcd0>, filename = 'pyproject.toml'
warn = <bound method Coverage._warn of <coverage.control.Coverage object at 0x7f4df5f9bd00>>, our_file = False
@contract(filename=str)
def from_file(self, filename, warn, our_file):
"""Read configuration from a .rc file.
`filename` is a file name to read.
`our_file` is True if this config file is specifically for coverage,
False if we are examining another config file (tox.ini, setup.cfg)
for possible settings.
Returns True or False, whether the file could be read, and it had some
coverage.py settings in it.
"""
_, ext = os.path.splitext(filename)
if ext == '.toml':
cp = TomlConfigParser(our_file)
else:
cp = HandyConfigParser(our_file)
self.attempted_config_files.append(filename)
try:
> files_read = cp.read(filename)
/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages/coverage/config.py:277:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <coverage.tomlconfig.TomlConfigParser object at 0x7f4df5f9bfd0>, filenames = 'pyproject.toml'
def read(self, filenames):
# RawConfigParser takes a filename or list of filenames, but we only
# ever call this with a single filename.
assert isinstance(filenames, (bytes, str, os.PathLike))
filename = os.fspath(filenames)
try:
with open(filename, encoding='utf-8') as fp:
toml_text = fp.read()
except OSError:
return []
if tomllib is not None:
toml_text = substitute_variables(toml_text, os.environ)
try:
self.data = tomllib.loads(toml_text)
except tomllib.TOMLDecodeError as err:
raise TomlDecodeError(str(err)) from err
return [filename]
else:
has_toml = re.search(r"^\[tool\.coverage\.", toml_text, flags=re.MULTILINE)
if self.our_file or has_toml:
# Looks like they meant to read TOML, but we can't read it.
msg = "Can't read {!r} without TOML support. Install with [toml] extra"
> raise ConfigError(msg.format(filename))
E coverage.exceptions.ConfigError: Can't read 'pyproject.toml' without TOML support. Install with [toml] extra
/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages/coverage/tomlconfig.py:66: ConfigError
During handling of the above exception, another exception occurred:
self = <tests.test_config.ConfigTest object at 0x7f4df68b3f40>, bad_config = '[tool.coverage.report]\npartial_branches = ["foo["]\n'
msg = "Invalid \\[tool.coverage.report\\].partial_branches value 'foo\\[': (unexpected end of regular expression|unterminated character set)"
@pytest.mark.parametrize("bad_config, msg", [
("[tool.coverage.run]\ntimid = \"maybe?\"\n", r"maybe[?]"),
("[tool.coverage.run\n", None),
('[tool.coverage.report]\nexclude_lines = ["foo("]\n',
r"Invalid \[tool.coverage.report\].exclude_lines value 'foo\(': " +
r"(unbalanced parenthesis|missing \))"),
('[tool.coverage.report]\npartial_branches = ["foo["]\n',
r"Invalid \[tool.coverage.report\].partial_branches value 'foo\[': " +
r"(unexpected end of regular expression|unterminated character set)"),
('[tool.coverage.report]\npartial_branches_always = ["foo***"]\n',
r"Invalid \[tool.coverage.report\].partial_branches_always value " +
r"'foo\*\*\*': " +
r"multiple repeat"),
('[tool.coverage.run]\nconcurrency="foo"', "not a list"),
("[tool.coverage.report]\nprecision=1.23", "not an integer"),
('[tool.coverage.report]\nfail_under="s"', "not a float"),
])
def test_toml_parse_errors(self, bad_config, msg):
# Im-parsable values raise ConfigError, with details.
self.make_file("pyproject.toml", bad_config)
with pytest.raises(ConfigError, match=msg):
> coverage.Coverage()
E AssertionError: Regex pattern "Invalid \\[tool.coverage.report\\].partial_branches value 'foo\\[': (unexpected end of regular expression|unterminated character set)" does not match "Can't read 'pyproject.toml' without TOML support. Install with [toml] extra".
/home/tkloczko/rpmbuild/BUILD/coveragepy-6.4.2/tests/test_config.py:209: AssertionError
_ ConfigTest.test_toml_parse_errors[[tool.coverage.report]\nexclude_lines = ["foo("]\n-Invalid \\[tool.coverage.report\\].exclude_lines value 'foo\\(': (unbalanced parenthesis|missing \\))] _
[gw38] linux -- Python 3.8.13 /usr/bin/python3
self = <tests.test_config.ConfigTest object at 0x7fadd7872040>, bad_config = '[tool.coverage.report]\nexclude_lines = ["foo("]\n'
msg = "Invalid \\[tool.coverage.report\\].exclude_lines value 'foo\\(': (unbalanced parenthesis|missing \\))"
@pytest.mark.parametrize("bad_config, msg", [
("[tool.coverage.run]\ntimid = \"maybe?\"\n", r"maybe[?]"),
("[tool.coverage.run\n", None),
('[tool.coverage.report]\nexclude_lines = ["foo("]\n',
r"Invalid \[tool.coverage.report\].exclude_lines value 'foo\(': " +
r"(unbalanced parenthesis|missing \))"),
('[tool.coverage.report]\npartial_branches = ["foo["]\n',
r"Invalid \[tool.coverage.report\].partial_branches value 'foo\[': " +
r"(unexpected end of regular expression|unterminated character set)"),
('[tool.coverage.report]\npartial_branches_always = ["foo***"]\n',
r"Invalid \[tool.coverage.report\].partial_branches_always value " +
r"'foo\*\*\*': " +
r"multiple repeat"),
('[tool.coverage.run]\nconcurrency="foo"', "not a list"),
("[tool.coverage.report]\nprecision=1.23", "not an integer"),
('[tool.coverage.report]\nfail_under="s"', "not a float"),
])
def test_toml_parse_errors(self, bad_config, msg):
# Im-parsable values raise ConfigError, with details.
self.make_file("pyproject.toml", bad_config)
with pytest.raises(ConfigError, match=msg):
> coverage.Coverage()
/home/tkloczko/rpmbuild/BUILD/coveragepy-6.4.2/tests/test_config.py:209:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <coverage.control.Coverage object at 0x7fadd7402790>, data_file = None, data_suffix = None, cover_pylib = None, auto_data = False, timid = None, branch = None
config_file = True, source = None, source_pkgs = None, omit = None, include = None, debug = None, concurrency = None, check_preimported = False, context = None
messages = False
def __init__(
self, data_file=DEFAULT_DATAFILE, data_suffix=None, cover_pylib=None,
auto_data=False, timid=None, branch=None, config_file=True,
source=None, source_pkgs=None, omit=None, include=None, debug=None,
concurrency=None, check_preimported=False, context=None,
messages=False,
): # pylint: disable=too-many-arguments
"""
Many of these arguments duplicate and override values that can be
provided in a configuration file. Parameters that are missing here
will use values from the config file.
`data_file` is the base name of the data file to use. The config value
defaults to ".coverage". None can be provided to prevent writing a data
file. `data_suffix` is appended (with a dot) to `data_file` to create
the final file name. If `data_suffix` is simply True, then a suffix is
created with the machine and process identity included.
`cover_pylib` is a boolean determining whether Python code installed
with the Python interpreter is measured. This includes the Python
standard library and any packages installed with the interpreter.
If `auto_data` is true, then any existing data file will be read when
coverage measurement starts, and data will be saved automatically when
measurement stops.
If `timid` is true, then a slower and simpler trace function will be
used. This is important for some environments where manipulation of
tracing functions breaks the faster trace function.
If `branch` is true, then branch coverage will be measured in addition
to the usual statement coverage.
`config_file` determines what configuration file to read:
* If it is ".coveragerc", it is interpreted as if it were True,
for backward compatibility.
* If it is a string, it is the name of the file to read. If the
file can't be read, it is an error.
* If it is True, then a few standard files names are tried
(".coveragerc", "setup.cfg", "tox.ini"). It is not an error for
these files to not be found.
* If it is False, then no configuration file is read.
`source` is a list of file paths or package names. Only code located
in the trees indicated by the file paths or package names will be
measured.
`source_pkgs` is a list of package names. It works the same as
`source`, but can be used to name packages where the name can also be
interpreted as a file path.
`include` and `omit` are lists of file name patterns. Files that match
`include` will be measured, files that match `omit` will not. Each
will also accept a single string argument.
`debug` is a list of strings indicating what debugging information is
desired.
`concurrency` is a string indicating the concurrency library being used
in the measured code. Without this, coverage.py will get incorrect
results if these libraries are in use. Valid strings are "greenlet",
"eventlet", "gevent", "multiprocessing", or "thread" (the default).
This can also be a list of these strings.
If `check_preimported` is true, then when coverage is started, the
already-imported files will be checked to see if they should be
measured by coverage. Importing measured files before coverage is
started can mean that code is missed.
`context` is a string to use as the :ref:`static context
<static_contexts>` label for collected data.
If `messages` is true, some messages will be printed to stdout
indicating what is happening.
.. versionadded:: 4.0
The `concurrency` parameter.
.. versionadded:: 4.2
The `concurrency` parameter can now be a list of strings.
.. versionadded:: 5.0
The `check_preimported` and `context` parameters.
.. versionadded:: 5.3
The `source_pkgs` parameter.
.. versionadded:: 6.0
The `messages` parameter.
"""
# data_file=None means no disk file at all. data_file missing means
# use the value from the config file.
self._no_disk = data_file is None
if data_file is DEFAULT_DATAFILE:
data_file = None
self.config = None
# This is injectable by tests.
self._debug_file = None
self._auto_load = self._auto_save = auto_data
self._data_suffix_specified = data_suffix
# Is it ok for no data to be collected?
self._warn_no_data = True
self._warn_unimported_source = True
self._warn_preimported_source = check_preimported
self._no_warn_slugs = None
self._messages = messages
# A record of all the warnings that have been issued.
self._warnings = []
# Other instance attributes, set later.
self._data = self._collector = None
self._plugins = None
self._inorout = None
self._data_suffix = self._run_suffix = None
self._exclude_re = None
self._debug = None
self._file_mapper = None
self._old_sigterm = None
# State machine variables:
# Have we initialized everything?
self._inited = False
self._inited_for_start = False
# Have we started collecting and not stopped it?
self._started = False
# Should we write the debug output?
self._should_write_debug = True
# Build our configuration from a number of sources.
> self.config = read_coverage_config(
config_file=config_file, warn=self._warn,
data_file=data_file, cover_pylib=cover_pylib, timid=timid,
branch=branch, parallel=bool_or_none(data_suffix),
source=source, source_pkgs=source_pkgs, run_omit=omit, run_include=include, debug=debug,
report_omit=omit, report_include=include,
concurrency=concurrency, context=context,
)
/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages/coverage/control.py:246:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
config_file = True, warn = <bound method Coverage._warn of <coverage.control.Coverage object at 0x7fadd7402790>>
kwargs = {'branch': None, 'concurrency': None, 'context': None, 'cover_pylib': None, ...}, config = <coverage.config.CoverageConfig object at 0x7fadd74028b0>
files_to_try = [('.coveragerc', True, False), ('setup.cfg', False, False), ('tox.ini', False, False), ('pyproject.toml', False, False)], fname = 'pyproject.toml'
our_file = False, specified_file = False, config_read = False
def read_coverage_config(config_file, warn, **kwargs):
"""Read the coverage.py configuration.
Arguments:
config_file: a boolean or string, see the `Coverage` class for the
tricky details.
warn: a function to issue warnings.
all others: keyword arguments from the `Coverage` class, used for
setting values in the configuration.
Returns:
config:
config is a CoverageConfig object read from the appropriate
configuration file.
"""
# Build the configuration from a number of sources:
# 1) defaults:
config = CoverageConfig()
# 2) from a file:
if config_file:
files_to_try = config_files_to_try(config_file)
for fname, our_file, specified_file in files_to_try:
> config_read = config.from_file(fname, warn, our_file=our_file)
/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages/coverage/config.py:561:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <coverage.config.CoverageConfig object at 0x7fadd74028b0>, filename = 'pyproject.toml'
warn = <bound method Coverage._warn of <coverage.control.Coverage object at 0x7fadd7402790>>, our_file = False
@contract(filename=str)
def from_file(self, filename, warn, our_file):
"""Read configuration from a .rc file.
`filename` is a file name to read.
`our_file` is True if this config file is specifically for coverage,
False if we are examining another config file (tox.ini, setup.cfg)
for possible settings.
Returns True or False, whether the file could be read, and it had some
coverage.py settings in it.
"""
_, ext = os.path.splitext(filename)
if ext == '.toml':
cp = TomlConfigParser(our_file)
else:
cp = HandyConfigParser(our_file)
self.attempted_config_files.append(filename)
try:
> files_read = cp.read(filename)
/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages/coverage/config.py:277:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <coverage.tomlconfig.TomlConfigParser object at 0x7fadd74021c0>, filenames = 'pyproject.toml'
def read(self, filenames):
# RawConfigParser takes a filename or list of filenames, but we only
# ever call this with a single filename.
assert isinstance(filenames, (bytes, str, os.PathLike))
filename = os.fspath(filenames)
try:
with open(filename, encoding='utf-8') as fp:
toml_text = fp.read()
except OSError:
return []
if tomllib is not None:
toml_text = substitute_variables(toml_text, os.environ)
try:
self.data = tomllib.loads(toml_text)
except tomllib.TOMLDecodeError as err:
raise TomlDecodeError(str(err)) from err
return [filename]
else:
has_toml = re.search(r"^\[tool\.coverage\.", toml_text, flags=re.MULTILINE)
if self.our_file or has_toml:
# Looks like they meant to read TOML, but we can't read it.
msg = "Can't read {!r} without TOML support. Install with [toml] extra"
> raise ConfigError(msg.format(filename))
E coverage.exceptions.ConfigError: Can't read 'pyproject.toml' without TOML support. Install with [toml] extra
/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages/coverage/tomlconfig.py:66: ConfigError
During handling of the above exception, another exception occurred:
self = <tests.test_config.ConfigTest object at 0x7fadd7872040>, bad_config = '[tool.coverage.report]\nexclude_lines = ["foo("]\n'
msg = "Invalid \\[tool.coverage.report\\].exclude_lines value 'foo\\(': (unbalanced parenthesis|missing \\))"
@pytest.mark.parametrize("bad_config, msg", [
("[tool.coverage.run]\ntimid = \"maybe?\"\n", r"maybe[?]"),
("[tool.coverage.run\n", None),
('[tool.coverage.report]\nexclude_lines = ["foo("]\n',
r"Invalid \[tool.coverage.report\].exclude_lines value 'foo\(': " +
r"(unbalanced parenthesis|missing \))"),
('[tool.coverage.report]\npartial_branches = ["foo["]\n',
r"Invalid \[tool.coverage.report\].partial_branches value 'foo\[': " +
r"(unexpected end of regular expression|unterminated character set)"),
('[tool.coverage.report]\npartial_branches_always = ["foo***"]\n',
r"Invalid \[tool.coverage.report\].partial_branches_always value " +
r"'foo\*\*\*': " +
r"multiple repeat"),
('[tool.coverage.run]\nconcurrency="foo"', "not a list"),
("[tool.coverage.report]\nprecision=1.23", "not an integer"),
('[tool.coverage.report]\nfail_under="s"', "not a float"),
])
def test_toml_parse_errors(self, bad_config, msg):
# Im-parsable values raise ConfigError, with details.
self.make_file("pyproject.toml", bad_config)
with pytest.raises(ConfigError, match=msg):
> coverage.Coverage()
E AssertionError: Regex pattern "Invalid \\[tool.coverage.report\\].exclude_lines value 'foo\\(': (unbalanced parenthesis|missing \\))" does not match "Can't read 'pyproject.toml' without TOML support. Install with [toml] extra".
/home/tkloczko/rpmbuild/BUILD/coveragepy-6.4.2/tests/test_config.py:209: AssertionError
___________________________________________________________________ ConfigTest.test_tilde_in_toml_config ___________________________________________________________________
[gw11] linux -- Python 3.8.13 /usr/bin/python3
self = <tests.test_config.ConfigTest object at 0x7f95a7b9f190>
def test_tilde_in_toml_config(self):
# Config entries that are file paths can be tilde-expanded.
self.make_file("pyproject.toml", """\
[tool.coverage.run]
data_file = "~/data.file"
[tool.coverage.html]
directory = "~joe/html_dir"
[tool.coverage.xml]
output = "~/somewhere/xml.out"
[tool.coverage.report]
# Strings that aren't file paths are not tilde-expanded.
exclude_lines = [
"~/data.file",
"~joe/html_dir",
]
""")
def expanduser(s):
"""Fake tilde expansion"""
s = s.replace("~/", "/Users/me/")
s = s.replace("~joe/", "/Users/joe/")
return s
with mock.patch.object(coverage.config.os.path, 'expanduser', new=expanduser):
> cov = coverage.Coverage()
/home/tkloczko/rpmbuild/BUILD/coveragepy-6.4.2/tests/test_config.py:319:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages/coverage/control.py:246: in __init__
self.config = read_coverage_config(
/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages/coverage/config.py:561: in read_coverage_config
config_read = config.from_file(fname, warn, our_file=our_file)
/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages/coverage/config.py:277: in from_file
files_read = cp.read(filename)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <coverage.tomlconfig.TomlConfigParser object at 0x7f95a7573e80>, filenames = 'pyproject.toml'
def read(self, filenames):
# RawConfigParser takes a filename or list of filenames, but we only
# ever call this with a single filename.
assert isinstance(filenames, (bytes, str, os.PathLike))
filename = os.fspath(filenames)
try:
with open(filename, encoding='utf-8') as fp:
toml_text = fp.read()
except OSError:
return []
if tomllib is not None:
toml_text = substitute_variables(toml_text, os.environ)
try:
self.data = tomllib.loads(toml_text)
except tomllib.TOMLDecodeError as err:
raise TomlDecodeError(str(err)) from err
return [filename]
else:
has_toml = re.search(r"^\[tool\.coverage\.", toml_text, flags=re.MULTILINE)
if self.our_file or has_toml:
# Looks like they meant to read TOML, but we can't read it.
msg = "Can't read {!r} without TOML support. Install with [toml] extra"
> raise ConfigError(msg.format(filename))
E coverage.exceptions.ConfigError: Can't read 'pyproject.toml' without TOML support. Install with [toml] extra
/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages/coverage/tomlconfig.py:66: ConfigError
___________________________________________ ConfigTest.test_toml_parse_errors[[tool.coverage.run]\ntimid = "maybe?"\n-maybe[?]] ____________________________________________
[gw15] linux -- Python 3.8.13 /usr/bin/python3
self = <tests.test_config.ConfigTest object at 0x7f4dfd0a2a90>, bad_config = '[tool.coverage.run]\ntimid = "maybe?"\n', msg = 'maybe[?]'
@pytest.mark.parametrize("bad_config, msg", [
("[tool.coverage.run]\ntimid = \"maybe?\"\n", r"maybe[?]"),
("[tool.coverage.run\n", None),
('[tool.coverage.report]\nexclude_lines = ["foo("]\n',
r"Invalid \[tool.coverage.report\].exclude_lines value 'foo\(': " +
r"(unbalanced parenthesis|missing \))"),
('[tool.coverage.report]\npartial_branches = ["foo["]\n',
r"Invalid \[tool.coverage.report\].partial_branches value 'foo\[': " +
r"(unexpected end of regular expression|unterminated character set)"),
('[tool.coverage.report]\npartial_branches_always = ["foo***"]\n',
r"Invalid \[tool.coverage.report\].partial_branches_always value " +
r"'foo\*\*\*': " +
r"multiple repeat"),
('[tool.coverage.run]\nconcurrency="foo"', "not a list"),
("[tool.coverage.report]\nprecision=1.23", "not an integer"),
('[tool.coverage.report]\nfail_under="s"', "not a float"),
])
def test_toml_parse_errors(self, bad_config, msg):
# Im-parsable values raise ConfigError, with details.
self.make_file("pyproject.toml", bad_config)
with pytest.raises(ConfigError, match=msg):
> coverage.Coverage()
/home/tkloczko/rpmbuild/BUILD/coveragepy-6.4.2/tests/test_config.py:209:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <coverage.control.Coverage object at 0x7f4dfc906700>, data_file = None, data_suffix = None, cover_pylib = None, auto_data = False, timid = None, branch = None
config_file = True, source = None, source_pkgs = None, omit = None, include = None, debug = None, concurrency = None, check_preimported = False, context = None
messages = False
def __init__(
self, data_file=DEFAULT_DATAFILE, data_suffix=None, cover_pylib=None,
auto_data=False, timid=None, branch=None, config_file=True,
source=None, source_pkgs=None, omit=None, include=None, debug=None,
concurrency=None, check_preimported=False, context=None,
messages=False,
): # pylint: disable=too-many-arguments
"""
Many of these arguments duplicate and override values that can be
provided in a configuration file. Parameters that are missing here
will use values from the config file.
`data_file` is the base name of the data file to use. The config value
defaults to ".coverage". None can be provided to prevent writing a data
file. `data_suffix` is appended (with a dot) to `data_file` to create
the final file name. If `data_suffix` is simply True, then a suffix is
created with the machine and process identity included.
`cover_pylib` is a boolean determining whether Python code installed
with the Python interpreter is measured. This includes the Python
standard library and any packages installed with the interpreter.
If `auto_data` is true, then any existing data file will be read when
coverage measurement starts, and data will be saved automatically when
measurement stops.
If `timid` is true, then a slower and simpler trace function will be
used. This is important for some environments where manipulation of
tracing functions breaks the faster trace function.
If `branch` is true, then branch coverage will be measured in addition
to the usual statement coverage.
`config_file` determines what configuration file to read:
* If it is ".coveragerc", it is interpreted as if it were True,
for backward compatibility.
* If it is a string, it is the name of the file to read. If the
file can't be read, it is an error.
* If it is True, then a few standard files names are tried
(".coveragerc", "setup.cfg", "tox.ini"). It is not an error for
these files to not be found.
* If it is False, then no configuration file is read.
`source` is a list of file paths or package names. Only code located
in the trees indicated by the file paths or package names will be
measured.
`source_pkgs` is a list of package names. It works the same as
`source`, but can be used to name packages where the name can also be
interpreted as a file path.
`include` and `omit` are lists of file name patterns. Files that match
`include` will be measured, files that match `omit` will not. Each
will also accept a single string argument.
`debug` is a list of strings indicating what debugging information is
desired.
`concurrency` is a string indicating the concurrency library being used
in the measured code. Without this, coverage.py will get incorrect
results if these libraries are in use. Valid strings are "greenlet",
"eventlet", "gevent", "multiprocessing", or "thread" (the default).
This can also be a list of these strings.
If `check_preimported` is true, then when coverage is started, the
already-imported files will be checked to see if they should be
measured by coverage. Importing measured files before coverage is
started can mean that code is missed.
`context` is a string to use as the :ref:`static context
<static_contexts>` label for collected data.
If `messages` is true, some messages will be printed to stdout
indicating what is happening.
.. versionadded:: 4.0
The `concurrency` parameter.
.. versionadded:: 4.2
The `concurrency` parameter can now be a list of strings.
.. versionadded:: 5.0
The `check_preimported` and `context` parameters.
.. versionadded:: 5.3
The `source_pkgs` parameter.
.. versionadded:: 6.0
The `messages` parameter.
"""
# data_file=None means no disk file at all. data_file missing means
# use the value from the config file.
self._no_disk = data_file is None
if data_file is DEFAULT_DATAFILE:
data_file = None
self.config = None
# This is injectable by tests.
self._debug_file = None
self._auto_load = self._auto_save = auto_data
self._data_suffix_specified = data_suffix
# Is it ok for no data to be collected?
self._warn_no_data = True
self._warn_unimported_source = True
self._warn_preimported_source = check_preimported
self._no_warn_slugs = None
self._messages = messages
# A record of all the warnings that have been issued.
self._warnings = []
# Other instance attributes, set later.
self._data = self._collector = None
self._plugins = None
self._inorout = None
self._data_suffix = self._run_suffix = None
self._exclude_re = None
self._debug = None
self._file_mapper = None
self._old_sigterm = None
# State machine variables:
# Have we initialized everything?
self._inited = False
self._inited_for_start = False
# Have we started collecting and not stopped it?
self._started = False
# Should we write the debug output?
self._should_write_debug = True
# Build our configuration from a number of sources.
> self.config = read_coverage_config(
config_file=config_file, warn=self._warn,
data_file=data_file, cover_pylib=cover_pylib, timid=timid,
branch=branch, parallel=bool_or_none(data_suffix),
source=source, source_pkgs=source_pkgs, run_omit=omit, run_include=include, debug=debug,
report_omit=omit, report_include=include,
concurrency=concurrency, context=context,
)
/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages/coverage/control.py:246:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
config_file = True, warn = <bound method Coverage._warn of <coverage.control.Coverage object at 0x7f4dfc906700>>
kwargs = {'branch': None, 'concurrency': None, 'context': None, 'cover_pylib': None, ...}, config = <coverage.config.CoverageConfig object at 0x7f4dfc906550>
files_to_try = [('.coveragerc', True, False), ('setup.cfg', False, False), ('tox.ini', False, False), ('pyproject.toml', False, False)], fname = 'pyproject.toml'
our_file = False, specified_file = False, config_read = False
def read_coverage_config(config_file, warn, **kwargs):
"""Read the coverage.py configuration.
Arguments:
config_file: a boolean or string, see the `Coverage` class for the
tricky details.
warn: a function to issue warnings.
all others: keyword arguments from the `Coverage` class, used for
setting values in the configuration.
Returns:
config:
config is a CoverageConfig object read from the appropriate
configuration file.
"""
# Build the configuration from a number of sources:
# 1) defaults:
config = CoverageConfig()
# 2) from a file:
if config_file:
files_to_try = config_files_to_try(config_file)
for fname, our_file, specified_file in files_to_try:
> config_read = config.from_file(fname, warn, our_file=our_file)
/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages/coverage/config.py:561:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <coverage.config.CoverageConfig object at 0x7f4dfc906550>, filename = 'pyproject.toml'
warn = <bound method Coverage._warn of <coverage.control.Coverage object at 0x7f4dfc906700>>, our_file = False
@contract(filename=str)
def from_file(self, filename, warn, our_file):
"""Read configuration from a .rc file.
`filename` is a file name to read.
`our_file` is True if this config file is specifically for coverage,
False if we are examining another config file (tox.ini, setup.cfg)
for possible settings.
Returns True or False, whether the file could be read, and it had some
coverage.py settings in it.
"""
_, ext = os.path.splitext(filename)
if ext == '.toml':
cp = TomlConfigParser(our_file)
else:
cp = HandyConfigParser(our_file)
self.attempted_config_files.append(filename)
try:
> files_read = cp.read(filename)
/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages/coverage/config.py:277:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <coverage.tomlconfig.TomlConfigParser object at 0x7f4dfc7ed610>, filenames = 'pyproject.toml'
def read(self, filenames):
# RawConfigParser takes a filename or list of filenames, but we only
# ever call this with a single filename.
assert isinstance(filenames, (bytes, str, os.PathLike))
filename = os.fspath(filenames)
try:
with open(filename, encoding='utf-8') as fp:
toml_text = fp.read()
except OSError:
return []
if tomllib is not None:
toml_text = substitute_variables(toml_text, os.environ)
try:
self.data = tomllib.loads(toml_text)
except tomllib.TOMLDecodeError as err:
raise TomlDecodeError(str(err)) from err
return [filename]
else:
has_toml = re.search(r"^\[tool\.coverage\.", toml_text, flags=re.MULTILINE)
if self.our_file or has_toml:
# Looks like they meant to read TOML, but we can't read it.
msg = "Can't read {!r} without TOML support. Install with [toml] extra"
> raise ConfigError(msg.format(filename))
E coverage.exceptions.ConfigError: Can't read 'pyproject.toml' without TOML support. Install with [toml] extra
/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages/coverage/tomlconfig.py:66: ConfigError
During handling of the above exception, another exception occurred:
self = <tests.test_config.ConfigTest object at 0x7f4dfd0a2a90>, bad_config = '[tool.coverage.run]\ntimid = "maybe?"\n', msg = 'maybe[?]'
@pytest.mark.parametrize("bad_config, msg", [
("[tool.coverage.run]\ntimid = \"maybe?\"\n", r"maybe[?]"),
("[tool.coverage.run\n", None),
('[tool.coverage.report]\nexclude_lines = ["foo("]\n',
r"Invalid \[tool.coverage.report\].exclude_lines value 'foo\(': " +
r"(unbalanced parenthesis|missing \))"),
('[tool.coverage.report]\npartial_branches = ["foo["]\n',
r"Invalid \[tool.coverage.report\].partial_branches value 'foo\[': " +
r"(unexpected end of regular expression|unterminated character set)"),
('[tool.coverage.report]\npartial_branches_always = ["foo***"]\n',
r"Invalid \[tool.coverage.report\].partial_branches_always value " +
r"'foo\*\*\*': " +
r"multiple repeat"),
('[tool.coverage.run]\nconcurrency="foo"', "not a list"),
("[tool.coverage.report]\nprecision=1.23", "not an integer"),
('[tool.coverage.report]\nfail_under="s"', "not a float"),
])
def test_toml_parse_errors(self, bad_config, msg):
# Im-parsable values raise ConfigError, with details.
self.make_file("pyproject.toml", bad_config)
with pytest.raises(ConfigError, match=msg):
> coverage.Coverage()
E AssertionError: Regex pattern 'maybe[?]' does not match "Can't read 'pyproject.toml' without TOML support. Install with [toml] extra".
/home/tkloczko/rpmbuild/BUILD/coveragepy-6.4.2/tests/test_config.py:209: AssertionError
______________________________________________________________________ FileReporterTest.test_zipfile _______________________________________________________________________
[gw28] linux -- Python 3.8.13 /usr/bin/python3
self = <tests.test_filereporter.FileReporterTest object at 0x7f3b1ac54fa0>
def test_zipfile(self):
sys.path.append("tests/zip1.zip")
# Test that we can get files out of zipfiles, and read their source files.
# The zip1 module is installed by an action in igor.py.
> import zip1
E ModuleNotFoundError: No module named 'zip1'
tests/test_filereporter.py:91: ModuleNotFoundError
_________________________________________________________________ ProcessTest.test_tests_dir_is_importable _________________________________________________________________
[gw9] linux -- Python 3.8.13 /usr/bin/python3
self = <tests.test_process.ProcessTest object at 0x7f1f5ee17af0>
def test_tests_dir_is_importable(self):
# Checks that we can import modules from the tests directory at all!
self.make_file("mycode.py", """\
import covmod1
import covmodzip1
a = 1
print('done')
""")
self.assert_doesnt_exist(".coverage")
out = self.run_command("coverage run mycode.py")
self.assert_exists(".coverage")
> assert out == 'done\n'
E assert "Traceback (m...covmodzip1'\n" == 'done\n'
E - done
E + Traceback (most recent call last):
E + File "mycode.py", line 2, in <module>
E + import covmodzip1
E + ModuleNotFoundError: No module named 'covmodzip1'
/home/tkloczko/rpmbuild/BUILD/coveragepy-6.4.2/tests/test_process.py:50: AssertionError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
Traceback (most recent call last):
File "mycode.py", line 2, in <module>
import covmodzip1
ModuleNotFoundError: No module named 'covmodzip1'
_____________________________________________________________ ConfigTest.test_environment_vars_in_toml_config ______________________________________________________________
[gw33] linux -- Python 3.8.13 /usr/bin/python3
self = <tests.test_config.ConfigTest object at 0x7f2bf71aeb20>
def test_environment_vars_in_toml_config(self):
# Config files can have $envvars in them.
self.make_file("pyproject.toml", """\
[tool.coverage.run]
data_file = "$DATA_FILE.fooey"
branch = $BRANCH
[tool.coverage.report]
exclude_lines = [
"the_$$one",
"another${THING}",
"x${THING}y",
"x${NOTHING}y",
"huh$${X}what",
]
""")
self.set_environ("BRANCH", "true")
self.set_environ("DATA_FILE", "hello-world")
self.set_environ("THING", "ZZZ")
> cov = coverage.Coverage()
/home/tkloczko/rpmbuild/BUILD/coveragepy-6.4.2/tests/test_config.py:251:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages/coverage/control.py:246: in __init__
self.config = read_coverage_config(
/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages/coverage/config.py:561: in read_coverage_config
config_read = config.from_file(fname, warn, our_file=our_file)
/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages/coverage/config.py:277: in from_file
files_read = cp.read(filename)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <coverage.tomlconfig.TomlConfigParser object at 0x7f2bf6ca0c40>, filenames = 'pyproject.toml'
def read(self, filenames):
# RawConfigParser takes a filename or list of filenames, but we only
# ever call this with a single filename.
assert isinstance(filenames, (bytes, str, os.PathLike))
filename = os.fspath(filenames)
try:
with open(filename, encoding='utf-8') as fp:
toml_text = fp.read()
except OSError:
return []
if tomllib is not None:
toml_text = substitute_variables(toml_text, os.environ)
try:
self.data = tomllib.loads(toml_text)
except tomllib.TOMLDecodeError as err:
raise TomlDecodeError(str(err)) from err
return [filename]
else:
has_toml = re.search(r"^\[tool\.coverage\.", toml_text, flags=re.MULTILINE)
if self.our_file or has_toml:
# Looks like they meant to read TOML, but we can't read it.
msg = "Can't read {!r} without TOML support. Install with [toml] extra"
> raise ConfigError(msg.format(filename))
E coverage.exceptions.ConfigError: Can't read 'pyproject.toml' without TOML support. Install with [toml] extra
/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages/coverage/tomlconfig.py:66: ConfigError
__________________________________________ ConfigTest.test_toml_parse_errors[[tool.coverage.report]\nfail_under="s"-not a float] ___________________________________________
[gw17] linux -- Python 3.8.13 /usr/bin/python3
self = <tests.test_config.ConfigTest object at 0x7fc63c7dc220>, bad_config = '[tool.coverage.report]\nfail_under="s"', msg = 'not a float'
@pytest.mark.parametrize("bad_config, msg", [
("[tool.coverage.run]\ntimid = \"maybe?\"\n", r"maybe[?]"),
("[tool.coverage.run\n", None),
('[tool.coverage.report]\nexclude_lines = ["foo("]\n',
r"Invalid \[tool.coverage.report\].exclude_lines value 'foo\(': " +
r"(unbalanced parenthesis|missing \))"),
('[tool.coverage.report]\npartial_branches = ["foo["]\n',
r"Invalid \[tool.coverage.report\].partial_branches value 'foo\[': " +
r"(unexpected end of regular expression|unterminated character set)"),
('[tool.coverage.report]\npartial_branches_always = ["foo***"]\n',
r"Invalid \[tool.coverage.report\].partial_branches_always value " +
r"'foo\*\*\*': " +
r"multiple repeat"),
('[tool.coverage.run]\nconcurrency="foo"', "not a list"),
("[tool.coverage.report]\nprecision=1.23", "not an integer"),
('[tool.coverage.report]\nfail_under="s"', "not a float"),
])
def test_toml_parse_errors(self, bad_config, msg):
# Im-parsable values raise ConfigError, with details.
self.make_file("pyproject.toml", bad_config)
with pytest.raises(ConfigError, match=msg):
> coverage.Coverage()
/home/tkloczko/rpmbuild/BUILD/coveragepy-6.4.2/tests/test_config.py:209:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <coverage.control.Coverage object at 0x7fc63c60a0a0>, data_file = None, data_suffix = None, cover_pylib = None, auto_data = False, timid = None, branch = None
config_file = True, source = None, source_pkgs = None, omit = None, include = None, debug = None, concurrency = None, check_preimported = False, context = None
messages = False
def __init__(
self, data_file=DEFAULT_DATAFILE, data_suffix=None, cover_pylib=None,
auto_data=False, timid=None, branch=None, config_file=True,
source=None, source_pkgs=None, omit=None, include=None, debug=None,
concurrency=None, check_preimported=False, context=None,
messages=False,
): # pylint: disable=too-many-arguments
"""
Many of these arguments duplicate and override values that can be
provided in a configuration file. Parameters that are missing here
will use values from the config file.
`data_file` is the base name of the data file to use. The config value
defaults to ".coverage". None can be provided to prevent writing a data
file. `data_suffix` is appended (with a dot) to `data_file` to create
the final file name. If `data_suffix` is simply True, then a suffix is
created with the machine and process identity included.
`cover_pylib` is a boolean determining whether Python code installed
with the Python interpreter is measured. This includes the Python
standard library and any packages installed with the interpreter.
If `auto_data` is true, then any existing data file will be read when
coverage measurement starts, and data will be saved automatically when
measurement stops.
If `timid` is true, then a slower and simpler trace function will be
used. This is important for some environments where manipulation of
tracing functions breaks the faster trace function.
If `branch` is true, then branch coverage will be measured in addition
to the usual statement coverage.
`config_file` determines what configuration file to read:
* If it is ".coveragerc", it is interpreted as if it were True,
for backward compatibility.
* If it is a string, it is the name of the file to read. If the
file can't be read, it is an error.
* If it is True, then a few standard files names are tried
(".coveragerc", "setup.cfg", "tox.ini"). It is not an error for
these files to not be found.
* If it is False, then no configuration file is read.
`source` is a list of file paths or package names. Only code located
in the trees indicated by the file paths or package names will be
measured.
`source_pkgs` is a list of package names. It works the same as
`source`, but can be used to name packages where the name can also be
interpreted as a file path.
`include` and `omit` are lists of file name patterns. Files that match
`include` will be measured, files that match `omit` will not. Each
will also accept a single string argument.
`debug` is a list of strings indicating what debugging information is
desired.
`concurrency` is a string indicating the concurrency library being used
in the measured code. Without this, coverage.py will get incorrect
results if these libraries are in use. Valid strings are "greenlet",
"eventlet", "gevent", "multiprocessing", or "thread" (the default).
This can also be a list of these strings.
If `check_preimported` is true, then when coverage is started, the
already-imported files will be checked to see if they should be
measured by coverage. Importing measured files before coverage is
started can mean that code is missed.
`context` is a string to use as the :ref:`static context
<static_contexts>` label for collected data.
If `messages` is true, some messages will be printed to stdout
indicating what is happening.
.. versionadded:: 4.0
The `concurrency` parameter.
.. versionadded:: 4.2
The `concurrency` parameter can now be a list of strings.
.. versionadded:: 5.0
The `check_preimported` and `context` parameters.
.. versionadded:: 5.3
The `source_pkgs` parameter.
.. versionadded:: 6.0
The `messages` parameter.
"""
# data_file=None means no disk file at all. data_file missing means
# use the value from the config file.
self._no_disk = data_file is None
if data_file is DEFAULT_DATAFILE:
data_file = None
self.config = None
# This is injectable by tests.
self._debug_file = None
self._auto_load = self._auto_save = auto_data
self._data_suffix_specified = data_suffix
# Is it ok for no data to be collected?
self._warn_no_data = True
self._warn_unimported_source = True
self._warn_preimported_source = check_preimported
self._no_warn_slugs = None
self._messages = messages
# A record of all the warnings that have been issued.
self._warnings = []
# Other instance attributes, set later.
self._data = self._collector = None
self._plugins = None
self._inorout = None
self._data_suffix = self._run_suffix = None
self._exclude_re = None
self._debug = None
self._file_mapper = None
self._old_sigterm = None
# State machine variables:
# Have we initialized everything?
self._inited = False
self._inited_for_start = False
# Have we started collecting and not stopped it?
self._started = False
# Should we write the debug output?
self._should_write_debug = True
# Build our configuration from a number of sources.
> self.config = read_coverage_config(
config_file=config_file, warn=self._warn,
data_file=data_file, cover_pylib=cover_pylib, timid=timid,
branch=branch, parallel=bool_or_none(data_suffix),
source=source, source_pkgs=source_pkgs, run_omit=omit, run_include=include, debug=debug,
report_omit=omit, report_include=include,
concurrency=concurrency, context=context,
)
/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages/coverage/control.py:246:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
config_file = True, warn = <bound method Coverage._warn of <coverage.control.Coverage object at 0x7fc63c60a0a0>>
kwargs = {'branch': None, 'concurrency': None, 'context': None, 'cover_pylib': None, ...}, config = <coverage.config.CoverageConfig object at 0x7fc63c60ad90>
files_to_try = [('.coveragerc', True, False), ('setup.cfg', False, False), ('tox.ini', False, False), ('pyproject.toml', False, False)], fname = 'pyproject.toml'
our_file = False, specified_file = False, config_read = False
def read_coverage_config(config_file, warn, **kwargs):
"""Read the coverage.py configuration.
Arguments:
config_file: a boolean or string, see the `Coverage` class for the
tricky details.
warn: a function to issue warnings.
all others: keyword arguments from the `Coverage` class, used for
setting values in the configuration.
Returns:
config:
config is a CoverageConfig object read from the appropriate
configuration file.
"""
# Build the configuration from a number of sources:
# 1) defaults:
config = CoverageConfig()
# 2) from a file:
if config_file:
files_to_try = config_files_to_try(config_file)
for fname, our_file, specified_file in files_to_try:
> config_read = config.from_file(fname, warn, our_file=our_file)
/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages/coverage/config.py:561:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <coverage.config.CoverageConfig object at 0x7fc63c60ad90>, filename = 'pyproject.toml'
warn = <bound method Coverage._warn of <coverage.control.Coverage object at 0x7fc63c60a0a0>>, our_file = False
@contract(filename=str)
def from_file(self, filename, warn, our_file):
"""Read configuration from a .rc file.
`filename` is a file name to read.
`our_file` is True if this config file is specifically for coverage,
False if we are examining another config file (tox.ini, setup.cfg)
for possible settings.
Returns True or False, whether the file could be read, and it had some
coverage.py settings in it.
"""
_, ext = os.path.splitext(filename)
if ext == '.toml':
cp = TomlConfigParser(our_file)
else:
cp = HandyConfigParser(our_file)
self.attempted_config_files.append(filename)
try:
> files_read = cp.read(filename)
/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages/coverage/config.py:277:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <coverage.tomlconfig.TomlConfigParser object at 0x7fc63c0f4ac0>, filenames = 'pyproject.toml'
def read(self, filenames):
# RawConfigParser takes a filename or list of filenames, but we only
# ever call this with a single filename.
assert isinstance(filenames, (bytes, str, os.PathLike))
filename = os.fspath(filenames)
try:
with open(filename, encoding='utf-8') as fp:
toml_text = fp.read()
except OSError:
return []
if tomllib is not None:
toml_text = substitute_variables(toml_text, os.environ)
try:
self.data = tomllib.loads(toml_text)
except tomllib.TOMLDecodeError as err:
raise TomlDecodeError(str(err)) from err
return [filename]
else:
has_toml = re.search(r"^\[tool\.coverage\.", toml_text, flags=re.MULTILINE)
if self.our_file or has_toml:
# Looks like they meant to read TOML, but we can't read it.
msg = "Can't read {!r} without TOML support. Install with [toml] extra"
> raise ConfigError(msg.format(filename))
E coverage.exceptions.ConfigError: Can't read 'pyproject.toml' without TOML support. Install with [toml] extra
/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages/coverage/tomlconfig.py:66: ConfigError
During handling of the above exception, another exception occurred:
self = <tests.test_config.ConfigTest object at 0x7fc63c7dc220>, bad_config = '[tool.coverage.report]\nfail_under="s"', msg = 'not a float'
@pytest.mark.parametrize("bad_config, msg", [
("[tool.coverage.run]\ntimid = \"maybe?\"\n", r"maybe[?]"),
("[tool.coverage.run\n", None),
('[tool.coverage.report]\nexclude_lines = ["foo("]\n',
r"Invalid \[tool.coverage.report\].exclude_lines value 'foo\(': " +
r"(unbalanced parenthesis|missing \))"),
('[tool.coverage.report]\npartial_branches = ["foo["]\n',
r"Invalid \[tool.coverage.report\].partial_branches value 'foo\[': " +
r"(unexpected end of regular expression|unterminated character set)"),
('[tool.coverage.report]\npartial_branches_always = ["foo***"]\n',
r"Invalid \[tool.coverage.report\].partial_branches_always value " +
r"'foo\*\*\*': " +
r"multiple repeat"),
('[tool.coverage.run]\nconcurrency="foo"', "not a list"),
("[tool.coverage.report]\nprecision=1.23", "not an integer"),
('[tool.coverage.report]\nfail_under="s"', "not a float"),
])
def test_toml_parse_errors(self, bad_config, msg):
# Im-parsable values raise ConfigError, with details.
self.make_file("pyproject.toml", bad_config)
with pytest.raises(ConfigError, match=msg):
> coverage.Coverage()
E AssertionError: Regex pattern 'not a float' does not match "Can't read 'pyproject.toml' without TOML support. Install with [toml] extra".
/home/tkloczko/rpmbuild/BUILD/coveragepy-6.4.2/tests/test_config.py:209: AssertionError
____________________________________________________________ GetZipBytesTest.test_get_encoded_zip_files[utf-8] _____________________________________________________________
[gw0] linux -- Python 3.8.13 /usr/bin/python3
self = <tests.test_python.GetZipBytesTest object at 0x7f3a44cc39a0>, encoding = 'utf-8'
@pytest.mark.parametrize(
"encoding",
["utf-8", "gb2312", "hebrew", "shift_jis", "cp1252"],
)
def test_get_encoded_zip_files(self, encoding):
# See igor.py, do_zipmods, for the text of these files.
zip_file = "tests/zipmods.zip"
sys.path.append(zip_file) # So we can import the files.
filename = zip_file + "/encoded_" + encoding + ".py"
filename = os_sep(filename)
zip_data = get_zip_bytes(filename)
> zip_text = zip_data.decode(encoding)
E AttributeError: 'NoneType' object has no attribute 'decode'
tests/test_python.py:33: AttributeError
___________________________________________________________________ ConfigTest.test_unknown_option_toml ____________________________________________________________________
[gw5] linux -- Python 3.8.13 /usr/bin/python3
self = <tests.test_config.ConfigTest object at 0x7ff260bbda60>
def test_unknown_option_toml(self):
self.make_file("pyproject.toml", """\
[tool.coverage.run]
xyzzy = 17
""")
msg = r"Unrecognized option '\[tool.coverage.run\] xyzzy=' in config file pyproject.toml"
with pytest.warns(CoverageWarning, match=msg):
> _ = coverage.Coverage()
/home/tkloczko/rpmbuild/BUILD/coveragepy-6.4.2/tests/test_config.py:404:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages/coverage/control.py:246: in __init__
self.config = read_coverage_config(
/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages/coverage/config.py:561: in read_coverage_config
config_read = config.from_file(fname, warn, our_file=our_file)
/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages/coverage/config.py:277: in from_file
files_read = cp.read(filename)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <coverage.tomlconfig.TomlConfigParser object at 0x7ff2605f49a0>, filenames = 'pyproject.toml'
def read(self, filenames):
# RawConfigParser takes a filename or list of filenames, but we only
# ever call this with a single filename.
assert isinstance(filenames, (bytes, str, os.PathLike))
filename = os.fspath(filenames)
try:
with open(filename, encoding='utf-8') as fp:
toml_text = fp.read()
except OSError:
return []
if tomllib is not None:
toml_text = substitute_variables(toml_text, os.environ)
try:
self.data = tomllib.loads(toml_text)
except tomllib.TOMLDecodeError as err:
raise TomlDecodeError(str(err)) from err
return [filename]
else:
has_toml = re.search(r"^\[tool\.coverage\.", toml_text, flags=re.MULTILINE)
if self.our_file or has_toml:
# Looks like they meant to read TOML, but we can't read it.
msg = "Can't read {!r} without TOML support. Install with [toml] extra"
> raise ConfigError(msg.format(filename))
E coverage.exceptions.ConfigError: Can't read 'pyproject.toml' without TOML support. Install with [toml] extra
/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages/coverage/tomlconfig.py:66: ConfigError
____________________________________________________________ GetZipBytesTest.test_get_encoded_zip_files[gb2312] ____________________________________________________________
[gw0] linux -- Python 3.8.13 /usr/bin/python3
self = <tests.test_python.GetZipBytesTest object at 0x7f3a44cc3a30>, encoding = 'gb2312'
@pytest.mark.parametrize(
"encoding",
["utf-8", "gb2312", "hebrew", "shift_jis", "cp1252"],
)
def test_get_encoded_zip_files(self, encoding):
# See igor.py, do_zipmods, for the text of these files.
zip_file = "tests/zipmods.zip"
sys.path.append(zip_file) # So we can import the files.
filename = zip_file + "/encoded_" + encoding + ".py"
filename = os_sep(filename)
zip_data = get_zip_bytes(filename)
> zip_text = zip_data.decode(encoding)
E AttributeError: 'NoneType' object has no attribute 'decode'
tests/test_python.py:33: AttributeError
____________________________________________________________ GetZipBytesTest.test_get_encoded_zip_files[hebrew] ____________________________________________________________
[gw0] linux -- Python 3.8.13 /usr/bin/python3
self = <tests.test_python.GetZipBytesTest object at 0x7f3a44cc3ac0>, encoding = 'hebrew'
@pytest.mark.parametrize(
"encoding",
["utf-8", "gb2312", "hebrew", "shift_jis", "cp1252"],
)
def test_get_encoded_zip_files(self, encoding):
# See igor.py, do_zipmods, for the text of these files.
zip_file = "tests/zipmods.zip"
sys.path.append(zip_file) # So we can import the files.
filename = zip_file + "/encoded_" + encoding + ".py"
filename = os_sep(filename)
zip_data = get_zip_bytes(filename)
> zip_text = zip_data.decode(encoding)
E AttributeError: 'NoneType' object has no attribute 'decode'
tests/test_python.py:33: AttributeError
__________________________________________________________ GetZipBytesTest.test_get_encoded_zip_files[shift_jis] ___________________________________________________________
[gw0] linux -- Python 3.8.13 /usr/bin/python3
self = <tests.test_python.GetZipBytesTest object at 0x7f3a44cc3b50>, encoding = 'shift_jis'
@pytest.mark.parametrize(
"encoding",
["utf-8", "gb2312", "hebrew", "shift_jis", "cp1252"],
)
def test_get_encoded_zip_files(self, encoding):
# See igor.py, do_zipmods, for the text of these files.
zip_file = "tests/zipmods.zip"
sys.path.append(zip_file) # So we can import the files.
filename = zip_file + "/encoded_" + encoding + ".py"
filename = os_sep(filename)
zip_data = get_zip_bytes(filename)
> zip_text = zip_data.decode(encoding)
E AttributeError: 'NoneType' object has no attribute 'decode'
tests/test_python.py:33: AttributeError
_____________________________________________________________________ SummaryTest.test_report_just_one _____________________________________________________________________
[gw17] linux -- Python 3.8.13 /usr/bin/python3
self = <tests.test_summary.SummaryTest object at 0x7fc63c5240a0>
def test_report_just_one(self):
# Try reporting just one module
self.make_mycode()
cov = coverage.Coverage()
> self.start_import_stop(cov, "mycode")
/home/tkloczko/rpmbuild/BUILD/coveragepy-6.4.2/tests/test_summary.py:65:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/coveragepy-6.4.2/tests/coveragetest.py:80: in start_import_stop
mod = import_local_file(modname, modfile)
/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages/coverage/misc.py:362: in import_local_file
spec.loader.exec_module(mod)
<frozen importlib._bootstrap_external>:843: in exec_module
???
<frozen importlib._bootstrap>:219: in _call_with_frames_removed
???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
import covmod1
> import covmodzip1
E ModuleNotFoundError: No module named 'covmodzip1'
/tmp/pytest-of-tkloczko/pytest-311/popen-gw17/t6/mycode.py:2: ModuleNotFoundError
_________________________________________________________________________ SummaryTest.test_report __________________________________________________________________________
[gw15] linux -- Python 3.8.13 /usr/bin/python3
self = <tests.test_summary.SummaryTest object at 0x7f4dfcae9df0>
def test_report(self):
self.make_mycode()
cov = coverage.Coverage()
> self.start_import_stop(cov, "mycode")
/home/tkloczko/rpmbuild/BUILD/coveragepy-6.4.2/tests/test_summary.py:43:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/coveragepy-6.4.2/tests/coveragetest.py:80: in start_import_stop
mod = import_local_file(modname, modfile)
/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages/coverage/misc.py:362: in import_local_file
spec.loader.exec_module(mod)
<frozen importlib._bootstrap_external>:843: in exec_module
???
<frozen importlib._bootstrap>:219: in _call_with_frames_removed
???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
import covmod1
> import covmodzip1
E ModuleNotFoundError: No module named 'covmodzip1'
/tmp/pytest-of-tkloczko/pytest-311/popen-gw15/t11/mycode.py:2: ModuleNotFoundError
____________________________________________________________ GetZipBytesTest.test_get_encoded_zip_files[cp1252] ____________________________________________________________
[gw0] linux -- Python 3.8.13 /usr/bin/python3
self = <tests.test_python.GetZipBytesTest object at 0x7f3a44cc3be0>, encoding = 'cp1252'
@pytest.mark.parametrize(
"encoding",
["utf-8", "gb2312", "hebrew", "shift_jis", "cp1252"],
)
def test_get_encoded_zip_files(self, encoding):
# See igor.py, do_zipmods, for the text of these files.
zip_file = "tests/zipmods.zip"
sys.path.append(zip_file) # So we can import the files.
filename = zip_file + "/encoded_" + encoding + ".py"
filename = os_sep(filename)
zip_data = get_zip_bytes(filename)
> zip_text = zip_data.decode(encoding)
E AttributeError: 'NoneType' object has no attribute 'decode'
tests/test_python.py:33: AttributeError
_____________________________________________________________ EnvironmentTest.test_coverage_zip_is_like_python _____________________________________________________________
[gw21] linux -- Python 3.8.13 /usr/bin/python3
self = <tests.test_process.EnvironmentTest object at 0x7f4909233be0>
def test_coverage_zip_is_like_python(self):
# Test running coverage from a zip file itself. Some environments
# (windows?) zip up the coverage main to be used as the coverage
# command.
with open(TRY_EXECFILE) as f:
self.make_file("run_me.py", f.read())
expected = self.run_command("python run_me.py")
cov_main = os.path.join(TESTS_DIR, "covmain.zip")
actual = self.run_command(f"python {cov_main} run run_me.py")
> self.assert_tryexecfile_output(expected, actual)
/home/tkloczko/rpmbuild/BUILD/coveragepy-6.4.2/tests/test_process.py:814:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_process.EnvironmentTest object at 0x7f4909233be0>
expected = '{\n "DATA": "xyzzy",\n "FN_VAL": "my_fn(\'fooey\')",\n "__builtins__.dir": [\n "ArithmeticError Asser...site-packages",\n "/usr/lib64/python3.8/site-packages",\n "/usr/lib/python3.8/site-packages"\n ]\n}\n'
actual = "python3: can't open file '/home/tkloczko/rpmbuild/BUILD/coveragepy-6.4.2/tests/covmain.zip': [Errno 2] No such file or directory\n"
def assert_tryexecfile_output(self, expected, actual):
"""Assert that the output we got is a successful run of try_execfile.py.
`expected` and `actual` must be the same, modulo a few slight known
platform differences.
"""
# First, is this even credible try_execfile.py output?
> assert '"DATA": "xyzzy"' in actual
E assert '"DATA": "xyzzy"' in "python3: can't open file '/home/tkloczko/rpmbuild/BUILD/coveragepy-6.4.2/tests/covmain.zip': [Errno 2] No such file or directory\n"
/home/tkloczko/rpmbuild/BUILD/coveragepy-6.4.2/tests/test_process.py:669: AssertionError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
{
"DATA": "xyzzy",
"FN_VAL": "my_fn('fooey')",
"__builtins__.dir": [
"ArithmeticError AssertionError AttributeError BaseException BlockingIOError BrokenPipeError BufferError BytesWarning ChildProcessError ConnectionAbortedError ConnectionError ConnectionRefusedError ConnectionResetError",
"DeprecationWarning EOFError Ellipsis EnvironmentError Exception False FileExistsError FileNotFoundError FloatingPointError FutureWarning",
"GeneratorExit IOError ImportError ImportWarning IndentationError IndexError InterruptedError IsADirectoryError",
"KeyError KeyboardInterrupt LookupError MemoryError ModuleNotFoundError NameError None NotADirectoryError NotImplemented NotImplementedError",
"OSError OverflowError PendingDeprecationWarning PermissionError ProcessLookupError RecursionError ReferenceError ResourceWarning RuntimeError RuntimeWarning",
"StopAsyncIteration StopIteration SyntaxError SyntaxWarning SystemError SystemExit TabError TimeoutError True TypeError",
"UnboundLocalError UnicodeDecodeError UnicodeEncodeError UnicodeError UnicodeTranslateError UnicodeWarning UserWarning",
"ValueError Warning ZeroDivisionError __build_class__ __debug__ __doc__ __import__ __loader__ __name__ __package__ __spec__",
"abs all any ascii bin bool breakpoint bytearray bytes",
"callable chr classmethod compile complex copyright credits delattr dict dir divmod",
"enumerate eval exec exit filter float format frozenset getattr globals",
"hasattr hash help hex id input int isinstance issubclass iter",
"len license list locals map max memoryview min next object oct open ord",
"pow print property quit range repr reversed round",
"set setattr slice sorted staticmethod str sum super tuple type vars zip"
],
"__builtins__.has_open": true,
"__doc__": "Test file for run_python_file.\n\nThis file is executed two ways::\n\n $ coverage run try_execfile.py\n\nand::\n\n $ python try_execfile.py\n\nThe output is compared to see that the program execution context is the same\nunder coverage and under Python.\n\nIt is not crucial that the execution be identical, there are some differences\nthat are OK. This program canonicalizes the output to gloss over those\ndifferences and get a clean diff.\n\n",
"__file__": "run_me.py",
"__loader__ exists": true,
"__loader__.fullname": "__main__",
"__main__.DATA": "xyzzy",
"__name__": "__main__",
"__package__": null,
"__spec__ exists": false,
"argv0": "run_me.py",
"argv1-n": [],
"os.getcwd": "/tmp/pytest-of-tkloczko/pytest-311/popen-gw21/t12",
"path": [
"/tmp/pytest-of-tkloczko/pytest-311/popen-gw21/t12",
"/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages",
"/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4.2-2.fc35.x86_64/usr/lib/python3.8/site-packages",
"/home/tkloczko/rpmbuild/BUILD/coveragepy-6.4.2/tests/modules",
"/home/tkloczko/rpmbuild/BUILD/coveragepy-6.4.2/tests/zipmods.zip",
"/usr/lib64/python38.zip",
"/usr/lib64/python3.8",
"/usr/lib64/python3.8/lib-dynload",
"/home/tkloczko/.local/lib/python3.8/site-packages",
"/usr/lib64/python3.8/site-packages",
"/usr/lib/python3.8/site-packages"
]
}
python3: can't open file '/home/tkloczko/rpmbuild/BUILD/coveragepy-6.4.2/tests/covmain.zip': [Errno 2] No such file or directory
______________________________________________________________________ ProcessTest.test_fullcoverage _______________________________________________________________________
[gw28] linux -- Python 3.8.13 /usr/bin/python3
self = <tests.test_process.ProcessTest object at 0x7f3b1a783cd0>
@pytest.mark.expensive
@pytest.mark.skipif(not env.C_TRACER, reason="fullcoverage only works with the C tracer.")
@pytest.mark.skipif(env.METACOV, reason="Can't test fullcoverage when measuring ourselves")
def test_fullcoverage(self):
# fullcoverage is a trick to get stdlib modules measured from
# the very beginning of the process. Here we import os and
# then check how many lines are measured.
self.make_file("getenv.py", """\
import os
print("FOOEY == %s" % os.getenv("FOOEY"))
""")
fullcov = os.path.join(os.path.dirname(coverage.__file__), "fullcoverage")
self.set_environ("FOOEY", "BOO")
self.set_environ("PYTHONPATH", fullcov)
out = self.run_command("python -X frozen_modules=off -m coverage run -L getenv.py")
> assert out == "FOOEY == BOO\n"
E assert 'Error proces...ed coverage\n' == 'FOOEY == BOO\n'
E - FOOEY == BOO
E + Error processing line 1 of /home/tkloczko/.local/lib/python3.8/site-packages/subcover.pth:
E +
E + Traceback (most recent call last):
E + File "/usr/lib64/python3.8/site.py", line 169, in addpackage
E + exec(line)
E + File "<string>", line 1, in <module>...
E
E ...Full output truncated (5 lines hidden), use '-vv' to show
/home/tkloczko/rpmbuild/BUILD/coveragepy-6.4.2/tests/test_process.py:568: AssertionError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
Error processing line 1 of /home/tkloczko/.local/lib/python3.8/site-packages/subcover.pth:
Traceback (most recent call last):
File "/usr/lib64/python3.8/site.py", line 169, in addpackage
exec(line)
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'coverage'
Remainder of file ignored
/usr/bin/python3: No module named coverage
_________________________________________ ConfigTest.test_toml_parse_errors[[tool.coverage.report]\nprecision=1.23-not an integer] _________________________________________
[gw10] linux -- Python 3.8.13 /usr/bin/python3
self = <tests.test_config.ConfigTest object at 0x7f4c3e806160>, bad_config = '[tool.coverage.report]\nprecision=1.23', msg = 'not an integer'
@pytest.mark.parametrize("bad_config, msg", [
("[tool.coverage.run]\ntimid = \"maybe?\"\n", r"maybe[?]"),
("[tool.coverage.run\n", None),
('[tool.coverage.report]\nexclude_lines = ["foo("]\n',
r"Invalid \[tool.coverage.report\].exclude_lines value 'foo\(': " +
r"(unbalanced parenthesis|missing \))"),
('[tool.coverage.report]\npartial_branches = ["foo["]\n',
r"Invalid \[tool.coverage.report\].partial_branches value 'foo\[': " +
r"(unexpected end of regular expression|unterminated character set)"),
('[tool.coverage.report]\npartial_branches_always = ["foo***"]\n',
r"Invalid \[tool.coverage.report\].partial_branches_always value " +
r"'foo\*\*\*': " +
r"multiple repeat"),
('[tool.coverage.run]\nconcurrency="foo"', "not a list"),
("[tool.coverage.report]\nprecision=1.23", "not an integer"),
('[tool.coverage.report]\nfail_under="s"', "not a float"),
])
def test_toml_parse_errors(self, bad_config, msg):
# Im-parsable values raise ConfigError, with details.
self.make_file("pyproject.toml", bad_config)
with pytest.raises(ConfigError, match=msg):
> coverage.Coverage()
/home/tkloczko/rpmbuild/BUILD/coveragepy-6.4.2/tests/test_config.py:209:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <coverage.control.Coverage object at 0x7f4c3e538e80>, data_file = None, data_suffix = None, cover_pylib = None, auto_data = False, timid = None, branch = None
config_file = True, source = None, source_pkgs = None, omit = None, include = None, debug = None, concurrency = None, check_preimported = False, context = None
messages = False
def __init__(
self, data_file=DEFAULT_DATAFILE, data_suffix=None, cover_pylib=None,
auto_data=False, timid=None, branch=None, config_file=True,
source=None, source_pkgs=None, omit=None, include=None, debug=None,
concurrency=None, check_preimported=False, context=None,
messages=False,
): # pylint: disable=too-many-arguments
"""
Many of these arguments duplicate and override values that can be
provided in a configuration file. Parameters that are missing here
will use values from the config file.
`data_file` is the base name of the data file to use. The config value
defaults to ".coverage". None can be provided to prevent writing a data
file. `data_suffix` is appended (with a dot) to `data_file` to create
the final file name. If `data_suffix` is simply True, then a suffix is
created with the machine and process identity included.
`cover_pylib` is a boolean determining whether Python code installed
with the Python interpreter is measured. This includes the Python
standard library and any packages installed with the interpreter.
If `auto_data` is true, then any existing data file will be read when
coverage measurement starts, and data will be saved automatically when
measurement stops.
If `timid` is true, then a slower and simpler trace function will be
used. This is important for some environments where manipulation of
tracing functions breaks the faster trace function.
If `branch` is true, then branch coverage will be measured in addition
to the usual statement coverage.
`config_file` determines what configuration file to read:
* If it is ".coveragerc", it is interpreted as if it were True,
for backward compatibility.
* If it is a string, it is the name of the file to read. If the
file can't be read, it is an error.
* If it is True, then a few standard files names are tried
(".coveragerc", "setup.cfg", "tox.ini"). It is not an error for
these files to not be found.
* If it is False, then no configuration file is read.
`source` is a list of file paths or package names. Only code located
in the trees indicated by the file paths or package names will be
measured.
`source_pkgs` is a list of package names. It works the same as
`source`, but can be used to name packages where the name can also be
interpreted as a file path.
`include` and `omit` are lists of file name patterns. Files that match
`include` will be measured, files that match `omit` will not. Each
will also accept a single string argument.
`debug` is a list of strings indicating what debugging information is
desired.
`concurrency` is a string indicating the concurrency library being used
in the measured code. Without this, coverage.py will get incorrect
results if these libraries are in use. Valid strings are "greenlet",
"eventlet", "gevent", "multiprocessing", or "thread" (the default).
This can also be a list of these strings.
If `check_preimported` is true, then when coverage is started, the
already-imported files will be checked to see if they should be
measured by coverage. Importing measured files before coverage is
started can mean that code is missed.
`context` is a string to use as the :ref:`static context
<static_contexts>` label for collected data.
If `messages` is true, some messages will be printed to stdout
indicating what is happening.
.. versionadded:: 4.0
The `concurrency` parameter.
.. versionadded:: 4.2
The `concurrency` parameter can now be a list of strings.
.. versionadded:: 5.0
The `check_preimported` and `context` parameters.
.. versionadded:: 5.3
The `source_pkgs` parameter.
.. versionadded:: 6.0
The `messages` parameter.
"""
# data_file=None means no disk file at all. data_file missing means
# use the value from the config file.
self._no_disk = data_file is None
if data_file is DEFAULT_DATAFILE:
data_file = None
self.config = None
# This is injectable by tests.
self._debug_file = None
self._auto_load = self._auto_save = auto_data
self._data_suffix_specified = data_suffix
# Is it ok for no data to be collected?
self._warn_no_data = True
self._warn_unimported_source = True
self._warn_preimported_source = check_preimported
self._no_warn_slugs = None
self._messages = messages
# A record of all the warnings that have been issued.
self._warnings = []
# Other instance attributes, set later.
self._data = self._collector = None
self._plugins = None
self._inorout = None
self._data_suffix = self._run_suffix = None
self._exclude_re = None
self._debug = None
self._file_mapper = None
self._old_sigterm = None
# State machine variables:
# Have we initialized everything?
self._inited = False
self._inited_for_start = False
# Have we started collecting and not stopped it?
self._started = False
# Should we write the debug output?
self._should_write_debug = True
# Build our configuration from a number of sources.
> self.config = read_coverage_config(
config_file=config_file, warn=self._warn,
data_file=data_file, cover_pylib=cover_pylib, timid=timid,
branch=branch, parallel=bool_or_none(data_suffix),
source=source, source_pkgs=source_pkgs, run_omit=omit, run_include=include, debug=debug,
report_omit=omit, report_include=include,
concurrency=concurrency, context=context,
)
/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages/coverage/control.py:246:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
config_file = True, warn = <bound method Coverage._warn of <coverage.control.Coverage object at 0x7f4c3e538e80>>
kwargs = {'branch': None, 'concurrency': None, 'context': None, 'cover_pylib': None, ...}, config = <coverage.config.CoverageConfig object at 0x7f4c3e538940>
files_to_try = [('.coveragerc', True, False), ('setup.cfg', False, False), ('tox.ini', False, False), ('pyproject.toml', False, False)], fname = 'pyproject.toml'
our_file = False, specified_file = False, config_read = False
def read_coverage_config(config_file, warn, **kwargs):
"""Read the coverage.py configuration.
Arguments:
config_file: a boolean or string, see the `Coverage` class for the
tricky details.
warn: a function to issue warnings.
all others: keyword arguments from the `Coverage` class, used for
setting values in the configuration.
Returns:
config:
config is a CoverageConfig object read from the appropriate
configuration file.
"""
# Build the configuration from a number of sources:
# 1) defaults:
config = CoverageConfig()
# 2) from a file:
if config_file:
files_to_try = config_files_to_try(config_file)
for fname, our_file, specified_file in files_to_try:
> config_read = config.from_file(fname, warn, our_file=our_file)
/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages/coverage/config.py:561:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <coverage.config.CoverageConfig object at 0x7f4c3e538940>, filename = 'pyproject.toml'
warn = <bound method Coverage._warn of <coverage.control.Coverage object at 0x7f4c3e538e80>>, our_file = False
@contract(filename=str)
def from_file(self, filename, warn, our_file):
"""Read configuration from a .rc file.
`filename` is a file name to read.
`our_file` is True if this config file is specifically for coverage,
False if we are examining another config file (tox.ini, setup.cfg)
for possible settings.
Returns True or False, whether the file could be read, and it had some
coverage.py settings in it.
"""
_, ext = os.path.splitext(filename)
if ext == '.toml':
cp = TomlConfigParser(our_file)
else:
cp = HandyConfigParser(our_file)
self.attempted_config_files.append(filename)
try:
> files_read = cp.read(filename)
/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages/coverage/config.py:277:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <coverage.tomlconfig.TomlConfigParser object at 0x7f4c3e2774f0>, filenames = 'pyproject.toml'
def read(self, filenames):
# RawConfigParser takes a filename or list of filenames, but we only
# ever call this with a single filename.
assert isinstance(filenames, (bytes, str, os.PathLike))
filename = os.fspath(filenames)
try:
with open(filename, encoding='utf-8') as fp:
toml_text = fp.read()
except OSError:
return []
if tomllib is not None:
toml_text = substitute_variables(toml_text, os.environ)
try:
self.data = tomllib.loads(toml_text)
except tomllib.TOMLDecodeError as err:
raise TomlDecodeError(str(err)) from err
return [filename]
else:
has_toml = re.search(r"^\[tool\.coverage\.", toml_text, flags=re.MULTILINE)
if self.our_file or has_toml:
# Looks like they meant to read TOML, but we can't read it.
msg = "Can't read {!r} without TOML support. Install with [toml] extra"
> raise ConfigError(msg.format(filename))
E coverage.exceptions.ConfigError: Can't read 'pyproject.toml' without TOML support. Install with [toml] extra
/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages/coverage/tomlconfig.py:66: ConfigError
During handling of the above exception, another exception occurred:
self = <tests.test_config.ConfigTest object at 0x7f4c3e806160>, bad_config = '[tool.coverage.report]\nprecision=1.23', msg = 'not an integer'
@pytest.mark.parametrize("bad_config, msg", [
("[tool.coverage.run]\ntimid = \"maybe?\"\n", r"maybe[?]"),
("[tool.coverage.run\n", None),
('[tool.coverage.report]\nexclude_lines = ["foo("]\n',
r"Invalid \[tool.coverage.report\].exclude_lines value 'foo\(': " +
r"(unbalanced parenthesis|missing \))"),
('[tool.coverage.report]\npartial_branches = ["foo["]\n',
r"Invalid \[tool.coverage.report\].partial_branches value 'foo\[': " +
r"(unexpected end of regular expression|unterminated character set)"),
('[tool.coverage.report]\npartial_branches_always = ["foo***"]\n',
r"Invalid \[tool.coverage.report\].partial_branches_always value " +
r"'foo\*\*\*': " +
r"multiple repeat"),
('[tool.coverage.run]\nconcurrency="foo"', "not a list"),
("[tool.coverage.report]\nprecision=1.23", "not an integer"),
('[tool.coverage.report]\nfail_under="s"', "not a float"),
])
def test_toml_parse_errors(self, bad_config, msg):
# Im-parsable values raise ConfigError, with details.
self.make_file("pyproject.toml", bad_config)
with pytest.raises(ConfigError, match=msg):
> coverage.Coverage()
E AssertionError: Regex pattern 'not an integer' does not match "Can't read 'pyproject.toml' without TOML support. Install with [toml] extra".
/home/tkloczko/rpmbuild/BUILD/coveragepy-6.4.2/tests/test_config.py:209: AssertionError
__________________________________________________________________ test_xdist_sys_path_nuttiness_is_fixed __________________________________________________________________
[gw18] linux -- Python 3.8.13 /usr/bin/python3
def test_xdist_sys_path_nuttiness_is_fixed():
# See conftest.py:fix_xdist_sys_path
assert sys.path[1] != ''
> assert os.environ.get('PYTHONPATH') is None
E AssertionError: assert '/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4.2-2.fc35.x86_64/usr/lib/python3.8/site-packages' is None
E + where '/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4.2-2.fc35.x86_64/usr/lib/python3.8/site-packages' = <bound method Mapping.get of environ({'PATH': '/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4.2-2.fc35.x86_64/u...T_WORKER_COUNT': '48', 'PYTEST_CURRENT_TEST': 'tests/test_testing.py::test_xdist_sys_path_nuttiness_is_fixed (call)'})>('PYTHONPATH')
E + where <bound method Mapping.get of environ({'PATH': '/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4.2-2.fc35.x86_64/u...T_WORKER_COUNT': '48', 'PYTEST_CURRENT_TEST': 'tests/test_testing.py::test_xdist_sys_path_nuttiness_is_fixed (call)'})> = environ({'PATH': '/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4.2-2.fc35.x86_64/usr/bin:/usr/bin:/usr/sbin:/us...ST_WORKER_COUNT': '48', 'PYTEST_CURRENT_TEST': 'tests/test_testing.py::test_xdist_sys_path_nuttiness_is_fixed (call)'}).get
E + where environ({'PATH': '/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4.2-2.fc35.x86_64/usr/bin:/usr/bin:/usr/sbin:/us...ST_WORKER_COUNT': '48', 'PYTEST_CURRENT_TEST': 'tests/test_testing.py::test_xdist_sys_path_nuttiness_is_fixed (call)'}) = os.environ
tests/test_testing.py:29: AssertionError
___________________________________________________________________________ test_without_module ____________________________________________________________________________
[gw25] linux -- Python 3.8.13 /usr/bin/python3
def test_without_module():
toml1 = tomlconfig.tomllib
with without_module(tomlconfig, 'tomllib'):
toml2 = tomlconfig.tomllib
toml3 = tomlconfig.tomllib
> assert toml1 is toml3 is not None
E assert None is not None
tests/test_testing.py:365: AssertionError
_____________________________________________________________________ SummaryTest.test_report_wildcard _____________________________________________________________________
[gw33] linux -- Python 3.8.13 /usr/bin/python3
self = <tests.test_summary.SummaryTest object at 0x7f2bf6f0f430>
def test_report_wildcard(self):
# Try reporting using wildcards to get the modules.
self.make_mycode()
# Wildcard is handled by shell or cmdline.py, so use real commands
self.run_command("coverage run mycode.py")
report = self.report_from_command("coverage report my*.py")
# Name Stmts Miss Cover
# -------------------------------
# mycode.py 4 0 100%
# -------------------------------
# TOTAL 4 0 100%
assert self.line_count(report) == 5
assert "/coverage/" not in report
assert "/tests/modules/covmod1.py " not in report
assert "/tests/zipmods.zip/covmodzip1.py " not in report
assert "mycode.py " in report
> assert self.last_line_squeezed(report) == "TOTAL 4 0 100%"
E AssertionError: assert 'TOTAL 4 2 50%' == 'TOTAL 4 0 100%'
E - TOTAL 4 0 100%
E + TOTAL 4 2 50%
/home/tkloczko/rpmbuild/BUILD/coveragepy-6.4.2/tests/test_summary.py:99: AssertionError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
Traceback (most recent call last):
File "mycode.py", line 2, in <module>
import covmodzip1
ModuleNotFoundError: No module named 'covmodzip1'
Name Stmts Miss Cover
-------------------------------
mycode.py 4 2 50%
-------------------------------
TOTAL 4 2 50%
____________________________________________________________________ SummaryTest.test_report_including _____________________________________________________________________
[gw43] linux -- Python 3.8.13 /usr/bin/python3
self = <tests.test_summary.SummaryTest object at 0x7f4acbc80820>
def test_report_including(self):
# Try reporting while including some modules
self.make_mycode()
cov = coverage.Coverage()
> self.start_import_stop(cov, "mycode")
/home/tkloczko/rpmbuild/BUILD/coveragepy-6.4.2/tests/test_summary.py:125:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/coveragepy-6.4.2/tests/coveragetest.py:80: in start_import_stop
mod = import_local_file(modname, modfile)
/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages/coverage/misc.py:362: in import_local_file
spec.loader.exec_module(mod)
<frozen importlib._bootstrap_external>:843: in exec_module
???
<frozen importlib._bootstrap>:219: in _call_with_frames_removed
???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
import covmod1
> import covmodzip1
E ModuleNotFoundError: No module named 'covmodzip1'
/tmp/pytest-of-tkloczko/pytest-311/popen-gw43/t12/mycode.py:2: ModuleNotFoundError
_____________________________________________________________________ SummaryTest.test_report_omitting _____________________________________________________________________
[gw44] linux -- Python 3.8.13 /usr/bin/python3
self = <tests.test_summary.SummaryTest object at 0x7f5d0ecde6d0>
def test_report_omitting(self):
# Try reporting while omitting some modules
self.make_mycode()
cov = coverage.Coverage()
> self.start_import_stop(cov, "mycode")
/home/tkloczko/rpmbuild/BUILD/coveragepy-6.4.2/tests/test_summary.py:105:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/coveragepy-6.4.2/tests/coveragetest.py:80: in start_import_stop
mod = import_local_file(modname, modfile)
/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages/coverage/misc.py:362: in import_local_file
spec.loader.exec_module(mod)
<frozen importlib._bootstrap_external>:843: in exec_module
???
<frozen importlib._bootstrap>:219: in _call_with_frames_removed
???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
import covmod1
> import covmodzip1
E ModuleNotFoundError: No module named 'covmodzip1'
/tmp/pytest-of-tkloczko/pytest-311/popen-gw44/t9/mycode.py:2: ModuleNotFoundError
========================================================================= short test summary info ==========================================================================
SKIPPED [1] tests/test_arcs.py:1334: Match-case is new in 3.10
SKIPPED [1] tests/test_arcs.py:1350: Match-case is new in 3.10
SKIPPED [1] tests/test_arcs.py:1318: Match-case is new in 3.10
SKIPPED [2] tests/test_concurrency.py:224: Can't test: Couldn't trace with concurrency=greenlet, the module isn't installed.
SKIPPED [2] tests/test_concurrency.py:224: Can't test: Couldn't trace with concurrency=gevent, the module isn't installed.
SKIPPED [3] tests/test_concurrency.py:224: Can't test: Couldn't trace with concurrency=eventlet, the module isn't installed.
SKIPPED [1] tests/test_concurrency.py:341: Can't run test without gevent installed.
SKIPPED [2] tests/test_concurrency.py:478: Can't test: Couldn't trace with concurrency=eventlet, the module isn't installed.
SKIPPED [1] tests/test_files.py:430: Only need to run Windows tests on Windows.
SKIPPED [1] tests/test_misc.py:109: Contracts are disabled, can't test them
SKIPPED [1] tests/test_misc.py:99: Contracts are disabled, can't test them
SKIPPED [1] tests/test_misc.py:89: Contracts are disabled, can't test them
SKIPPED [1] tests/test_misc.py:122: Contracts are disabled, can't test them
SKIPPED [1] tests/test_oddball.py:209: This is too expensive for now (30s)
SKIPPED [1] tests/test_parser.py:422: Match-case is new in 3.10
SKIPPED [1] tests/test_phystokens.py:120: Soft keywords are new in Python 3.10
SKIPPED [1] tests/test_plugins.py:267: This test is only about PyTracer.
SKIPPED [1] tests/test_python.py:50: not windows
SKIPPED [1] tests/test_summary.py:686: .pyw files are only on Windows.
XFAIL tests/test_arcs.py::LoopArcTest::test_incorrect_loop_exit_bug_1175
<3.10 traced final pass incorrectly
XFAIL tests/test_arcs.py::LoopArcTest::test_incorrect_if_bug_1175
<3.10 traced final pass incorrectly
ERROR tests/test_venv.py::VirtualenvTest::test_third_party_venv_isnt_measured[coverage] - assert 127 == 0
ERROR tests/test_venv.py::VirtualenvTest::test_third_party_venv_isnt_measured[python -m coverage] - assert 127 == 0
ERROR tests/test_venv.py::VirtualenvTest::test_us_in_venv_isnt_measured[coverage] - assert 127 == 0
ERROR tests/test_venv.py::VirtualenvTest::test_us_in_venv_isnt_measured[python -m coverage] - assert 127 == 0
ERROR tests/test_venv.py::VirtualenvTest::test_venv_isnt_measured[coverage] - assert 127 == 0
ERROR tests/test_venv.py::VirtualenvTest::test_venv_isnt_measured[python -m coverage] - assert 127 == 0
ERROR tests/test_venv.py::VirtualenvTest::test_venv_with_dynamic_plugin[coverage] - assert 127 == 0
ERROR tests/test_venv.py::VirtualenvTest::test_venv_with_dynamic_plugin[python -m coverage] - assert 127 == 0
ERROR tests/test_venv.py::VirtualenvTest::test_installed_namespace_packages[coverage] - assert 127 == 0
ERROR tests/test_venv.py::VirtualenvTest::test_installed_namespace_packages[python -m coverage] - assert 127 == 0
ERROR tests/test_venv.py::VirtualenvTest::test_bug_888[coverage] - assert 127 == 0
ERROR tests/test_venv.py::VirtualenvTest::test_bug_888[python -m coverage] - assert 127 == 0
FAILED tests/test_config.py::ConfigTest::test_toml_config_file - coverage.exceptions.ConfigError: Can't read 'pyproject.toml' without TOML support. Install with [toml] e...
FAILED tests/test_config.py::ConfigTest::test_toml_parse_errors[[tool.coverage.run]\nconcurrency="foo"-not a list] - AssertionError: Regex pattern 'not a list' does not ...
FAILED tests/test_config.py::ConfigTest::test_toml_parse_errors[[tool.coverage.report]\npartial_branches_always = ["foo***"]\n-Invalid \\[tool.coverage.report\\].partial_branches_always value 'foo\\*\\*\\*': multiple repeat]
FAILED tests/test_config.py::ConfigTest::test_toml_parse_errors[[tool.coverage.report]\npartial_branches = ["foo["]\n-Invalid \\[tool.coverage.report\\].partial_branches value 'foo\\[': (unexpected end of regular expression|unterminated character set)]
FAILED tests/test_config.py::ConfigTest::test_toml_parse_errors[[tool.coverage.report]\nexclude_lines = ["foo("]\n-Invalid \\[tool.coverage.report\\].exclude_lines value 'foo\\(': (unbalanced parenthesis|missing \\))]
FAILED tests/test_config.py::ConfigTest::test_tilde_in_toml_config - coverage.exceptions.ConfigError: Can't read 'pyproject.toml' without TOML support. Install with [tom...
FAILED tests/test_config.py::ConfigTest::test_toml_parse_errors[[tool.coverage.run]\ntimid = "maybe?"\n-maybe[?]] - AssertionError: Regex pattern 'maybe[?]' does not mat...
FAILED tests/test_filereporter.py::FileReporterTest::test_zipfile - ModuleNotFoundError: No module named 'zip1'
FAILED tests/test_process.py::ProcessTest::test_tests_dir_is_importable - assert "Traceback (m...covmodzip1'\n" == 'done\n'
FAILED tests/test_config.py::ConfigTest::test_environment_vars_in_toml_config - coverage.exceptions.ConfigError: Can't read 'pyproject.toml' without TOML support. Instal...
FAILED tests/test_config.py::ConfigTest::test_toml_parse_errors[[tool.coverage.report]\nfail_under="s"-not a float] - AssertionError: Regex pattern 'not a float' does no...
FAILED tests/test_python.py::GetZipBytesTest::test_get_encoded_zip_files[utf-8] - AttributeError: 'NoneType' object has no attribute 'decode'
FAILED tests/test_config.py::ConfigTest::test_unknown_option_toml - coverage.exceptions.ConfigError: Can't read 'pyproject.toml' without TOML support. Install with [toml...
FAILED tests/test_python.py::GetZipBytesTest::test_get_encoded_zip_files[gb2312] - AttributeError: 'NoneType' object has no attribute 'decode'
FAILED tests/test_python.py::GetZipBytesTest::test_get_encoded_zip_files[hebrew] - AttributeError: 'NoneType' object has no attribute 'decode'
FAILED tests/test_python.py::GetZipBytesTest::test_get_encoded_zip_files[shift_jis] - AttributeError: 'NoneType' object has no attribute 'decode'
FAILED tests/test_summary.py::SummaryTest::test_report_just_one - ModuleNotFoundError: No module named 'covmodzip1'
FAILED tests/test_summary.py::SummaryTest::test_report - ModuleNotFoundError: No module named 'covmodzip1'
FAILED tests/test_python.py::GetZipBytesTest::test_get_encoded_zip_files[cp1252] - AttributeError: 'NoneType' object has no attribute 'decode'
FAILED tests/test_process.py::EnvironmentTest::test_coverage_zip_is_like_python - assert '"DATA": "xyzzy"' in "python3: can't open file '/home/tkloczko/rpmbuild/BUILD/co...
FAILED tests/test_process.py::ProcessTest::test_fullcoverage - assert 'Error proces...ed coverage\n' == 'FOOEY == BOO\n'
FAILED tests/test_config.py::ConfigTest::test_toml_parse_errors[[tool.coverage.report]\nprecision=1.23-not an integer] - AssertionError: Regex pattern 'not an integer' d...
FAILED tests/test_testing.py::test_xdist_sys_path_nuttiness_is_fixed - AssertionError: assert '/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.4.2-2.fc35.x86_64/usr/...
FAILED tests/test_testing.py::test_without_module - assert None is not None
FAILED tests/test_summary.py::SummaryTest::test_report_wildcard - AssertionError: assert 'TOTAL 4 2 50%' == 'TOTAL 4 0 100%'
FAILED tests/test_summary.py::SummaryTest::test_report_including - ModuleNotFoundError: No module named 'covmodzip1'
FAILED tests/test_summary.py::SummaryTest::test_report_omitting - ModuleNotFoundError: No module named 'covmodzip1'
27 failed, 1099 passed, 24 skipped, 2 xfailed, 12 errors in 15.45s |
Just FTR: tested 6.4.3 and result still is the same. |
Can you drop patch with such instrumentation? |
I added some quick verbose debugging in branch nedbat/debug-1373. Install it like this:
then /tmp/coverage_pth_files.txt has details. |
Here is result or 7.0.1 + 54ea97a [tkloczko@pers-jacek tmp]$ cat coverage_pth_files.txt
pytest_sessionstart start
Looking for a pth directory in pid 235645
possible_pth_dirs:
pth files in pth_dir=PosixPath('/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1'): []
pth files in pth_dir=PosixPath('/usr/bin'): []
pth files in pth_dir=PosixPath('/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-7.0.1-2.fc35.x86_64/usr/lib64/python3.8/site-packages'): []
pth files in pth_dir=PosixPath('/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-7.0.1-2.fc35.x86_64/usr/lib/python3.8/site-packages'): []
pth files in pth_dir=PosixPath('/usr/lib64/python38.zip'): []
pth files in pth_dir=PosixPath('/usr/lib64/python3.8'): []
pth files in pth_dir=PosixPath('/usr/lib64/python3.8/lib-dynload'): []
pth files in pth_dir=PosixPath('/usr/lib64/python3.8/site-packages'): [PosixPath('/usr/lib64/python3.8/site-packages/matplotlib-3.6.2-py3.8-nspkg.pth')]
Trying pth_dir=PosixPath('/usr/lib64/python3.8/site-packages')
pth_dir contains ['__pycache__', 'libdnf', 'hawkey', 'gpg', 'rpm', 'rpm-4.17.0-py3.8.egg-info', 'libcomps', 'backports', 'gi', 'PyGObject-3.42.2.egg-info', 'pypamtest.so', 'speechd', 'speechd_config', 'Brlapi-0.8.3-py3.8.egg-info', 'brlapi.cpython-38-x86_64-linux-gnu.so', 'numpy', 'numpy-1.23.1.dist-info', 'libcomps-0.1.19-py3.8.egg-info', '_tdb_text.py', 'tdb.cpython-38-x86_64-linux-gnu.so', '_ldb_text.py', 'ldb.cpython-38-x86_64-linux-gnu.so', 'talloc.cpython-38-x86_64-linux-gnu.so', '_tevent.cpython-38-x86_64-linux-gnu.so', 'tevent.py', 'samba', 'lxml', 'lxml-4.9.1.dist-info', 'matplotlib', 'zope', 'gpg-1.18.0_unknown-py3.8.egg-info', 'PIL', 'Pillow-9.3.0.dist-info', 'kiwisolver', 'kiwisolver-1.4.4.dist-info', 'fontTools', 'fonttools-4.38.0.dist-info', 'contourpy', 'contourpy-1.0.6.dist-info', 'matplotlib-3.6.2.dist-info', 'mpl_toolkits', 'matplotlib-3.6.2-py3.8-nspkg.pth', 'pylab.py', 'pyrsistent', 'pyrsistent-0.19.2.dist-info', '_pyrsistent_version.py', 'pvectorc.cpython-38-x86_64-linux-gnu.so', 'MarkupSafe-2.1.1.dist-info', 'markupsafe']
Couldn't use pth_dir=PosixPath('/usr/lib64/python3.8/site-packages'), exc=PermissionError(13, 'Permission denied')
pth files in pth_dir=PosixPath('/usr/lib/python3.8/site-packages'): [PosixPath('/usr/lib/python3.8/site-packages/sphinxcontrib_serializinghtml-1.1.5-py3.8-nspkg.pth'), PosixPath('/usr/lib/python3.8/site-packages/sphinxcontrib_qthelp-1.0.3.dev20221204-py3.8-nspkg.pth'), PosixPath('/usr/lib/python3.8/site-packages/sphinxcontrib_jsmath-1.0.1.dev20221204-py3.8-nspkg.pth'), PosixPath('/usr/lib/python3.8/site-packages/sphinxcontrib_htmlhelp-2.0.0-py3.8-nspkg.pth'), PosixPath('/usr/lib/python3.8/site-packages/sphinxcontrib_devhelp-1.0.2.dev20221204-py3.8-nspkg.pth'), PosixPath('/usr/lib/python3.8/site-packages/sphinxcontrib_applehelp-1.0.2.dev20221204-py3.8-nspkg.pth'), PosixPath('/usr/lib/python3.8/site-packages/distutils-precedence.pth'), PosixPath('/usr/lib/python3.8/site-packages/sphinxcontrib_restbuilder-0.3-py3.8-nspkg.pth')]
Trying pth_dir=PosixPath('/usr/lib/python3.8/site-packages')
pth_dir contains ['__pycache__', 'distro', 'six-1.16.0.dist-info', 'six.py', 'dateutil', 'python_dateutil-2.8.2.dist-info', 'dnf', 'dnf-plugins', 'dnfpluginscore', 'mesonbuild', 'pbr', 'pbr-5.9.0.dist-info', 'extras', 'extras-1.0.0.dist-info', 'fixtures', 'fixtures-4.0.0.dist-info', 'testtools', 'testtools-2.5.0.dist-info', 'zope', 'zc', 'gi', 'pygtkcompat', 'pyatspi', 'louis', 'orca', 'sphinxext', 'dns', 'dnspython-2.2.1.dist-info', 'sphinxcontrib', 'cssselect', 'cssselect-1.1.0.dist-info', 'scour', 'scour-0.38.2.dist-info', 'appdirs-1.4.4.dist-info', 'appdirs.py', 'distro-1.8.0.dist-info', 'lit', 'lit-15.0.6.dist-info', 'jaraco', 'xcbgen', 'pdm', 'louis-3.24.0-py3.8.egg-info', 'pyparsing', 'pyparsing-3.0.9.dist-info', 'packaging', 'packaging-21.3.dist-info', 'olefile', 'olefile-0.46.dist-info', 'cycler-0.11.0.dist-info', 'cycler.py', 'google', 'meson-1.0.0.dist-info', 'traitlets', 'traitlets-5.7.1.dist-info', 'attr', 'attrs', 'attrs-22.2.0.dist-info', 'zipp', 'zipp-3.11.0.dist-info', 'importlib_resources', 'importlib_resources-5.10.1.dist-info', 'ply', 'ply-3.11.dist-info', 'platformdirs', 'platformdirs-2.6.0.dist-info', 'pkgutil_resolve_name-1.3.10.dist-info', 'pkgutil_resolve_name.py', 'tomli', 'tomli-2.0.1.dist-info', 'docutils', 'docutils-0.19.dist-info', 'Pygments-2.13.0.dist-info', 'pygments', 'exceptiongroup', 'exceptiongroup-1.0.0.dist-info', 'pep517', 'pep517-0.13.0.dist-info', 'urllib3', 'urllib3-1.26.12.dist-info', 'sphinxcontrib_serializinghtml-1.1.5.dist-info', 'sphinxcontrib_serializinghtml-1.1.5-py3.8-nspkg.pth', 'sphinxcontrib_qthelp-1.0.3.dev20221204.dist-info', 'sphinxcontrib_qthelp-1.0.3.dev20221204-py3.8-nspkg.pth', 'sphinxcontrib_jsmath-1.0.1.dev20221204.dist-info', 'sphinxcontrib_jsmath-1.0.1.dev20221204-py3.8-nspkg.pth', 'sphinxcontrib_htmlhelp-2.0.0.dist-info', 'sphinxcontrib_htmlhelp-2.0.0-py3.8-nspkg.pth', 'sphinxcontrib_devhelp-1.0.2.dev20221204-py3.8.egg-info', 'sphinxcontrib_devhelp-1.0.2.dev20221204-py3.8-nspkg.pth', 'sphinxcontrib_applehelp-1.0.2.dev20221204.dist-info', 'sphinxcontrib_applehelp-1.0.2.dev20221204-py3.8-nspkg.pth', 'alabaster', 'alabaster-0.7.12.dist-info', 'sortedcontainers', 'sortedcontainers-2.4.0.dist-info', 'snowballstemmer', 'snowballstemmer-2.2.0.dist-info', '_distutils_hack', 'pkg_resources', 'setuptools', 'setuptools-65.6.3.dist-info', 'distutils-precedence.pth', 'pytz', 'pytz-2022.4.dist-info', 'Babel-2.11.0.dist-info', 'babel', 'pluggy', 'pluggy-1.0.0.dist-info', 'Jinja2-3.1.2.dist-info', 'jinja2', 'iniconfig', 'iniconfig-1.1.1.dist-info', '_pytest', 'pytest', 'pytest-7.2.0.dist-info', 'py.py', 'importlib_metadata', 'importlib_metadata-5.1.0.dist-info', 'imagesize', 'imagesize-1.4.1.dist-info', 'idna', 'idna-3.4.dist-info', 'execnet', 'execnet-1.9.0.dist-info', 'enchant', 'pyenchant-3.2.2.dist-info', 'charset_normalizer', 'charset_normalizer-3.0.1.dist-info', 'requests', 'requests-2.28.1.dist-info', 'sphinx', 'sphinx-5.3.0.dist-info', 'sphinx_rst_builder', 'sphinx_rst_builder-0.0.3.dist-info', 'sphinx_tabs', 'sphinx_tabs-3.4.1.dist-info', 'sphinx_rtd_theme', 'sphinx_rtd_theme-1.1.1.dist-info', 'sphinxcontrib_restbuilder-0.3.dist-info', 'sphinxcontrib_restbuilder-0.3-py3.8-nspkg.pth', 'sphinxcontrib_spelling-7.6.0.dist-info', 'pytest_xdist-3.1.0.dist-info', 'xdist', 'pip', 'pip-22.3.1.dist-info', 'hypothesis', 'hypothesis-6.61.0.dist-info', '_hypothesis_ftz_detector.py', '_hypothesis_pytestplugin.py', 'build', 'build-0.9.0.dist-info', 'wheel', 'wheel-0.38.4.dist-info', 'flaky', 'flaky-3.7.0.dist-info']
Couldn't use pth_dir=PosixPath('/usr/lib/python3.8/site-packages'), exc=PermissionError(13, 'Permission denied')
Last chance: sysconfig.get_path('purelib')='/usr/lib/python3.8/site-packages'
Trying pth_dir=PosixPath('/usr/lib/python3.8/site-packages')
pth_dir contains ['__pycache__', 'distro', 'six-1.16.0.dist-info', 'six.py', 'dateutil', 'python_dateutil-2.8.2.dist-info', 'dnf', 'dnf-plugins', 'dnfpluginscore', 'mesonbuild', 'pbr', 'pbr-5.9.0.dist-info', 'extras', 'extras-1.0.0.dist-info', 'fixtures', 'fixtures-4.0.0.dist-info', 'testtools', 'testtools-2.5.0.dist-info', 'zope', 'zc', 'gi', 'pygtkcompat', 'pyatspi', 'louis', 'orca', 'sphinxext', 'dns', 'dnspython-2.2.1.dist-info', 'sphinxcontrib', 'cssselect', 'cssselect-1.1.0.dist-info', 'scour', 'scour-0.38.2.dist-info', 'appdirs-1.4.4.dist-info', 'appdirs.py', 'distro-1.8.0.dist-info', 'lit', 'lit-15.0.6.dist-info', 'jaraco', 'xcbgen', 'pdm', 'louis-3.24.0-py3.8.egg-info', 'pyparsing', 'pyparsing-3.0.9.dist-info', 'packaging', 'packaging-21.3.dist-info', 'olefile', 'olefile-0.46.dist-info', 'cycler-0.11.0.dist-info', 'cycler.py', 'google', 'meson-1.0.0.dist-info', 'traitlets', 'traitlets-5.7.1.dist-info', 'attr', 'attrs', 'attrs-22.2.0.dist-info', 'zipp', 'zipp-3.11.0.dist-info', 'importlib_resources', 'importlib_resources-5.10.1.dist-info', 'ply', 'ply-3.11.dist-info', 'platformdirs', 'platformdirs-2.6.0.dist-info', 'pkgutil_resolve_name-1.3.10.dist-info', 'pkgutil_resolve_name.py', 'tomli', 'tomli-2.0.1.dist-info', 'docutils', 'docutils-0.19.dist-info', 'Pygments-2.13.0.dist-info', 'pygments', 'exceptiongroup', 'exceptiongroup-1.0.0.dist-info', 'pep517', 'pep517-0.13.0.dist-info', 'urllib3', 'urllib3-1.26.12.dist-info', 'sphinxcontrib_serializinghtml-1.1.5.dist-info', 'sphinxcontrib_serializinghtml-1.1.5-py3.8-nspkg.pth', 'sphinxcontrib_qthelp-1.0.3.dev20221204.dist-info', 'sphinxcontrib_qthelp-1.0.3.dev20221204-py3.8-nspkg.pth', 'sphinxcontrib_jsmath-1.0.1.dev20221204.dist-info', 'sphinxcontrib_jsmath-1.0.1.dev20221204-py3.8-nspkg.pth', 'sphinxcontrib_htmlhelp-2.0.0.dist-info', 'sphinxcontrib_htmlhelp-2.0.0-py3.8-nspkg.pth', 'sphinxcontrib_devhelp-1.0.2.dev20221204-py3.8.egg-info', 'sphinxcontrib_devhelp-1.0.2.dev20221204-py3.8-nspkg.pth', 'sphinxcontrib_applehelp-1.0.2.dev20221204.dist-info', 'sphinxcontrib_applehelp-1.0.2.dev20221204-py3.8-nspkg.pth', 'alabaster', 'alabaster-0.7.12.dist-info', 'sortedcontainers', 'sortedcontainers-2.4.0.dist-info', 'snowballstemmer', 'snowballstemmer-2.2.0.dist-info', '_distutils_hack', 'pkg_resources', 'setuptools', 'setuptools-65.6.3.dist-info', 'distutils-precedence.pth', 'pytz', 'pytz-2022.4.dist-info', 'Babel-2.11.0.dist-info', 'babel', 'pluggy', 'pluggy-1.0.0.dist-info', 'Jinja2-3.1.2.dist-info', 'jinja2', 'iniconfig', 'iniconfig-1.1.1.dist-info', '_pytest', 'pytest', 'pytest-7.2.0.dist-info', 'py.py', 'importlib_metadata', 'importlib_metadata-5.1.0.dist-info', 'imagesize', 'imagesize-1.4.1.dist-info', 'idna', 'idna-3.4.dist-info', 'execnet', 'execnet-1.9.0.dist-info', 'enchant', 'pyenchant-3.2.2.dist-info', 'charset_normalizer', 'charset_normalizer-3.0.1.dist-info', 'requests', 'requests-2.28.1.dist-info', 'sphinx', 'sphinx-5.3.0.dist-info', 'sphinx_rst_builder', 'sphinx_rst_builder-0.0.3.dist-info', 'sphinx_tabs', 'sphinx_tabs-3.4.1.dist-info', 'sphinx_rtd_theme', 'sphinx_rtd_theme-1.1.1.dist-info', 'sphinxcontrib_restbuilder-0.3.dist-info', 'sphinxcontrib_restbuilder-0.3-py3.8-nspkg.pth', 'sphinxcontrib_spelling-7.6.0.dist-info', 'pytest_xdist-3.1.0.dist-info', 'xdist', 'pip', 'pip-22.3.1.dist-info', 'hypothesis', 'hypothesis-6.61.0.dist-info', '_hypothesis_ftz_detector.py', '_hypothesis_pytestplugin.py', 'build', 'build-0.9.0.dist-info', 'wheel', 'wheel-0.38.4.dist-info', 'flaky', 'flaky-3.7.0.dist-info']
Couldn't use pth_dir=PosixPath('/usr/lib/python3.8/site-packages'), exc=PermissionError(13, 'Permission denied')
Couldn't find a pth directory to use |
Hmm .. so looks like test suite is trying to write files in python sitelib drecory 🤔 |
Yes, the test suite wants to be able to write .pth files to test some situations that need them. We have a few options here:
I would prefer #1. |
May I ask why test suite is trying to write something in system sitelib directory? 🤔 |
The test suite is trying to write a .pth file somewhere in the path, because coverage.py supports using a .pth file to start coverage for subprocesses. If I comment out the code that is causing this headache, these tests fail:
May I ask why you don't have a writable directory in sys.path? |
Please have a look one more time on first two lines of the log which I've dropped oppening ticket
In $PYTHONPATH is passed directory with write access however that directory should not be used to write anything else on testing beause it will affect final content of the rpm package generated out of </install/prefix>. |
@kloczek I really appreciate that you are persisting with this. Please keep i mind that I know nothing about how rpm packages are made.
What in those lines would tell me that the directories aren't writable?
If it is writable, then what is making the test setup fail? It seems the directory is not writable. |
Trust me this issue has nothing to do with rpm .. don't worry about that I'm packaging 'coveragepy`😄
Please have look one more time on the output of the pytest with instrumentation patch which you've prepared. |
I forget exactly why, but coverage.py will only try writing a .pth file in a directory if there's already a .pth file there. Can you try touching a .pth file in that writable directory? |
Tested that and looks like first time ever pytest started without internal error however I see now a lot of failing units + PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-7.0.1-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-7.0.1-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra -m 'not network'
bringing up nodes...
..........................................................................................................................x......................s..s............x.......ss.......... [ 13%]
......................................................F......................................................................................s...........................sss........s [ 27%]
ss....s.................s........s................................................................................................................................................... [ 41%]
................F.....................................F.............................................................................................................................. [ 54%]
................................................................s......s.............................................................................s...ss.........s................ [ 68%]
..........s................s...............................s...s..............FF...FFFFFFFF.FFF.FFFFFFFFs.....F..F.............F........................F.....F.....F...FFF....F..... [ 82%]
F..F....F.....s.F.......F............F..F...F................................................................................F..........E.........E.........E..............E...F....E [ 96%]
E........E...F.E.F.F...E..EFE.E...F......F....... [100%]
========================================================================================== ERRORS ===========================================================================================
______________________________________________________ ERROR at setup of VirtualenvTest.test_third_party_venv_isnt_measured[coverage] _______________________________________________________
[gw30] linux -- Python 3.8.16 /usr/bin/python3
tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-14/popen-gw30'), _trace=<pluggy._tracing.TagTracerSub object at 0x7f1aeb42f520>, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-14/popen-gw30'))
@pytest.fixture(scope="session", name="venv_world")
def venv_world_fixture(tmp_path_factory):
"""Create a virtualenv with a few test packages for VirtualenvTest to use.
Returns the directory containing the "venv" virtualenv.
"""
venv_world = tmp_path_factory.mktemp("venv_world")
with change_dir(venv_world):
# Create a virtualenv.
run_command("python -m venv venv")
# A third-party package that installs a few different packages.
make_file("third_pkg/third/__init__.py", """\
import fourth
def third(x):
return 3 * x
""")
# Use plugin2.py as third.plugin
with open(os.path.join(os.path.dirname(__file__), "plugin2.py")) as f:
make_file("third_pkg/third/plugin.py", f.read())
# A render function for plugin2 to use for dynamic file names.
make_file("third_pkg/third/render.py", """\
def render(filename, linenum):
return "HTML: {}@{}".format(filename, linenum)
""")
# Another package that third can use.
make_file("third_pkg/fourth/__init__.py", """\
def fourth(x):
return 4 * x
""")
# Some namespace packages.
make_file("third_pkg/nspkg/fifth/__init__.py", """\
def fifth(x):
return 5 * x
""")
# The setup.py to install everything.
make_file("third_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="third",
packages=["third", "fourth", "nspkg.fifth"],
)
""")
# Some namespace packages.
make_file("another_pkg/nspkg/sixth/__init__.py", """\
def sixth(x):
return 6 * x
""")
make_file("another_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="another",
packages=["nspkg.sixth"],
)
""")
# Bug888 code.
make_file("bug888/app/setup.py", """\
from setuptools import setup
setup(
name='testcov',
packages=['testcov'],
namespace_packages=['testcov'],
)
""")
make_file("bug888/app/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/app/testcov/main.py", """\
import pkg_resources
for entry_point in pkg_resources.iter_entry_points('plugins'):
entry_point.load()()
""")
make_file("bug888/plugin/setup.py", """\
from setuptools import setup
setup(
name='testcov-plugin',
packages=['testcov'],
namespace_packages=['testcov'],
entry_points={'plugins': ['testp = testcov.plugin:testp']},
)
""")
make_file("bug888/plugin/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/plugin/testcov/plugin.py", """\
def testp():
print("Plugin here")
""")
# Install everything.
> run_in_venv(
"python -m pip install " +
"./third_pkg " +
"-e ./another_pkg " +
"-e ./bug888/app -e ./bug888/plugin " +
COVERAGE_INSTALL_ARGS
)
tests/test_venv.py:141:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1'
def run_in_venv(cmd):
r"""Run `cmd` in the virtualenv at `venv`.
The first word of the command will be adjusted to run it from the
venv/bin or venv\Scripts directory.
Returns the text output of the command.
"""
words = cmd.split()
if env.WINDOWS:
words[0] = fr"venv\Scripts\{words[0]}.exe"
else:
words[0] = fr"venv/bin/{words[0]}"
status, output = run_command(" ".join(words))
# Print the output so if it fails, we can tell what happened.
print(output)
> assert status == 0
E assert 127 == 0
tests/test_venv.py:36: AssertionError
----------------------------------------------------------------------------------- Captured stdout setup -----------------------------------------------------------------------------------
/bin/sh: line 1: venv/bin/python: No such file or directory
_________________________________________________ ERROR at setup of VirtualenvTest.test_third_party_venv_isnt_measured[python -m coverage] __________________________________________________
[gw30] linux -- Python 3.8.16 /usr/bin/python3
tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-14/popen-gw30'), _trace=<pluggy._tracing.TagTracerSub object at 0x7f1aeb42f520>, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-14/popen-gw30'))
@pytest.fixture(scope="session", name="venv_world")
def venv_world_fixture(tmp_path_factory):
"""Create a virtualenv with a few test packages for VirtualenvTest to use.
Returns the directory containing the "venv" virtualenv.
"""
venv_world = tmp_path_factory.mktemp("venv_world")
with change_dir(venv_world):
# Create a virtualenv.
run_command("python -m venv venv")
# A third-party package that installs a few different packages.
make_file("third_pkg/third/__init__.py", """\
import fourth
def third(x):
return 3 * x
""")
# Use plugin2.py as third.plugin
with open(os.path.join(os.path.dirname(__file__), "plugin2.py")) as f:
make_file("third_pkg/third/plugin.py", f.read())
# A render function for plugin2 to use for dynamic file names.
make_file("third_pkg/third/render.py", """\
def render(filename, linenum):
return "HTML: {}@{}".format(filename, linenum)
""")
# Another package that third can use.
make_file("third_pkg/fourth/__init__.py", """\
def fourth(x):
return 4 * x
""")
# Some namespace packages.
make_file("third_pkg/nspkg/fifth/__init__.py", """\
def fifth(x):
return 5 * x
""")
# The setup.py to install everything.
make_file("third_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="third",
packages=["third", "fourth", "nspkg.fifth"],
)
""")
# Some namespace packages.
make_file("another_pkg/nspkg/sixth/__init__.py", """\
def sixth(x):
return 6 * x
""")
make_file("another_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="another",
packages=["nspkg.sixth"],
)
""")
# Bug888 code.
make_file("bug888/app/setup.py", """\
from setuptools import setup
setup(
name='testcov',
packages=['testcov'],
namespace_packages=['testcov'],
)
""")
make_file("bug888/app/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/app/testcov/main.py", """\
import pkg_resources
for entry_point in pkg_resources.iter_entry_points('plugins'):
entry_point.load()()
""")
make_file("bug888/plugin/setup.py", """\
from setuptools import setup
setup(
name='testcov-plugin',
packages=['testcov'],
namespace_packages=['testcov'],
entry_points={'plugins': ['testp = testcov.plugin:testp']},
)
""")
make_file("bug888/plugin/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/plugin/testcov/plugin.py", """\
def testp():
print("Plugin here")
""")
# Install everything.
> run_in_venv(
"python -m pip install " +
"./third_pkg " +
"-e ./another_pkg " +
"-e ./bug888/app -e ./bug888/plugin " +
COVERAGE_INSTALL_ARGS
)
tests/test_venv.py:141:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1'
def run_in_venv(cmd):
r"""Run `cmd` in the virtualenv at `venv`.
The first word of the command will be adjusted to run it from the
venv/bin or venv\Scripts directory.
Returns the text output of the command.
"""
words = cmd.split()
if env.WINDOWS:
words[0] = fr"venv\Scripts\{words[0]}.exe"
else:
words[0] = fr"venv/bin/{words[0]}"
status, output = run_command(" ".join(words))
# Print the output so if it fails, we can tell what happened.
print(output)
> assert status == 0
E assert 127 == 0
tests/test_venv.py:36: AssertionError
_________________________________________________________ ERROR at setup of VirtualenvTest.test_us_in_venv_isnt_measured[coverage] __________________________________________________________
[gw30] linux -- Python 3.8.16 /usr/bin/python3
tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-14/popen-gw30'), _trace=<pluggy._tracing.TagTracerSub object at 0x7f1aeb42f520>, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-14/popen-gw30'))
@pytest.fixture(scope="session", name="venv_world")
def venv_world_fixture(tmp_path_factory):
"""Create a virtualenv with a few test packages for VirtualenvTest to use.
Returns the directory containing the "venv" virtualenv.
"""
venv_world = tmp_path_factory.mktemp("venv_world")
with change_dir(venv_world):
# Create a virtualenv.
run_command("python -m venv venv")
# A third-party package that installs a few different packages.
make_file("third_pkg/third/__init__.py", """\
import fourth
def third(x):
return 3 * x
""")
# Use plugin2.py as third.plugin
with open(os.path.join(os.path.dirname(__file__), "plugin2.py")) as f:
make_file("third_pkg/third/plugin.py", f.read())
# A render function for plugin2 to use for dynamic file names.
make_file("third_pkg/third/render.py", """\
def render(filename, linenum):
return "HTML: {}@{}".format(filename, linenum)
""")
# Another package that third can use.
make_file("third_pkg/fourth/__init__.py", """\
def fourth(x):
return 4 * x
""")
# Some namespace packages.
make_file("third_pkg/nspkg/fifth/__init__.py", """\
def fifth(x):
return 5 * x
""")
# The setup.py to install everything.
make_file("third_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="third",
packages=["third", "fourth", "nspkg.fifth"],
)
""")
# Some namespace packages.
make_file("another_pkg/nspkg/sixth/__init__.py", """\
def sixth(x):
return 6 * x
""")
make_file("another_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="another",
packages=["nspkg.sixth"],
)
""")
# Bug888 code.
make_file("bug888/app/setup.py", """\
from setuptools import setup
setup(
name='testcov',
packages=['testcov'],
namespace_packages=['testcov'],
)
""")
make_file("bug888/app/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/app/testcov/main.py", """\
import pkg_resources
for entry_point in pkg_resources.iter_entry_points('plugins'):
entry_point.load()()
""")
make_file("bug888/plugin/setup.py", """\
from setuptools import setup
setup(
name='testcov-plugin',
packages=['testcov'],
namespace_packages=['testcov'],
entry_points={'plugins': ['testp = testcov.plugin:testp']},
)
""")
make_file("bug888/plugin/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/plugin/testcov/plugin.py", """\
def testp():
print("Plugin here")
""")
# Install everything.
> run_in_venv(
"python -m pip install " +
"./third_pkg " +
"-e ./another_pkg " +
"-e ./bug888/app -e ./bug888/plugin " +
COVERAGE_INSTALL_ARGS
)
tests/test_venv.py:141:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1'
def run_in_venv(cmd):
r"""Run `cmd` in the virtualenv at `venv`.
The first word of the command will be adjusted to run it from the
venv/bin or venv\Scripts directory.
Returns the text output of the command.
"""
words = cmd.split()
if env.WINDOWS:
words[0] = fr"venv\Scripts\{words[0]}.exe"
else:
words[0] = fr"venv/bin/{words[0]}"
status, output = run_command(" ".join(words))
# Print the output so if it fails, we can tell what happened.
print(output)
> assert status == 0
E assert 127 == 0
tests/test_venv.py:36: AssertionError
____________________________________________________ ERROR at setup of VirtualenvTest.test_us_in_venv_isnt_measured[python -m coverage] _____________________________________________________
[gw30] linux -- Python 3.8.16 /usr/bin/python3
tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-14/popen-gw30'), _trace=<pluggy._tracing.TagTracerSub object at 0x7f1aeb42f520>, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-14/popen-gw30'))
@pytest.fixture(scope="session", name="venv_world")
def venv_world_fixture(tmp_path_factory):
"""Create a virtualenv with a few test packages for VirtualenvTest to use.
Returns the directory containing the "venv" virtualenv.
"""
venv_world = tmp_path_factory.mktemp("venv_world")
with change_dir(venv_world):
# Create a virtualenv.
run_command("python -m venv venv")
# A third-party package that installs a few different packages.
make_file("third_pkg/third/__init__.py", """\
import fourth
def third(x):
return 3 * x
""")
# Use plugin2.py as third.plugin
with open(os.path.join(os.path.dirname(__file__), "plugin2.py")) as f:
make_file("third_pkg/third/plugin.py", f.read())
# A render function for plugin2 to use for dynamic file names.
make_file("third_pkg/third/render.py", """\
def render(filename, linenum):
return "HTML: {}@{}".format(filename, linenum)
""")
# Another package that third can use.
make_file("third_pkg/fourth/__init__.py", """\
def fourth(x):
return 4 * x
""")
# Some namespace packages.
make_file("third_pkg/nspkg/fifth/__init__.py", """\
def fifth(x):
return 5 * x
""")
# The setup.py to install everything.
make_file("third_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="third",
packages=["third", "fourth", "nspkg.fifth"],
)
""")
# Some namespace packages.
make_file("another_pkg/nspkg/sixth/__init__.py", """\
def sixth(x):
return 6 * x
""")
make_file("another_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="another",
packages=["nspkg.sixth"],
)
""")
# Bug888 code.
make_file("bug888/app/setup.py", """\
from setuptools import setup
setup(
name='testcov',
packages=['testcov'],
namespace_packages=['testcov'],
)
""")
make_file("bug888/app/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/app/testcov/main.py", """\
import pkg_resources
for entry_point in pkg_resources.iter_entry_points('plugins'):
entry_point.load()()
""")
make_file("bug888/plugin/setup.py", """\
from setuptools import setup
setup(
name='testcov-plugin',
packages=['testcov'],
namespace_packages=['testcov'],
entry_points={'plugins': ['testp = testcov.plugin:testp']},
)
""")
make_file("bug888/plugin/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/plugin/testcov/plugin.py", """\
def testp():
print("Plugin here")
""")
# Install everything.
> run_in_venv(
"python -m pip install " +
"./third_pkg " +
"-e ./another_pkg " +
"-e ./bug888/app -e ./bug888/plugin " +
COVERAGE_INSTALL_ARGS
)
tests/test_venv.py:141:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1'
def run_in_venv(cmd):
r"""Run `cmd` in the virtualenv at `venv`.
The first word of the command will be adjusted to run it from the
venv/bin or venv\Scripts directory.
Returns the text output of the command.
"""
words = cmd.split()
if env.WINDOWS:
words[0] = fr"venv\Scripts\{words[0]}.exe"
else:
words[0] = fr"venv/bin/{words[0]}"
status, output = run_command(" ".join(words))
# Print the output so if it fails, we can tell what happened.
print(output)
> assert status == 0
E assert 127 == 0
tests/test_venv.py:36: AssertionError
____________________________________________________________ ERROR at setup of VirtualenvTest.test_venv_isnt_measured[coverage] _____________________________________________________________
[gw30] linux -- Python 3.8.16 /usr/bin/python3
tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-14/popen-gw30'), _trace=<pluggy._tracing.TagTracerSub object at 0x7f1aeb42f520>, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-14/popen-gw30'))
@pytest.fixture(scope="session", name="venv_world")
def venv_world_fixture(tmp_path_factory):
"""Create a virtualenv with a few test packages for VirtualenvTest to use.
Returns the directory containing the "venv" virtualenv.
"""
venv_world = tmp_path_factory.mktemp("venv_world")
with change_dir(venv_world):
# Create a virtualenv.
run_command("python -m venv venv")
# A third-party package that installs a few different packages.
make_file("third_pkg/third/__init__.py", """\
import fourth
def third(x):
return 3 * x
""")
# Use plugin2.py as third.plugin
with open(os.path.join(os.path.dirname(__file__), "plugin2.py")) as f:
make_file("third_pkg/third/plugin.py", f.read())
# A render function for plugin2 to use for dynamic file names.
make_file("third_pkg/third/render.py", """\
def render(filename, linenum):
return "HTML: {}@{}".format(filename, linenum)
""")
# Another package that third can use.
make_file("third_pkg/fourth/__init__.py", """\
def fourth(x):
return 4 * x
""")
# Some namespace packages.
make_file("third_pkg/nspkg/fifth/__init__.py", """\
def fifth(x):
return 5 * x
""")
# The setup.py to install everything.
make_file("third_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="third",
packages=["third", "fourth", "nspkg.fifth"],
)
""")
# Some namespace packages.
make_file("another_pkg/nspkg/sixth/__init__.py", """\
def sixth(x):
return 6 * x
""")
make_file("another_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="another",
packages=["nspkg.sixth"],
)
""")
# Bug888 code.
make_file("bug888/app/setup.py", """\
from setuptools import setup
setup(
name='testcov',
packages=['testcov'],
namespace_packages=['testcov'],
)
""")
make_file("bug888/app/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/app/testcov/main.py", """\
import pkg_resources
for entry_point in pkg_resources.iter_entry_points('plugins'):
entry_point.load()()
""")
make_file("bug888/plugin/setup.py", """\
from setuptools import setup
setup(
name='testcov-plugin',
packages=['testcov'],
namespace_packages=['testcov'],
entry_points={'plugins': ['testp = testcov.plugin:testp']},
)
""")
make_file("bug888/plugin/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/plugin/testcov/plugin.py", """\
def testp():
print("Plugin here")
""")
# Install everything.
> run_in_venv(
"python -m pip install " +
"./third_pkg " +
"-e ./another_pkg " +
"-e ./bug888/app -e ./bug888/plugin " +
COVERAGE_INSTALL_ARGS
)
tests/test_venv.py:141:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1'
def run_in_venv(cmd):
r"""Run `cmd` in the virtualenv at `venv`.
The first word of the command will be adjusted to run it from the
venv/bin or venv\Scripts directory.
Returns the text output of the command.
"""
words = cmd.split()
if env.WINDOWS:
words[0] = fr"venv\Scripts\{words[0]}.exe"
else:
words[0] = fr"venv/bin/{words[0]}"
status, output = run_command(" ".join(words))
# Print the output so if it fails, we can tell what happened.
print(output)
> assert status == 0
E assert 127 == 0
tests/test_venv.py:36: AssertionError
_______________________________________________________ ERROR at setup of VirtualenvTest.test_venv_isnt_measured[python -m coverage] ________________________________________________________
[gw30] linux -- Python 3.8.16 /usr/bin/python3
tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-14/popen-gw30'), _trace=<pluggy._tracing.TagTracerSub object at 0x7f1aeb42f520>, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-14/popen-gw30'))
@pytest.fixture(scope="session", name="venv_world")
def venv_world_fixture(tmp_path_factory):
"""Create a virtualenv with a few test packages for VirtualenvTest to use.
Returns the directory containing the "venv" virtualenv.
"""
venv_world = tmp_path_factory.mktemp("venv_world")
with change_dir(venv_world):
# Create a virtualenv.
run_command("python -m venv venv")
# A third-party package that installs a few different packages.
make_file("third_pkg/third/__init__.py", """\
import fourth
def third(x):
return 3 * x
""")
# Use plugin2.py as third.plugin
with open(os.path.join(os.path.dirname(__file__), "plugin2.py")) as f:
make_file("third_pkg/third/plugin.py", f.read())
# A render function for plugin2 to use for dynamic file names.
make_file("third_pkg/third/render.py", """\
def render(filename, linenum):
return "HTML: {}@{}".format(filename, linenum)
""")
# Another package that third can use.
make_file("third_pkg/fourth/__init__.py", """\
def fourth(x):
return 4 * x
""")
# Some namespace packages.
make_file("third_pkg/nspkg/fifth/__init__.py", """\
def fifth(x):
return 5 * x
""")
# The setup.py to install everything.
make_file("third_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="third",
packages=["third", "fourth", "nspkg.fifth"],
)
""")
# Some namespace packages.
make_file("another_pkg/nspkg/sixth/__init__.py", """\
def sixth(x):
return 6 * x
""")
make_file("another_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="another",
packages=["nspkg.sixth"],
)
""")
# Bug888 code.
make_file("bug888/app/setup.py", """\
from setuptools import setup
setup(
name='testcov',
packages=['testcov'],
namespace_packages=['testcov'],
)
""")
make_file("bug888/app/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/app/testcov/main.py", """\
import pkg_resources
for entry_point in pkg_resources.iter_entry_points('plugins'):
entry_point.load()()
""")
make_file("bug888/plugin/setup.py", """\
from setuptools import setup
setup(
name='testcov-plugin',
packages=['testcov'],
namespace_packages=['testcov'],
entry_points={'plugins': ['testp = testcov.plugin:testp']},
)
""")
make_file("bug888/plugin/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/plugin/testcov/plugin.py", """\
def testp():
print("Plugin here")
""")
# Install everything.
> run_in_venv(
"python -m pip install " +
"./third_pkg " +
"-e ./another_pkg " +
"-e ./bug888/app -e ./bug888/plugin " +
COVERAGE_INSTALL_ARGS
)
tests/test_venv.py:141:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1'
def run_in_venv(cmd):
r"""Run `cmd` in the virtualenv at `venv`.
The first word of the command will be adjusted to run it from the
venv/bin or venv\Scripts directory.
Returns the text output of the command.
"""
words = cmd.split()
if env.WINDOWS:
words[0] = fr"venv\Scripts\{words[0]}.exe"
else:
words[0] = fr"venv/bin/{words[0]}"
status, output = run_command(" ".join(words))
# Print the output so if it fails, we can tell what happened.
print(output)
> assert status == 0
E assert 127 == 0
tests/test_venv.py:36: AssertionError
_________________________________________________________ ERROR at setup of VirtualenvTest.test_venv_with_dynamic_plugin[coverage] __________________________________________________________
[gw30] linux -- Python 3.8.16 /usr/bin/python3
tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-14/popen-gw30'), _trace=<pluggy._tracing.TagTracerSub object at 0x7f1aeb42f520>, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-14/popen-gw30'))
@pytest.fixture(scope="session", name="venv_world")
def venv_world_fixture(tmp_path_factory):
"""Create a virtualenv with a few test packages for VirtualenvTest to use.
Returns the directory containing the "venv" virtualenv.
"""
venv_world = tmp_path_factory.mktemp("venv_world")
with change_dir(venv_world):
# Create a virtualenv.
run_command("python -m venv venv")
# A third-party package that installs a few different packages.
make_file("third_pkg/third/__init__.py", """\
import fourth
def third(x):
return 3 * x
""")
# Use plugin2.py as third.plugin
with open(os.path.join(os.path.dirname(__file__), "plugin2.py")) as f:
make_file("third_pkg/third/plugin.py", f.read())
# A render function for plugin2 to use for dynamic file names.
make_file("third_pkg/third/render.py", """\
def render(filename, linenum):
return "HTML: {}@{}".format(filename, linenum)
""")
# Another package that third can use.
make_file("third_pkg/fourth/__init__.py", """\
def fourth(x):
return 4 * x
""")
# Some namespace packages.
make_file("third_pkg/nspkg/fifth/__init__.py", """\
def fifth(x):
return 5 * x
""")
# The setup.py to install everything.
make_file("third_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="third",
packages=["third", "fourth", "nspkg.fifth"],
)
""")
# Some namespace packages.
make_file("another_pkg/nspkg/sixth/__init__.py", """\
def sixth(x):
return 6 * x
""")
make_file("another_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="another",
packages=["nspkg.sixth"],
)
""")
# Bug888 code.
make_file("bug888/app/setup.py", """\
from setuptools import setup
setup(
name='testcov',
packages=['testcov'],
namespace_packages=['testcov'],
)
""")
make_file("bug888/app/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/app/testcov/main.py", """\
import pkg_resources
for entry_point in pkg_resources.iter_entry_points('plugins'):
entry_point.load()()
""")
make_file("bug888/plugin/setup.py", """\
from setuptools import setup
setup(
name='testcov-plugin',
packages=['testcov'],
namespace_packages=['testcov'],
entry_points={'plugins': ['testp = testcov.plugin:testp']},
)
""")
make_file("bug888/plugin/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/plugin/testcov/plugin.py", """\
def testp():
print("Plugin here")
""")
# Install everything.
> run_in_venv(
"python -m pip install " +
"./third_pkg " +
"-e ./another_pkg " +
"-e ./bug888/app -e ./bug888/plugin " +
COVERAGE_INSTALL_ARGS
)
tests/test_venv.py:141:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1'
def run_in_venv(cmd):
r"""Run `cmd` in the virtualenv at `venv`.
The first word of the command will be adjusted to run it from the
venv/bin or venv\Scripts directory.
Returns the text output of the command.
"""
words = cmd.split()
if env.WINDOWS:
words[0] = fr"venv\Scripts\{words[0]}.exe"
else:
words[0] = fr"venv/bin/{words[0]}"
status, output = run_command(" ".join(words))
# Print the output so if it fails, we can tell what happened.
print(output)
> assert status == 0
E assert 127 == 0
tests/test_venv.py:36: AssertionError
____________________________________________________ ERROR at setup of VirtualenvTest.test_venv_with_dynamic_plugin[python -m coverage] _____________________________________________________
[gw30] linux -- Python 3.8.16 /usr/bin/python3
tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-14/popen-gw30'), _trace=<pluggy._tracing.TagTracerSub object at 0x7f1aeb42f520>, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-14/popen-gw30'))
@pytest.fixture(scope="session", name="venv_world")
def venv_world_fixture(tmp_path_factory):
"""Create a virtualenv with a few test packages for VirtualenvTest to use.
Returns the directory containing the "venv" virtualenv.
"""
venv_world = tmp_path_factory.mktemp("venv_world")
with change_dir(venv_world):
# Create a virtualenv.
run_command("python -m venv venv")
# A third-party package that installs a few different packages.
make_file("third_pkg/third/__init__.py", """\
import fourth
def third(x):
return 3 * x
""")
# Use plugin2.py as third.plugin
with open(os.path.join(os.path.dirname(__file__), "plugin2.py")) as f:
make_file("third_pkg/third/plugin.py", f.read())
# A render function for plugin2 to use for dynamic file names.
make_file("third_pkg/third/render.py", """\
def render(filename, linenum):
return "HTML: {}@{}".format(filename, linenum)
""")
# Another package that third can use.
make_file("third_pkg/fourth/__init__.py", """\
def fourth(x):
return 4 * x
""")
# Some namespace packages.
make_file("third_pkg/nspkg/fifth/__init__.py", """\
def fifth(x):
return 5 * x
""")
# The setup.py to install everything.
make_file("third_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="third",
packages=["third", "fourth", "nspkg.fifth"],
)
""")
# Some namespace packages.
make_file("another_pkg/nspkg/sixth/__init__.py", """\
def sixth(x):
return 6 * x
""")
make_file("another_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="another",
packages=["nspkg.sixth"],
)
""")
# Bug888 code.
make_file("bug888/app/setup.py", """\
from setuptools import setup
setup(
name='testcov',
packages=['testcov'],
namespace_packages=['testcov'],
)
""")
make_file("bug888/app/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/app/testcov/main.py", """\
import pkg_resources
for entry_point in pkg_resources.iter_entry_points('plugins'):
entry_point.load()()
""")
make_file("bug888/plugin/setup.py", """\
from setuptools import setup
setup(
name='testcov-plugin',
packages=['testcov'],
namespace_packages=['testcov'],
entry_points={'plugins': ['testp = testcov.plugin:testp']},
)
""")
make_file("bug888/plugin/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/plugin/testcov/plugin.py", """\
def testp():
print("Plugin here")
""")
# Install everything.
> run_in_venv(
"python -m pip install " +
"./third_pkg " +
"-e ./another_pkg " +
"-e ./bug888/app -e ./bug888/plugin " +
COVERAGE_INSTALL_ARGS
)
tests/test_venv.py:141:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1'
def run_in_venv(cmd):
r"""Run `cmd` in the virtualenv at `venv`.
The first word of the command will be adjusted to run it from the
venv/bin or venv\Scripts directory.
Returns the text output of the command.
"""
words = cmd.split()
if env.WINDOWS:
words[0] = fr"venv\Scripts\{words[0]}.exe"
else:
words[0] = fr"venv/bin/{words[0]}"
status, output = run_command(" ".join(words))
# Print the output so if it fails, we can tell what happened.
print(output)
> assert status == 0
E assert 127 == 0
tests/test_venv.py:36: AssertionError
_______________________________________________________ ERROR at setup of VirtualenvTest.test_installed_namespace_packages[coverage] ________________________________________________________
[gw30] linux -- Python 3.8.16 /usr/bin/python3
tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-14/popen-gw30'), _trace=<pluggy._tracing.TagTracerSub object at 0x7f1aeb42f520>, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-14/popen-gw30'))
@pytest.fixture(scope="session", name="venv_world")
def venv_world_fixture(tmp_path_factory):
"""Create a virtualenv with a few test packages for VirtualenvTest to use.
Returns the directory containing the "venv" virtualenv.
"""
venv_world = tmp_path_factory.mktemp("venv_world")
with change_dir(venv_world):
# Create a virtualenv.
run_command("python -m venv venv")
# A third-party package that installs a few different packages.
make_file("third_pkg/third/__init__.py", """\
import fourth
def third(x):
return 3 * x
""")
# Use plugin2.py as third.plugin
with open(os.path.join(os.path.dirname(__file__), "plugin2.py")) as f:
make_file("third_pkg/third/plugin.py", f.read())
# A render function for plugin2 to use for dynamic file names.
make_file("third_pkg/third/render.py", """\
def render(filename, linenum):
return "HTML: {}@{}".format(filename, linenum)
""")
# Another package that third can use.
make_file("third_pkg/fourth/__init__.py", """\
def fourth(x):
return 4 * x
""")
# Some namespace packages.
make_file("third_pkg/nspkg/fifth/__init__.py", """\
def fifth(x):
return 5 * x
""")
# The setup.py to install everything.
make_file("third_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="third",
packages=["third", "fourth", "nspkg.fifth"],
)
""")
# Some namespace packages.
make_file("another_pkg/nspkg/sixth/__init__.py", """\
def sixth(x):
return 6 * x
""")
make_file("another_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="another",
packages=["nspkg.sixth"],
)
""")
# Bug888 code.
make_file("bug888/app/setup.py", """\
from setuptools import setup
setup(
name='testcov',
packages=['testcov'],
namespace_packages=['testcov'],
)
""")
make_file("bug888/app/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/app/testcov/main.py", """\
import pkg_resources
for entry_point in pkg_resources.iter_entry_points('plugins'):
entry_point.load()()
""")
make_file("bug888/plugin/setup.py", """\
from setuptools import setup
setup(
name='testcov-plugin',
packages=['testcov'],
namespace_packages=['testcov'],
entry_points={'plugins': ['testp = testcov.plugin:testp']},
)
""")
make_file("bug888/plugin/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/plugin/testcov/plugin.py", """\
def testp():
print("Plugin here")
""")
# Install everything.
> run_in_venv(
"python -m pip install " +
"./third_pkg " +
"-e ./another_pkg " +
"-e ./bug888/app -e ./bug888/plugin " +
COVERAGE_INSTALL_ARGS
)
tests/test_venv.py:141:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1'
def run_in_venv(cmd):
r"""Run `cmd` in the virtualenv at `venv`.
The first word of the command will be adjusted to run it from the
venv/bin or venv\Scripts directory.
Returns the text output of the command.
"""
words = cmd.split()
if env.WINDOWS:
words[0] = fr"venv\Scripts\{words[0]}.exe"
else:
words[0] = fr"venv/bin/{words[0]}"
status, output = run_command(" ".join(words))
# Print the output so if it fails, we can tell what happened.
print(output)
> assert status == 0
E assert 127 == 0
tests/test_venv.py:36: AssertionError
__________________________________________________ ERROR at setup of VirtualenvTest.test_installed_namespace_packages[python -m coverage] ___________________________________________________
[gw30] linux -- Python 3.8.16 /usr/bin/python3
tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-14/popen-gw30'), _trace=<pluggy._tracing.TagTracerSub object at 0x7f1aeb42f520>, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-14/popen-gw30'))
@pytest.fixture(scope="session", name="venv_world")
def venv_world_fixture(tmp_path_factory):
"""Create a virtualenv with a few test packages for VirtualenvTest to use.
Returns the directory containing the "venv" virtualenv.
"""
venv_world = tmp_path_factory.mktemp("venv_world")
with change_dir(venv_world):
# Create a virtualenv.
run_command("python -m venv venv")
# A third-party package that installs a few different packages.
make_file("third_pkg/third/__init__.py", """\
import fourth
def third(x):
return 3 * x
""")
# Use plugin2.py as third.plugin
with open(os.path.join(os.path.dirname(__file__), "plugin2.py")) as f:
make_file("third_pkg/third/plugin.py", f.read())
# A render function for plugin2 to use for dynamic file names.
make_file("third_pkg/third/render.py", """\
def render(filename, linenum):
return "HTML: {}@{}".format(filename, linenum)
""")
# Another package that third can use.
make_file("third_pkg/fourth/__init__.py", """\
def fourth(x):
return 4 * x
""")
# Some namespace packages.
make_file("third_pkg/nspkg/fifth/__init__.py", """\
def fifth(x):
return 5 * x
""")
# The setup.py to install everything.
make_file("third_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="third",
packages=["third", "fourth", "nspkg.fifth"],
)
""")
# Some namespace packages.
make_file("another_pkg/nspkg/sixth/__init__.py", """\
def sixth(x):
return 6 * x
""")
make_file("another_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="another",
packages=["nspkg.sixth"],
)
""")
# Bug888 code.
make_file("bug888/app/setup.py", """\
from setuptools import setup
setup(
name='testcov',
packages=['testcov'],
namespace_packages=['testcov'],
)
""")
make_file("bug888/app/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/app/testcov/main.py", """\
import pkg_resources
for entry_point in pkg_resources.iter_entry_points('plugins'):
entry_point.load()()
""")
make_file("bug888/plugin/setup.py", """\
from setuptools import setup
setup(
name='testcov-plugin',
packages=['testcov'],
namespace_packages=['testcov'],
entry_points={'plugins': ['testp = testcov.plugin:testp']},
)
""")
make_file("bug888/plugin/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/plugin/testcov/plugin.py", """\
def testp():
print("Plugin here")
""")
# Install everything.
> run_in_venv(
"python -m pip install " +
"./third_pkg " +
"-e ./another_pkg " +
"-e ./bug888/app -e ./bug888/plugin " +
COVERAGE_INSTALL_ARGS
)
tests/test_venv.py:141:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1'
def run_in_venv(cmd):
r"""Run `cmd` in the virtualenv at `venv`.
The first word of the command will be adjusted to run it from the
venv/bin or venv\Scripts directory.
Returns the text output of the command.
"""
words = cmd.split()
if env.WINDOWS:
words[0] = fr"venv\Scripts\{words[0]}.exe"
else:
words[0] = fr"venv/bin/{words[0]}"
status, output = run_command(" ".join(words))
# Print the output so if it fails, we can tell what happened.
print(output)
> assert status == 0
E assert 127 == 0
tests/test_venv.py:36: AssertionError
__________________________________________________________________ ERROR at setup of VirtualenvTest.test_bug_888[coverage] __________________________________________________________________
[gw30] linux -- Python 3.8.16 /usr/bin/python3
tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-14/popen-gw30'), _trace=<pluggy._tracing.TagTracerSub object at 0x7f1aeb42f520>, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-14/popen-gw30'))
@pytest.fixture(scope="session", name="venv_world")
def venv_world_fixture(tmp_path_factory):
"""Create a virtualenv with a few test packages for VirtualenvTest to use.
Returns the directory containing the "venv" virtualenv.
"""
venv_world = tmp_path_factory.mktemp("venv_world")
with change_dir(venv_world):
# Create a virtualenv.
run_command("python -m venv venv")
# A third-party package that installs a few different packages.
make_file("third_pkg/third/__init__.py", """\
import fourth
def third(x):
return 3 * x
""")
# Use plugin2.py as third.plugin
with open(os.path.join(os.path.dirname(__file__), "plugin2.py")) as f:
make_file("third_pkg/third/plugin.py", f.read())
# A render function for plugin2 to use for dynamic file names.
make_file("third_pkg/third/render.py", """\
def render(filename, linenum):
return "HTML: {}@{}".format(filename, linenum)
""")
# Another package that third can use.
make_file("third_pkg/fourth/__init__.py", """\
def fourth(x):
return 4 * x
""")
# Some namespace packages.
make_file("third_pkg/nspkg/fifth/__init__.py", """\
def fifth(x):
return 5 * x
""")
# The setup.py to install everything.
make_file("third_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="third",
packages=["third", "fourth", "nspkg.fifth"],
)
""")
# Some namespace packages.
make_file("another_pkg/nspkg/sixth/__init__.py", """\
def sixth(x):
return 6 * x
""")
make_file("another_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="another",
packages=["nspkg.sixth"],
)
""")
# Bug888 code.
make_file("bug888/app/setup.py", """\
from setuptools import setup
setup(
name='testcov',
packages=['testcov'],
namespace_packages=['testcov'],
)
""")
make_file("bug888/app/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/app/testcov/main.py", """\
import pkg_resources
for entry_point in pkg_resources.iter_entry_points('plugins'):
entry_point.load()()
""")
make_file("bug888/plugin/setup.py", """\
from setuptools import setup
setup(
name='testcov-plugin',
packages=['testcov'],
namespace_packages=['testcov'],
entry_points={'plugins': ['testp = testcov.plugin:testp']},
)
""")
make_file("bug888/plugin/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/plugin/testcov/plugin.py", """\
def testp():
print("Plugin here")
""")
# Install everything.
> run_in_venv(
"python -m pip install " +
"./third_pkg " +
"-e ./another_pkg " +
"-e ./bug888/app -e ./bug888/plugin " +
COVERAGE_INSTALL_ARGS
)
tests/test_venv.py:141:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1'
def run_in_venv(cmd):
r"""Run `cmd` in the virtualenv at `venv`.
The first word of the command will be adjusted to run it from the
venv/bin or venv\Scripts directory.
Returns the text output of the command.
"""
words = cmd.split()
if env.WINDOWS:
words[0] = fr"venv\Scripts\{words[0]}.exe"
else:
words[0] = fr"venv/bin/{words[0]}"
status, output = run_command(" ".join(words))
# Print the output so if it fails, we can tell what happened.
print(output)
> assert status == 0
E assert 127 == 0
tests/test_venv.py:36: AssertionError
_____________________________________________________________ ERROR at setup of VirtualenvTest.test_bug_888[python -m coverage] _____________________________________________________________
[gw30] linux -- Python 3.8.16 /usr/bin/python3
tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-14/popen-gw30'), _trace=<pluggy._tracing.TagTracerSub object at 0x7f1aeb42f520>, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-14/popen-gw30'))
@pytest.fixture(scope="session", name="venv_world")
def venv_world_fixture(tmp_path_factory):
"""Create a virtualenv with a few test packages for VirtualenvTest to use.
Returns the directory containing the "venv" virtualenv.
"""
venv_world = tmp_path_factory.mktemp("venv_world")
with change_dir(venv_world):
# Create a virtualenv.
run_command("python -m venv venv")
# A third-party package that installs a few different packages.
make_file("third_pkg/third/__init__.py", """\
import fourth
def third(x):
return 3 * x
""")
# Use plugin2.py as third.plugin
with open(os.path.join(os.path.dirname(__file__), "plugin2.py")) as f:
make_file("third_pkg/third/plugin.py", f.read())
# A render function for plugin2 to use for dynamic file names.
make_file("third_pkg/third/render.py", """\
def render(filename, linenum):
return "HTML: {}@{}".format(filename, linenum)
""")
# Another package that third can use.
make_file("third_pkg/fourth/__init__.py", """\
def fourth(x):
return 4 * x
""")
# Some namespace packages.
make_file("third_pkg/nspkg/fifth/__init__.py", """\
def fifth(x):
return 5 * x
""")
# The setup.py to install everything.
make_file("third_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="third",
packages=["third", "fourth", "nspkg.fifth"],
)
""")
# Some namespace packages.
make_file("another_pkg/nspkg/sixth/__init__.py", """\
def sixth(x):
return 6 * x
""")
make_file("another_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="another",
packages=["nspkg.sixth"],
)
""")
# Bug888 code.
make_file("bug888/app/setup.py", """\
from setuptools import setup
setup(
name='testcov',
packages=['testcov'],
namespace_packages=['testcov'],
)
""")
make_file("bug888/app/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/app/testcov/main.py", """\
import pkg_resources
for entry_point in pkg_resources.iter_entry_points('plugins'):
entry_point.load()()
""")
make_file("bug888/plugin/setup.py", """\
from setuptools import setup
setup(
name='testcov-plugin',
packages=['testcov'],
namespace_packages=['testcov'],
entry_points={'plugins': ['testp = testcov.plugin:testp']},
)
""")
make_file("bug888/plugin/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/plugin/testcov/plugin.py", """\
def testp():
print("Plugin here")
""")
# Install everything.
> run_in_venv(
"python -m pip install " +
"./third_pkg " +
"-e ./another_pkg " +
"-e ./bug888/app -e ./bug888/plugin " +
COVERAGE_INSTALL_ARGS
)
tests/test_venv.py:141:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1'
def run_in_venv(cmd):
r"""Run `cmd` in the virtualenv at `venv`.
The first word of the command will be adjusted to run it from the
venv/bin or venv\Scripts directory.
Returns the text output of the command.
"""
words = cmd.split()
if env.WINDOWS:
words[0] = fr"venv\Scripts\{words[0]}.exe"
else:
words[0] = fr"venv/bin/{words[0]}"
status, output = run_command(" ".join(words))
# Print the output so if it fails, we can tell what happened.
print(output)
> assert status == 0
E assert 127 == 0
tests/test_venv.py:36: AssertionError
========================================================================================= FAILURES ==========================================================================================
______________________________________________________________________________ CmdLineStdoutTest.test_version _______________________________________________________________________________
[gw29] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_cmdline.CmdLineStdoutTest object at 0x7f2b11bbadc0>
def test_version(self):
self.command_line("--version")
out = self.stdout()
assert "ersion " in out
if env.C_TRACER:
> assert "with C extension" in out
E AssertionError: assert 'with C extension' in 'Coverage.py, version 7.0.1 without C extension\nFull documentation is at https://coverage.readthedocs.io\n'
tests/test_cmdline.py:975: AssertionError
___________________________________________________________________________ DebugTraceTest.test_debug_sys_ctracer ___________________________________________________________________________
[gw36] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_debug.DebugTraceTest object at 0x7fccb3451880>
def test_debug_sys_ctracer(self):
out_text = self.f1_debug_output(["sys"])
tracer_line = re_line(r"CTracer:", out_text).strip()
if env.C_TRACER:
expected = "CTracer: available"
else:
expected = "CTracer: unavailable"
> assert expected == tracer_line
E AssertionError: assert 'CTracer: available' == 'CTracer: unavailable'
E - CTracer: unavailable
E ? --
E + CTracer: available
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/test_debug.py:200: AssertionError
_______________________________________________________________________________ FileReporterTest.test_zipfile _______________________________________________________________________________
[gw20] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_filereporter.FileReporterTest object at 0x7fd05e458a00>
def test_zipfile(self):
sys.path.append("tests/zip1.zip")
# Test that we can get files out of zipfiles, and read their source files.
# The zip1 module is installed by an action in igor.py.
> import zip1
E ModuleNotFoundError: No module named 'zip1'
tests/test_filereporter.py:91: ModuleNotFoundError
__________________________________________________________________________ GoodFileTracerTest.test_defer_to_python __________________________________________________________________________
[gw31] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_plugins.GoodFileTracerTest object at 0x7fa57523e610>
def test_defer_to_python(self):
# A plugin that measures, but then wants built-in python reporting.
self.make_file("fairly_odd_plugin.py", """\
# A plugin that claims all the odd lines are executed, and none of
# the even lines, and then punts reporting off to the built-in
# Python reporting.
import coverage.plugin
class Plugin(coverage.CoveragePlugin):
def file_tracer(self, filename):
return OddTracer(filename)
def file_reporter(self, filename):
return "python"
class OddTracer(coverage.plugin.FileTracer):
def __init__(self, filename):
self.filename = filename
def source_filename(self):
return self.filename
def line_number_range(self, frame):
lineno = frame.f_lineno
if lineno % 2:
return (lineno, lineno)
else:
return (-1, -1)
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
self.make_file("unsuspecting.py", """\
a = 1
b = 2
c = 3
d = 4
e = 5
f = 6
""")
cov = coverage.Coverage(include=["unsuspecting.py"])
cov.set_option("run:plugins", ["fairly_odd_plugin"])
self.start_import_stop(cov, "unsuspecting")
repout = io.StringIO()
total = cov.report(file=repout, show_missing=True)
report = repout.getvalue().splitlines()
expected = [
'Name Stmts Miss Cover Missing',
'-----------------------------------------------',
'unsuspecting.py 6 3 50% 2, 4, 6',
'-----------------------------------------------',
'TOTAL 6 3 50%',
]
> assert expected == report
E AssertionError: assert ['Name ... 3 50%'] == ['Name ... 0 100%']
E At index 2 diff: 'unsuspecting.py 6 3 50% 2, 4, 6' != 'unsuspecting.py 6 0 100%'
E Use -v to get more diff
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/test_plugins.py:521: AssertionError
______________________________________________________________________________ PluginTest.test_plugin_sys_info ______________________________________________________________________________
[gw13] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_plugins.PluginTest object at 0x7f035e692ee0>
def test_plugin_sys_info(self):
self.make_file("plugin_sys_info.py", """\
import coverage
class Plugin(coverage.CoveragePlugin):
def sys_info(self):
return [("hello", "world")]
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
debug_out = io.StringIO()
cov = coverage.Coverage(debug=["sys"])
cov._debug_file = debug_out
cov.set_option("run:plugins", ["plugin_sys_info"])
with swallow_warnings(
r"Plugin file tracers \(plugin_sys_info.Plugin\) aren't supported with PyTracer"
):
cov.start()
cov.stop() # pragma: nested
out_lines = [line.strip() for line in debug_out.getvalue().splitlines()]
if env.C_TRACER:
> assert 'plugins.file_tracers: plugin_sys_info.Plugin' in out_lines
E AssertionError: assert 'plugins.file_tracers: plugin_sys_info.Plugin' in ['-- sys -------------------------------------------------------', 'coverage_version: 7.0.1', 'coverage_module: /home/...init__.py', 'tracer: PyTracer', 'CTracer: unavailable', 'plugins.file_tracers: plugin_sys_info.Plugin (disabled)', ...]
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/test_plugins.py:205: AssertionError
______________________________________________________________ BadFileTracerTest.test_plugin_has_inherited_filereporter_method ______________________________________________________________
[gw23] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_plugins.BadFileTracerTest object at 0x7f91f1180ee0>
def test_plugin_has_inherited_filereporter_method(self):
self.make_file("bad_plugin.py", """\
import coverage
class Plugin(coverage.CoveragePlugin):
def file_tracer(self, filename):
# Just grab everything.
return FileTracer()
class FileTracer(coverage.FileTracer):
def source_filename(self):
return "foo.xxx"
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
cov = self.run_plugin("bad_plugin")
expected_msg = "Plugin 'bad_plugin.Plugin' needs to implement file_reporter()"
with pytest.raises(NotImplementedError, match=expected_msg):
> cov.report()
E Failed: DID NOT RAISE <class 'NotImplementedError'>
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/test_plugins.py:703: Failed
----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------
Name Stmts Miss Cover
--------------------------------
another.py 2 0 100%
other.py 2 0 100%
simple.py 5 0 100%
--------------------------------
TOTAL 9 0 100%
__________________________________________________________ BadFileTracerTest.test_file_tracer_has_inherited_sourcefilename_method ___________________________________________________________
[gw10] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_plugins.BadFileTracerTest object at 0x7fcdcc828af0>
def test_file_tracer_has_inherited_sourcefilename_method(self):
self.make_file("bad_plugin.py", """\
import coverage
class Plugin(coverage.CoveragePlugin):
def file_tracer(self, filename):
# Just grab everything.
return FileTracer()
class FileTracer(coverage.FileTracer):
pass
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
> self.run_bad_plugin(
"bad_plugin", "Plugin", our_error=False,
excmsg="Class 'bad_plugin.FileTracer' needs to implement source_filename()",
)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/test_plugins.py:680:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_plugins.BadFileTracerTest object at 0x7fcdcc828af0>, module_name = 'bad_plugin', plugin_name = 'Plugin', our_error = False
excmsg = "Class 'bad_plugin.FileTracer' needs to implement source_filename()", excmsgs = None
def run_bad_plugin(self, module_name, plugin_name, our_error=True, excmsg=None, excmsgs=None):
"""Run a file, and see that the plugin failed.
`module_name` and `plugin_name` is the module and name of the plugin to
use.
`our_error` is True if the error reported to the user will be an
explicit error in our test code, marked with an '# Oh noes!' comment.
`excmsg`, if provided, is text that must appear in the stderr.
`excmsgs`, if provided, is a list of messages, one of which must
appear in the stderr.
The plugin will be disabled, and we check that a warning is output
explaining why.
"""
with pytest.warns(Warning) as warns:
self.run_plugin(module_name)
stderr = self.stderr()
stderr += "".join(w.message.args[0] for w in warns)
if our_error:
# The exception we're causing should only appear once.
assert stderr.count("# Oh noes!") == 1
# There should be a warning explaining what's happening, but only one.
# The message can be in two forms:
# Disabling plug-in '...' due to previous exception
# or:
# Disabling plug-in '...' due to an exception:
print([str(w) for w in warns.list])
warns = [w for w in warns.list if issubclass(w.category, CoverageWarning)]
assert len(warns) == 1
warnmsg = warns[0].message.args[0]
> assert f"Disabling plug-in '{module_name}.{plugin_name}' due to " in warnmsg
E assert "Disabling plug-in 'bad_plugin.Plugin' due to " in "Plugin file tracers (bad_plugin.Plugin) aren't supported with PyTracer"
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/test_plugins.py:648: AssertionError
----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------
['{message : CoverageWarning("Plugin file tracers (bad_plugin.Plugin) aren\'t supported with PyTracer"), category : \'CoverageWarning\', filename : \'/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/coverage/control.py\', lineno : 539, line : None}']
__________________________________________________________________________ GoodFileTracerTest.test_find_unexecuted __________________________________________________________________________
[gw2] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_plugins.GoodFileTracerTest object at 0x7fe1c9800d30>
def test_find_unexecuted(self):
self.make_file("unexecuted_plugin.py", """\
import os
import coverage.plugin
class Plugin(coverage.CoveragePlugin):
def file_tracer(self, filename):
if filename.endswith("foo.py"):
return MyTracer(filename)
def file_reporter(self, filename):
return MyReporter(filename)
def find_executable_files(self, src_dir):
# Check that src_dir is the right value
files = os.listdir(src_dir)
assert "foo.py" in files
assert "unexecuted_plugin.py" in files
return ["chimera.py"]
class MyTracer(coverage.plugin.FileTracer):
def __init__(self, filename):
self.filename = filename
def source_filename(self):
return self.filename
def line_number_range(self, frame):
return (999, 999)
class MyReporter(coverage.FileReporter):
def lines(self):
return {99, 999, 9999}
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
self.make_file("foo.py", "a = 1")
cov = coverage.Coverage(source=['.'])
cov.set_option("run:plugins", ["unexecuted_plugin"])
self.start_import_stop(cov, "foo")
# The file we executed claims to have run line 999.
_, statements, missing, _ = cov.analysis("foo.py")
> assert statements == [99, 999, 9999]
E assert [1] == [99, 999, 9999]
E At index 0 diff: 1 != 99
E Right contains 2 more items, first extra item: 999
E Use -v to get more diff
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/test_plugins.py:563: AssertionError
_________________________________________________________________________ BadFileTracerTest.test_file_tracer_fails __________________________________________________________________________
[gw19] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_plugins.BadFileTracerTest object at 0x7fd6c718bbe0>
def test_file_tracer_fails(self):
self.make_file("bad_plugin.py", """\
import coverage.plugin
class Plugin(coverage.plugin.CoveragePlugin):
def file_tracer(self, filename):
17/0 # Oh noes!
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
> self.run_bad_plugin("bad_plugin", "Plugin")
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/test_plugins.py:715:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_plugins.BadFileTracerTest object at 0x7fd6c718bbe0>, module_name = 'bad_plugin', plugin_name = 'Plugin', our_error = True, excmsg = None, excmsgs = None
def run_bad_plugin(self, module_name, plugin_name, our_error=True, excmsg=None, excmsgs=None):
"""Run a file, and see that the plugin failed.
`module_name` and `plugin_name` is the module and name of the plugin to
use.
`our_error` is True if the error reported to the user will be an
explicit error in our test code, marked with an '# Oh noes!' comment.
`excmsg`, if provided, is text that must appear in the stderr.
`excmsgs`, if provided, is a list of messages, one of which must
appear in the stderr.
The plugin will be disabled, and we check that a warning is output
explaining why.
"""
with pytest.warns(Warning) as warns:
self.run_plugin(module_name)
stderr = self.stderr()
stderr += "".join(w.message.args[0] for w in warns)
if our_error:
# The exception we're causing should only appear once.
> assert stderr.count("# Oh noes!") == 1
E assert 0 == 1
E + where 0 = <built-in method count of str object at 0x7fd6c6f8c4b0>('# Oh noes!')
E + where <built-in method count of str object at 0x7fd6c6f8c4b0> = "Plugin file tracers (bad_plugin.Plugin) aren't supported with PyTracer".count
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/test_plugins.py:637: AssertionError
__________________________________________________________________ BadFileTracerTest.test_line_number_range_returns_triple __________________________________________________________________
[gw47] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_plugins.BadFileTracerTest object at 0x7fe25a9d7430>
def test_line_number_range_returns_triple(self):
self.make_file("bad_plugin.py", """\
import coverage.plugin
class Plugin(coverage.plugin.CoveragePlugin):
def file_tracer(self, filename):
if filename.endswith("other.py"):
return BadFileTracer()
class BadFileTracer(coverage.plugin.FileTracer):
def source_filename(self):
return "something.foo"
def line_number_range(self, frame):
return (1, 2, 3)
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
> self.run_bad_plugin(
"bad_plugin", "Plugin", our_error=False, excmsg="line_number_range must return 2-tuple",
)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/test_plugins.py:899:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_plugins.BadFileTracerTest object at 0x7fe25a9d7430>, module_name = 'bad_plugin', plugin_name = 'Plugin', our_error = False
excmsg = 'line_number_range must return 2-tuple', excmsgs = None
def run_bad_plugin(self, module_name, plugin_name, our_error=True, excmsg=None, excmsgs=None):
"""Run a file, and see that the plugin failed.
`module_name` and `plugin_name` is the module and name of the plugin to
use.
`our_error` is True if the error reported to the user will be an
explicit error in our test code, marked with an '# Oh noes!' comment.
`excmsg`, if provided, is text that must appear in the stderr.
`excmsgs`, if provided, is a list of messages, one of which must
appear in the stderr.
The plugin will be disabled, and we check that a warning is output
explaining why.
"""
with pytest.warns(Warning) as warns:
self.run_plugin(module_name)
stderr = self.stderr()
stderr += "".join(w.message.args[0] for w in warns)
if our_error:
# The exception we're causing should only appear once.
assert stderr.count("# Oh noes!") == 1
# There should be a warning explaining what's happening, but only one.
# The message can be in two forms:
# Disabling plug-in '...' due to previous exception
# or:
# Disabling plug-in '...' due to an exception:
print([str(w) for w in warns.list])
warns = [w for w in warns.list if issubclass(w.category, CoverageWarning)]
assert len(warns) == 1
warnmsg = warns[0].message.args[0]
> assert f"Disabling plug-in '{module_name}.{plugin_name}' due to " in warnmsg
E assert "Disabling plug-in 'bad_plugin.Plugin' due to " in "Plugin file tracers (bad_plugin.Plugin) aren't supported with PyTracer"
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/test_plugins.py:648: AssertionError
----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------
['{message : CoverageWarning("Plugin file tracers (bad_plugin.Plugin) aren\'t supported with PyTracer"), category : \'CoverageWarning\', filename : \'/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/coverage/control.py\', lineno : 539, line : None}']
___________________________________________________________________ BadFileTracerTest.test_line_number_range_raises_error ___________________________________________________________________
[gw41] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_plugins.BadFileTracerTest object at 0x7f9942d26c10>
def test_line_number_range_raises_error(self):
self.make_file("bad_plugin.py", """\
import coverage.plugin
class Plugin(coverage.plugin.CoveragePlugin):
def file_tracer(self, filename):
if filename.endswith("other.py"):
return BadFileTracer()
class BadFileTracer(coverage.plugin.FileTracer):
def source_filename(self):
return "something.foo"
def line_number_range(self, frame):
raise Exception("borked!")
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
> self.run_bad_plugin(
"bad_plugin", "Plugin", our_error=False, excmsg="borked!",
)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/test_plugins.py:855:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_plugins.BadFileTracerTest object at 0x7f9942d26c10>, module_name = 'bad_plugin', plugin_name = 'Plugin', our_error = False, excmsg = 'borked!', excmsgs = None
def run_bad_plugin(self, module_name, plugin_name, our_error=True, excmsg=None, excmsgs=None):
"""Run a file, and see that the plugin failed.
`module_name` and `plugin_name` is the module and name of the plugin to
use.
`our_error` is True if the error reported to the user will be an
explicit error in our test code, marked with an '# Oh noes!' comment.
`excmsg`, if provided, is text that must appear in the stderr.
`excmsgs`, if provided, is a list of messages, one of which must
appear in the stderr.
The plugin will be disabled, and we check that a warning is output
explaining why.
"""
with pytest.warns(Warning) as warns:
self.run_plugin(module_name)
stderr = self.stderr()
stderr += "".join(w.message.args[0] for w in warns)
if our_error:
# The exception we're causing should only appear once.
assert stderr.count("# Oh noes!") == 1
# There should be a warning explaining what's happening, but only one.
# The message can be in two forms:
# Disabling plug-in '...' due to previous exception
# or:
# Disabling plug-in '...' due to an exception:
print([str(w) for w in warns.list])
warns = [w for w in warns.list if issubclass(w.category, CoverageWarning)]
assert len(warns) == 1
warnmsg = warns[0].message.args[0]
> assert f"Disabling plug-in '{module_name}.{plugin_name}' due to " in warnmsg
E assert "Disabling plug-in 'bad_plugin.Plugin' due to " in "Plugin file tracers (bad_plugin.Plugin) aren't supported with PyTracer"
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/test_plugins.py:648: AssertionError
----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------
['{message : CoverageWarning("Plugin file tracers (bad_plugin.Plugin) aren\'t supported with PyTracer"), category : \'CoverageWarning\', filename : \'/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/coverage/control.py\', lineno : 539, line : None}']
________________________________________________________________ BadFileTracerTest.test_line_number_range_returns_non_tuple _________________________________________________________________
[gw15] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_plugins.BadFileTracerTest object at 0x7f5756bc0820>
def test_line_number_range_returns_non_tuple(self):
self.make_file("bad_plugin.py", """\
import coverage.plugin
class Plugin(coverage.plugin.CoveragePlugin):
def file_tracer(self, filename):
if filename.endswith("other.py"):
return BadFileTracer()
class BadFileTracer(coverage.plugin.FileTracer):
def source_filename(self):
return "something.foo"
def line_number_range(self, frame):
return 42.23
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
> self.run_bad_plugin(
"bad_plugin", "Plugin", our_error=False, excmsg="line_number_range must return 2-tuple",
)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/test_plugins.py:877:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_plugins.BadFileTracerTest object at 0x7f5756bc0820>, module_name = 'bad_plugin', plugin_name = 'Plugin', our_error = False
excmsg = 'line_number_range must return 2-tuple', excmsgs = None
def run_bad_plugin(self, module_name, plugin_name, our_error=True, excmsg=None, excmsgs=None):
"""Run a file, and see that the plugin failed.
`module_name` and `plugin_name` is the module and name of the plugin to
use.
`our_error` is True if the error reported to the user will be an
explicit error in our test code, marked with an '# Oh noes!' comment.
`excmsg`, if provided, is text that must appear in the stderr.
`excmsgs`, if provided, is a list of messages, one of which must
appear in the stderr.
The plugin will be disabled, and we check that a warning is output
explaining why.
"""
with pytest.warns(Warning) as warns:
self.run_plugin(module_name)
stderr = self.stderr()
stderr += "".join(w.message.args[0] for w in warns)
if our_error:
# The exception we're causing should only appear once.
assert stderr.count("# Oh noes!") == 1
# There should be a warning explaining what's happening, but only one.
# The message can be in two forms:
# Disabling plug-in '...' due to previous exception
# or:
# Disabling plug-in '...' due to an exception:
print([str(w) for w in warns.list])
warns = [w for w in warns.list if issubclass(w.category, CoverageWarning)]
assert len(warns) == 1
warnmsg = warns[0].message.args[0]
> assert f"Disabling plug-in '{module_name}.{plugin_name}' due to " in warnmsg
E assert "Disabling plug-in 'bad_plugin.Plugin' due to " in "Plugin file tracers (bad_plugin.Plugin) aren't supported with PyTracer"
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/test_plugins.py:648: AssertionError
----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------
['{message : CoverageWarning("Plugin file tracers (bad_plugin.Plugin) aren\'t supported with PyTracer"), category : \'CoverageWarning\', filename : \'/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/coverage/control.py\', lineno : 539, line : None}']
_______________________________________________________________________ BadFileTracerTest.test_source_filename_fails ________________________________________________________________________
[gw45] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_plugins.BadFileTracerTest object at 0x7fc029756340>
def test_source_filename_fails(self):
self.make_file("bad_plugin.py", """\
import coverage.plugin
class Plugin(coverage.plugin.CoveragePlugin):
def file_tracer(self, filename):
return BadFileTracer()
class BadFileTracer(coverage.plugin.FileTracer):
def source_filename(self):
42/0 # Oh noes!
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
> self.run_bad_plugin("bad_plugin", "Plugin")
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/test_plugins.py:792:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_plugins.BadFileTracerTest object at 0x7fc029756340>, module_name = 'bad_plugin', plugin_name = 'Plugin', our_error = True, excmsg = None, excmsgs = None
def run_bad_plugin(self, module_name, plugin_name, our_error=True, excmsg=None, excmsgs=None):
"""Run a file, and see that the plugin failed.
`module_name` and `plugin_name` is the module and name of the plugin to
use.
`our_error` is True if the error reported to the user will be an
explicit error in our test code, marked with an '# Oh noes!' comment.
`excmsg`, if provided, is text that must appear in the stderr.
`excmsgs`, if provided, is a list of messages, one of which must
appear in the stderr.
The plugin will be disabled, and we check that a warning is output
explaining why.
"""
with pytest.warns(Warning) as warns:
self.run_plugin(module_name)
stderr = self.stderr()
stderr += "".join(w.message.args[0] for w in warns)
if our_error:
# The exception we're causing should only appear once.
> assert stderr.count("# Oh noes!") == 1
E assert 0 == 1
E + where 0 = <built-in method count of str object at 0x7fc0296a33b0>('# Oh noes!')
E + where <built-in method count of str object at 0x7fc0296a33b0> = "Plugin file tracers (bad_plugin.Plugin) aren't supported with PyTracer".count
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/test_plugins.py:637: AssertionError
___________________________________________________________________ BadFileTracerTest.test_dynamic_source_filename_fails ____________________________________________________________________
[gw35] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_plugins.BadFileTracerTest object at 0x7f28365d1ee0>
def test_dynamic_source_filename_fails(self):
self.make_file("bad_plugin.py", """\
import coverage.plugin
class Plugin(coverage.plugin.CoveragePlugin):
def file_tracer(self, filename):
if filename.endswith("other.py"):
return BadFileTracer()
class BadFileTracer(coverage.plugin.FileTracer):
def has_dynamic_source_filename(self):
return True
def dynamic_source_filename(self, filename, frame):
101/0 # Oh noes!
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
> self.run_bad_plugin("bad_plugin", "Plugin")
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/test_plugins.py:835:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_plugins.BadFileTracerTest object at 0x7f28365d1ee0>, module_name = 'bad_plugin', plugin_name = 'Plugin', our_error = True, excmsg = None, excmsgs = None
def run_bad_plugin(self, module_name, plugin_name, our_error=True, excmsg=None, excmsgs=None):
"""Run a file, and see that the plugin failed.
`module_name` and `plugin_name` is the module and name of the plugin to
use.
`our_error` is True if the error reported to the user will be an
explicit error in our test code, marked with an '# Oh noes!' comment.
`excmsg`, if provided, is text that must appear in the stderr.
`excmsgs`, if provided, is a list of messages, one of which must
appear in the stderr.
The plugin will be disabled, and we check that a warning is output
explaining why.
"""
with pytest.warns(Warning) as warns:
self.run_plugin(module_name)
stderr = self.stderr()
stderr += "".join(w.message.args[0] for w in warns)
if our_error:
# The exception we're causing should only appear once.
> assert stderr.count("# Oh noes!") == 1
E assert 0 == 1
E + where 0 = <built-in method count of str object at 0x7f28362f2330>('# Oh noes!')
E + where <built-in method count of str object at 0x7f28362f2330> = "Plugin file tracers (bad_plugin.Plugin) aren't supported with PyTracer".count
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/test_plugins.py:637: AssertionError
____________________________________________________________________ BadFileTracerTest.test_file_tracer_fails_eventually ____________________________________________________________________
[gw9] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_plugins.BadFileTracerTest object at 0x7f9fecd849d0>
def test_file_tracer_fails_eventually(self):
# Django coverage plugin can report on a few files and then fail.
# https://github.com/nedbat/coveragepy/issues/1011
self.make_file("bad_plugin.py", """\
import os.path
import coverage.plugin
class Plugin(coverage.plugin.CoveragePlugin):
def __init__(self):
self.calls = 0
def file_tracer(self, filename):
print(filename)
self.calls += 1
if self.calls <= 2:
return FileTracer(filename)
else:
17/0 # Oh noes!
class FileTracer(coverage.FileTracer):
def __init__(self, filename):
self.filename = filename
def source_filename(self):
return os.path.basename(self.filename).replace(".py", ".foo")
def line_number_range(self, frame):
return -1, -1
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
> self.run_bad_plugin("bad_plugin", "Plugin")
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/test_plugins.py:746:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_plugins.BadFileTracerTest object at 0x7f9fecd849d0>, module_name = 'bad_plugin', plugin_name = 'Plugin', our_error = True, excmsg = None, excmsgs = None
def run_bad_plugin(self, module_name, plugin_name, our_error=True, excmsg=None, excmsgs=None):
"""Run a file, and see that the plugin failed.
`module_name` and `plugin_name` is the module and name of the plugin to
use.
`our_error` is True if the error reported to the user will be an
explicit error in our test code, marked with an '# Oh noes!' comment.
`excmsg`, if provided, is text that must appear in the stderr.
`excmsgs`, if provided, is a list of messages, one of which must
appear in the stderr.
The plugin will be disabled, and we check that a warning is output
explaining why.
"""
with pytest.warns(Warning) as warns:
self.run_plugin(module_name)
stderr = self.stderr()
stderr += "".join(w.message.args[0] for w in warns)
if our_error:
# The exception we're causing should only appear once.
> assert stderr.count("# Oh noes!") == 1
E assert 0 == 1
E + where 0 = <built-in method count of str object at 0x7f9fec5b32b0>('# Oh noes!')
E + where <built-in method count of str object at 0x7f9fec5b32b0> = "Plugin file tracers (bad_plugin.Plugin) aren't supported with PyTracer".count
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/test_plugins.py:637: AssertionError
_____________________________________________________________________ BadFileTracerTest.test_file_tracer_returns_wrong ______________________________________________________________________
[gw14] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_plugins.BadFileTracerTest object at 0x7f2657a26a90>
def test_file_tracer_returns_wrong(self):
self.make_file("bad_plugin.py", """\
import coverage.plugin
class Plugin(coverage.plugin.CoveragePlugin):
def file_tracer(self, filename):
return 3.14159
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
> self.run_bad_plugin(
"bad_plugin", "Plugin", our_error=False, excmsg="'float' object has no attribute",
)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/test_plugins.py:758:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_plugins.BadFileTracerTest object at 0x7f2657a26a90>, module_name = 'bad_plugin', plugin_name = 'Plugin', our_error = False, excmsg = "'float' object has no attribute"
excmsgs = None
def run_bad_plugin(self, module_name, plugin_name, our_error=True, excmsg=None, excmsgs=None):
"""Run a file, and see that the plugin failed.
`module_name` and `plugin_name` is the module and name of the plugin to
use.
`our_error` is True if the error reported to the user will be an
explicit error in our test code, marked with an '# Oh noes!' comment.
`excmsg`, if provided, is text that must appear in the stderr.
`excmsgs`, if provided, is a list of messages, one of which must
appear in the stderr.
The plugin will be disabled, and we check that a warning is output
explaining why.
"""
with pytest.warns(Warning) as warns:
self.run_plugin(module_name)
stderr = self.stderr()
stderr += "".join(w.message.args[0] for w in warns)
if our_error:
# The exception we're causing should only appear once.
assert stderr.count("# Oh noes!") == 1
# There should be a warning explaining what's happening, but only one.
# The message can be in two forms:
# Disabling plug-in '...' due to previous exception
# or:
# Disabling plug-in '...' due to an exception:
print([str(w) for w in warns.list])
warns = [w for w in warns.list if issubclass(w.category, CoverageWarning)]
assert len(warns) == 1
warnmsg = warns[0].message.args[0]
> assert f"Disabling plug-in '{module_name}.{plugin_name}' due to " in warnmsg
E assert "Disabling plug-in 'bad_plugin.Plugin' due to " in "Plugin file tracers (bad_plugin.Plugin) aren't supported with PyTracer"
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/test_plugins.py:648: AssertionError
----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------
['{message : CoverageWarning("Plugin file tracers (bad_plugin.Plugin) aren\'t supported with PyTracer"), category : \'CoverageWarning\', filename : \'/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/coverage/control.py\', lineno : 539, line : None}']
_____________________________________________________________ BadFileTracerTest.test_line_number_range_returns_pair_of_strings ______________________________________________________________
[gw25] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_plugins.BadFileTracerTest object at 0x7f9271c41bb0>
def test_line_number_range_returns_pair_of_strings(self):
self.make_file("bad_plugin.py", """\
import coverage.plugin
class Plugin(coverage.plugin.CoveragePlugin):
def file_tracer(self, filename):
if filename.endswith("other.py"):
return BadFileTracer()
class BadFileTracer(coverage.plugin.FileTracer):
def source_filename(self):
return "something.foo"
def line_number_range(self, frame):
return ("5", "7")
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
> self.run_bad_plugin(
"bad_plugin", "Plugin", our_error=False,
excmsgs=[
"an integer is required",
"cannot be interpreted as an integer",
],
)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/test_plugins.py:921:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_plugins.BadFileTracerTest object at 0x7f9271c41bb0>, module_name = 'bad_plugin', plugin_name = 'Plugin', our_error = False, excmsg = None
excmsgs = ['an integer is required', 'cannot be interpreted as an integer']
def run_bad_plugin(self, module_name, plugin_name, our_error=True, excmsg=None, excmsgs=None):
"""Run a file, and see that the plugin failed.
`module_name` and `plugin_name` is the module and name of the plugin to
use.
`our_error` is True if the error reported to the user will be an
explicit error in our test code, marked with an '# Oh noes!' comment.
`excmsg`, if provided, is text that must appear in the stderr.
`excmsgs`, if provided, is a list of messages, one of which must
appear in the stderr.
The plugin will be disabled, and we check that a warning is output
explaining why.
"""
with pytest.warns(Warning) as warns:
self.run_plugin(module_name)
stderr = self.stderr()
stderr += "".join(w.message.args[0] for w in warns)
if our_error:
# The exception we're causing should only appear once.
assert stderr.count("# Oh noes!") == 1
# There should be a warning explaining what's happening, but only one.
# The message can be in two forms:
# Disabling plug-in '...' due to previous exception
# or:
# Disabling plug-in '...' due to an exception:
print([str(w) for w in warns.list])
warns = [w for w in warns.list if issubclass(w.category, CoverageWarning)]
assert len(warns) == 1
warnmsg = warns[0].message.args[0]
> assert f"Disabling plug-in '{module_name}.{plugin_name}' due to " in warnmsg
E assert "Disabling plug-in 'bad_plugin.Plugin' due to " in "Plugin file tracers (bad_plugin.Plugin) aren't supported with PyTracer"
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/test_plugins.py:648: AssertionError
----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------
['{message : CoverageWarning("Plugin file tracers (bad_plugin.Plugin) aren\'t supported with PyTracer"), category : \'CoverageWarning\', filename : \'/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/coverage/control.py\', lineno : 539, line : None}']
_____________________________________________________________________ GoodFileTracerTest.test_plugin2_with_text_report ______________________________________________________________________
[gw27] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_plugins.GoodFileTracerTest object at 0x7faa106deb20>
def test_plugin2_with_text_report(self):
self.make_render_and_caller()
cov = coverage.Coverage(branch=True, omit=["*quux*"])
cov.set_option("run:plugins", ["tests.plugin2"])
self.start_import_stop(cov, "caller")
repout = io.StringIO()
> total = cov.report(file=repout, include=["*.html"], omit=["uni*.html"], show_missing=True)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/test_plugins.py:412:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/coverage/control.py:1018: in report
return reporter.report(morfs, outfile=file)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/coverage/summary.py:159: in report
for fr, analysis in get_analysis_to_report(self.coverage, morfs):
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
coverage = <coverage.control.Coverage object at 0x7faa104ebf10>, morfs = None
def get_analysis_to_report(coverage, morfs):
"""Get the files to report on.
For each morf in `morfs`, if it should be reported on (based on the omit
and include configuration options), yield a pair, the `FileReporter` and
`Analysis` for the morf.
"""
file_reporters = coverage._get_file_reporters(morfs)
config = coverage.config
if config.report_include:
matcher = GlobMatcher(prep_patterns(config.report_include), "report_include")
file_reporters = [fr for fr in file_reporters if matcher.match(fr.filename)]
if config.report_omit:
matcher = GlobMatcher(prep_patterns(config.report_omit), "report_omit")
file_reporters = [fr for fr in file_reporters if not matcher.match(fr.filename)]
if not file_reporters:
> raise NoDataError("No data to report.")
E coverage.exceptions.NoDataError: No data to report.
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/coverage/report.py:68: NoDataError
_____________________________________________________________________ GoodFileTracerTest.test_plugin2_with_html_report ______________________________________________________________________
[gw28] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_plugins.GoodFileTracerTest object at 0x7f5f81dc3a60>
def test_plugin2_with_html_report(self):
self.make_render_and_caller()
cov = coverage.Coverage(branch=True, omit=["*quux*"])
cov.set_option("run:plugins", ["tests.plugin2"])
self.start_import_stop(cov, "caller")
> total = cov.html_report(include=["*.html"], omit=["uni*.html"])
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/test_plugins.py:433:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/coverage/control.py:1114: in html_report
ret = reporter.report(morfs)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/coverage/html.py:222: in report
for fr, analysis in get_analysis_to_report(self.coverage, morfs):
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
coverage = <coverage.control.Coverage object at 0x7f5f81c3f790>, morfs = None
def get_analysis_to_report(coverage, morfs):
"""Get the files to report on.
For each morf in `morfs`, if it should be reported on (based on the omit
and include configuration options), yield a pair, the `FileReporter` and
`Analysis` for the morf.
"""
file_reporters = coverage._get_file_reporters(morfs)
config = coverage.config
if config.report_include:
matcher = GlobMatcher(prep_patterns(config.report_include), "report_include")
file_reporters = [fr for fr in file_reporters if matcher.match(fr.filename)]
if config.report_omit:
matcher = GlobMatcher(prep_patterns(config.report_omit), "report_omit")
file_reporters = [fr for fr in file_reporters if not matcher.match(fr.filename)]
if not file_reporters:
> raise NoDataError("No data to report.")
E coverage.exceptions.NoDataError: No data to report.
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/coverage/report.py:68: NoDataError
______________________________________________________________________ GoodFileTracerTest.test_plugin2_with_xml_report ______________________________________________________________________
[gw21] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_plugins.GoodFileTracerTest object at 0x7f71ee8e5970>
def test_plugin2_with_xml_report(self):
self.make_render_and_caller()
cov = coverage.Coverage(branch=True, omit=["*quux*"])
cov.set_option("run:plugins", ["tests.plugin2"])
self.start_import_stop(cov, "caller")
> total = cov.xml_report(include=["*.html"], omit=["uni*.html"])
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/test_plugins.py:448:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/coverage/control.py:1149: in xml_report
return render_report(self.config.xml_output, XmlReporter(self), morfs, self._message)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/coverage/report.py:35: in render_report
return reporter.report(morfs, outfile=outfile)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/coverage/xmlreport.py:75: in report
for fr, analysis in get_analysis_to_report(self.coverage, morfs):
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
coverage = <coverage.control.Coverage object at 0x7f71ee73d6d0>, morfs = None
def get_analysis_to_report(coverage, morfs):
"""Get the files to report on.
For each morf in `morfs`, if it should be reported on (based on the omit
and include configuration options), yield a pair, the `FileReporter` and
`Analysis` for the morf.
"""
file_reporters = coverage._get_file_reporters(morfs)
config = coverage.config
if config.report_include:
matcher = GlobMatcher(prep_patterns(config.report_include), "report_include")
file_reporters = [fr for fr in file_reporters if matcher.match(fr.filename)]
if config.report_omit:
matcher = GlobMatcher(prep_patterns(config.report_omit), "report_omit")
file_reporters = [fr for fr in file_reporters if not matcher.match(fr.filename)]
if not file_reporters:
> raise NoDataError("No data to report.")
E coverage.exceptions.NoDataError: No data to report.
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/coverage/report.py:68: NoDataError
___________________________________________________________________ BadFileTracerTest.test_source_filename_returns_wrong ____________________________________________________________________
[gw39] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_plugins.BadFileTracerTest object at 0x7f72112c63a0>
def test_source_filename_returns_wrong(self):
self.make_file("bad_plugin.py", """\
import coverage.plugin
class Plugin(coverage.plugin.CoveragePlugin):
def file_tracer(self, filename):
return BadFileTracer()
class BadFileTracer(coverage.plugin.FileTracer):
def source_filename(self):
return 17.3
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
> self.run_bad_plugin(
"bad_plugin", "Plugin", our_error=False,
excmsgs=[
"expected str, bytes or os.PathLike object, not float",
"'float' object has no attribute",
"object of type 'float' has no len()",
"'float' object is unsubscriptable",
],
)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/test_plugins.py:808:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_plugins.BadFileTracerTest object at 0x7f72112c63a0>, module_name = 'bad_plugin', plugin_name = 'Plugin', our_error = False, excmsg = None
excmsgs = ['expected str, bytes or os.PathLike object, not float', "'float' object has no attribute", "object of type 'float' has no len()", "'float' object is unsubscriptable"]
def run_bad_plugin(self, module_name, plugin_name, our_error=True, excmsg=None, excmsgs=None):
"""Run a file, and see that the plugin failed.
`module_name` and `plugin_name` is the module and name of the plugin to
use.
`our_error` is True if the error reported to the user will be an
explicit error in our test code, marked with an '# Oh noes!' comment.
`excmsg`, if provided, is text that must appear in the stderr.
`excmsgs`, if provided, is a list of messages, one of which must
appear in the stderr.
The plugin will be disabled, and we check that a warning is output
explaining why.
"""
with pytest.warns(Warning) as warns:
self.run_plugin(module_name)
stderr = self.stderr()
stderr += "".join(w.message.args[0] for w in warns)
if our_error:
# The exception we're causing should only appear once.
assert stderr.count("# Oh noes!") == 1
# There should be a warning explaining what's happening, but only one.
# The message can be in two forms:
# Disabling plug-in '...' due to previous exception
# or:
# Disabling plug-in '...' due to an exception:
print([str(w) for w in warns.list])
warns = [w for w in warns.list if issubclass(w.category, CoverageWarning)]
assert len(warns) == 1
warnmsg = warns[0].message.args[0]
> assert f"Disabling plug-in '{module_name}.{plugin_name}' due to " in warnmsg
E assert "Disabling plug-in 'bad_plugin.Plugin' due to " in "Plugin file tracers (bad_plugin.Plugin) aren't supported with PyTracer"
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/test_plugins.py:648: AssertionError
----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------
['{message : CoverageWarning("Plugin file tracers (bad_plugin.Plugin) aren\'t supported with PyTracer"), category : \'CoverageWarning\', filename : \'/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/coverage/control.py\', lineno : 539, line : None}']
______________________________________________________________________________ GoodFileTracerTest.test_plugin2 ______________________________________________________________________________
[gw24] linux -- Python 3.8.16 /usr/bin/python3
self = <coverage.parser.ByteParser object at 0x7f1ed97f5610>, text = 'line 0\nline 1\nline 2\nline 3\nline 4\nline 5\nline 6\n', code = None
filename = '/tmp/pytest-of-tkloczko/pytest-14/popen-gw24/t19/foo_7.html'
@contract(text='unicode')
def __init__(self, text, code=None, filename=None):
self.text = text
if code:
self.code = code
else:
try:
> self.code = compile(text, filename, "exec")
E File "/tmp/pytest-of-tkloczko/pytest-14/popen-gw24/t19/foo_7.html", line 1
E line 0
E ^
E SyntaxError: invalid syntax
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/coverage/parser.py:361: SyntaxError
The above exception was the direct cause of the following exception:
self = <tests.test_plugins.GoodFileTracerTest object at 0x7f1ed99ea250>
def test_plugin2(self):
self.make_render_and_caller()
cov = coverage.Coverage(omit=["*quux*"])
CheckUniqueFilenames.hook(cov, '_should_trace')
CheckUniqueFilenames.hook(cov, '_check_include_omit_etc')
cov.set_option("run:plugins", ["tests.plugin2"])
self.start_import_stop(cov, "caller")
# The way plugin2 works, a file named foo_7.html will be claimed to
# have 7 lines in it. If render() was called with line number 4,
# then the plugin will claim that lines 4 and 5 were executed.
> _, statements, missing, _ = cov.analysis("foo_7.html")
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/test_plugins.py:370:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/coverage/control.py:840: in analysis
f, s, _, m, mf = self.analysis2(morf)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/coverage/control.py:860: in analysis2
analysis = self._analyze(morf)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/coverage/control.py:883: in _analyze
return Analysis(data, self.config.precision, it, self._file_mapper)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/coverage/results.py:20: in __init__
self.statements = self.file_reporter.lines()
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/coverage/python.py:195: in lines
return self.parser.statements
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/coverage/python.py:190: in parser
self._parser.parse_source()
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/coverage/parser.py:238: in parse_source
self._raw_parse()
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/coverage/parser.py:196: in _raw_parse
byte_parser = ByteParser(self.text, filename=self.filename)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <coverage.parser.ByteParser object at 0x7f1ed97f5610>, text = 'line 0\nline 1\nline 2\nline 3\nline 4\nline 5\nline 6\n', code = None
filename = '/tmp/pytest-of-tkloczko/pytest-14/popen-gw24/t19/foo_7.html'
@contract(text='unicode')
def __init__(self, text, code=None, filename=None):
self.text = text
if code:
self.code = code
else:
try:
self.code = compile(text, filename, "exec")
except SyntaxError as synerr:
> raise NotPython(
"Couldn't parse '%s' as Python source: '%s' at line %d" % (
filename, synerr.msg, synerr.lineno
)
) from synerr
E coverage.exceptions.NotPython: Couldn't parse '/tmp/pytest-of-tkloczko/pytest-14/popen-gw24/t19/foo_7.html' as Python source: 'invalid syntax' at line 1
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/coverage/parser.py:363: NotPython
_________________________________________________________________ BadFileTracerTest.test_has_dynamic_source_filename_fails __________________________________________________________________
[gw43] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_plugins.BadFileTracerTest object at 0x7f8b514f8460>
def test_has_dynamic_source_filename_fails(self):
self.make_file("bad_plugin.py", """\
import coverage.plugin
class Plugin(coverage.plugin.CoveragePlugin):
def file_tracer(self, filename):
return BadFileTracer()
class BadFileTracer(coverage.plugin.FileTracer):
def has_dynamic_source_filename(self):
23/0 # Oh noes!
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
> self.run_bad_plugin("bad_plugin", "Plugin")
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/test_plugins.py:776:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_plugins.BadFileTracerTest object at 0x7f8b514f8460>, module_name = 'bad_plugin', plugin_name = 'Plugin', our_error = True, excmsg = None, excmsgs = None
def run_bad_plugin(self, module_name, plugin_name, our_error=True, excmsg=None, excmsgs=None):
"""Run a file, and see that the plugin failed.
`module_name` and `plugin_name` is the module and name of the plugin to
use.
`our_error` is True if the error reported to the user will be an
explicit error in our test code, marked with an '# Oh noes!' comment.
`excmsg`, if provided, is text that must appear in the stderr.
`excmsgs`, if provided, is a list of messages, one of which must
appear in the stderr.
The plugin will be disabled, and we check that a warning is output
explaining why.
"""
with pytest.warns(Warning) as warns:
self.run_plugin(module_name)
stderr = self.stderr()
stderr += "".join(w.message.args[0] for w in warns)
if our_error:
# The exception we're causing should only appear once.
> assert stderr.count("# Oh noes!") == 1
E assert 0 == 1
E + where 0 = <built-in method count of str object at 0x7f8b5111e830>('# Oh noes!')
E + where <built-in method count of str object at 0x7f8b5111e830> = "Plugin file tracers (bad_plugin.Plugin) aren't supported with PyTracer".count
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/test_plugins.py:637: AssertionError
______________________________________________________________________________ GoodFileTracerTest.test_plugin1 ______________________________________________________________________________
[gw36] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_plugins.GoodFileTracerTest object at 0x7fccb1e1b430>
def test_plugin1(self):
self.make_file("simple.py", """\
import try_xyz
a = 1
b = 2
""")
self.make_file("try_xyz.py", """\
c = 3
d = 4
""")
cov = coverage.Coverage()
CheckUniqueFilenames.hook(cov, '_should_trace')
CheckUniqueFilenames.hook(cov, '_check_include_omit_etc')
cov.set_option("run:plugins", ["tests.plugin1"])
# Import the Python file, executing it.
self.start_import_stop(cov, "simple")
_, statements, missing, _ = cov.analysis("simple.py")
assert statements == [1, 2, 3]
assert missing == []
zzfile = os.path.abspath(os.path.join("/src", "try_ABC.zz"))
> _, statements, _, _ = cov.analysis(zzfile)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/test_plugins.py:311:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/coverage/control.py:840: in analysis
f, s, _, m, mf = self.analysis2(morf)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/coverage/control.py:860: in analysis2
analysis = self._analyze(morf)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/coverage/control.py:883: in _analyze
return Analysis(data, self.config.precision, it, self._file_mapper)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/coverage/results.py:20: in __init__
self.statements = self.file_reporter.lines()
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/coverage/python.py:195: in lines
return self.parser.statements
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/coverage/python.py:186: in parser
self._parser = PythonParser(
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/coverage/parser.py:42: in __init__
self.text = get_python_source(self.filename)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
filename = '/src/try_ABC.zz'
@contract(returns='unicode')
def get_python_source(filename):
"""Return the source code, as unicode."""
base, ext = os.path.splitext(filename)
if ext == ".py" and env.WINDOWS:
exts = [".py", ".pyw"]
else:
exts = [ext]
for ext in exts:
try_filename = base + ext
if os.path.exists(try_filename):
# A regular text file: open it.
source = read_python_source(try_filename)
break
# Maybe it's in a zip file?
source = get_zip_bytes(try_filename)
if source is not None:
break
else:
# Couldn't find source.
> raise NoSource(f"No source for code: '{filename}'.")
E coverage.exceptions.NoSource: No source for code: '/src/try_ABC.zz'.
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/coverage/python.py:60: NoSource
________________________________________________________________________ GoodFileTracerTest.test_plugin2_with_branch ________________________________________________________________________
[gw4] linux -- Python 3.8.16 /usr/bin/python3
self = <coverage.parser.ByteParser object at 0x7f45801c5c40>, text = 'line 0\nline 1\nline 2\nline 3\nline 4\nline 5\nline 6\n', code = None
filename = '/tmp/pytest-of-tkloczko/pytest-14/popen-gw4/t17/foo_7.html'
@contract(text='unicode')
def __init__(self, text, code=None, filename=None):
self.text = text
if code:
self.code = code
else:
try:
> self.code = compile(text, filename, "exec")
E File "/tmp/pytest-of-tkloczko/pytest-14/popen-gw4/t17/foo_7.html", line 1
E line 0
E ^
E SyntaxError: invalid syntax
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/coverage/parser.py:361: SyntaxError
The above exception was the direct cause of the following exception:
self = <tests.test_plugins.GoodFileTracerTest object at 0x7f4580631be0>
def test_plugin2_with_branch(self):
self.make_render_and_caller()
cov = coverage.Coverage(branch=True, omit=["*quux*"])
CheckUniqueFilenames.hook(cov, '_should_trace')
CheckUniqueFilenames.hook(cov, '_check_include_omit_etc')
cov.set_option("run:plugins", ["tests.plugin2"])
self.start_import_stop(cov, "caller")
# The way plugin2 works, a file named foo_7.html will be claimed to
# have 7 lines in it. If render() was called with line number 4,
# then the plugin will claim that lines 4 and 5 were executed.
> analysis = cov._analyze("foo_7.html")
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/test_plugins.py:395:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/coverage/control.py:883: in _analyze
return Analysis(data, self.config.precision, it, self._file_mapper)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/coverage/results.py:20: in __init__
self.statements = self.file_reporter.lines()
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/coverage/python.py:195: in lines
return self.parser.statements
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/coverage/python.py:190: in parser
self._parser.parse_source()
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/coverage/parser.py:238: in parse_source
self._raw_parse()
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/coverage/parser.py:196: in _raw_parse
byte_parser = ByteParser(self.text, filename=self.filename)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <coverage.parser.ByteParser object at 0x7f45801c5c40>, text = 'line 0\nline 1\nline 2\nline 3\nline 4\nline 5\nline 6\n', code = None
filename = '/tmp/pytest-of-tkloczko/pytest-14/popen-gw4/t17/foo_7.html'
@contract(text='unicode')
def __init__(self, text, code=None, filename=None):
self.text = text
if code:
self.code = code
else:
try:
self.code = compile(text, filename, "exec")
except SyntaxError as synerr:
> raise NotPython(
"Couldn't parse '%s' as Python source: '%s' at line %d" % (
filename, synerr.msg, synerr.lineno
)
) from synerr
E coverage.exceptions.NotPython: Couldn't parse '/tmp/pytest-of-tkloczko/pytest-14/popen-gw4/t17/foo_7.html' as Python source: 'invalid syntax' at line 1
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/coverage/parser.py:363: NotPython
_______________________________________________________________ BadFileTracerTest.test_file_tracer_has_no_file_tracer_method ________________________________________________________________
[gw24] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_plugins.BadFileTracerTest object at 0x7f1ed99c3370>
def test_file_tracer_has_no_file_tracer_method(self):
self.make_file("bad_plugin.py", """\
class Plugin(object):
pass
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
> self.run_bad_plugin("bad_plugin", "Plugin", our_error=False)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/test_plugins.py:664:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_plugins.BadFileTracerTest object at 0x7f1ed99c3370>, module_name = 'bad_plugin', plugin_name = 'Plugin', our_error = False, excmsg = None, excmsgs = None
def run_bad_plugin(self, module_name, plugin_name, our_error=True, excmsg=None, excmsgs=None):
"""Run a file, and see that the plugin failed.
`module_name` and `plugin_name` is the module and name of the plugin to
use.
`our_error` is True if the error reported to the user will be an
explicit error in our test code, marked with an '# Oh noes!' comment.
`excmsg`, if provided, is text that must appear in the stderr.
`excmsgs`, if provided, is a list of messages, one of which must
appear in the stderr.
The plugin will be disabled, and we check that a warning is output
explaining why.
"""
with pytest.warns(Warning) as warns:
self.run_plugin(module_name)
stderr = self.stderr()
stderr += "".join(w.message.args[0] for w in warns)
if our_error:
# The exception we're causing should only appear once.
assert stderr.count("# Oh noes!") == 1
# There should be a warning explaining what's happening, but only one.
# The message can be in two forms:
# Disabling plug-in '...' due to previous exception
# or:
# Disabling plug-in '...' due to an exception:
print([str(w) for w in warns.list])
warns = [w for w in warns.list if issubclass(w.category, CoverageWarning)]
assert len(warns) == 1
warnmsg = warns[0].message.args[0]
> assert f"Disabling plug-in '{module_name}.{plugin_name}' due to " in warnmsg
E assert "Disabling plug-in 'bad_plugin.Plugin' due to " in "Plugin file tracers (bad_plugin.Plugin) aren't supported with PyTracer"
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/test_plugins.py:648: AssertionError
----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------
['{message : CoverageWarning("Plugin file tracers (bad_plugin.Plugin) aren\'t supported with PyTracer"), category : \'CoverageWarning\', filename : \'/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/coverage/control.py\', lineno : 539, line : None}']
_________________________________________________________________________ ProcessTest.test_tests_dir_is_importable __________________________________________________________________________
[gw17] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_process.ProcessTest object at 0x7f9a7051fe20>
def test_tests_dir_is_importable(self):
# Checks that we can import modules from the tests directory at all!
self.make_file("mycode.py", """\
import covmod1
import covmodzip1
a = 1
print('done')
""")
self.assert_doesnt_exist(".coverage")
out = self.run_command("coverage run mycode.py")
self.assert_exists(".coverage")
> assert out == 'done\n'
E assert "Traceback (m...covmodzip1'\n" == 'done\n'
E - done
E + Traceback (most recent call last):
E + File "mycode.py", line 2, in <module>
E + import covmodzip1
E + ModuleNotFoundError: No module named 'covmodzip1'
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/test_process.py:50: AssertionError
----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------
Traceback (most recent call last):
File "mycode.py", line 2, in <module>
import covmodzip1
ModuleNotFoundError: No module named 'covmodzip1'
_____________________________________________________________________ GetZipBytesTest.test_get_encoded_zip_files[utf-8] _____________________________________________________________________
[gw32] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_python.GetZipBytesTest object at 0x7f2d52f55ac0>, encoding = 'utf-8'
@pytest.mark.parametrize(
"encoding",
["utf-8", "gb2312", "hebrew", "shift_jis", "cp1252"],
)
def test_get_encoded_zip_files(self, encoding):
# See igor.py, do_zipmods, for the text of these files.
zip_file = "tests/zipmods.zip"
sys.path.append(zip_file) # So we can import the files.
filename = zip_file + "/encoded_" + encoding + ".py"
filename = os_sep(filename)
zip_data = get_zip_bytes(filename)
> zip_text = zip_data.decode(encoding)
E AttributeError: 'NoneType' object has no attribute 'decode'
tests/test_python.py:33: AttributeError
____________________________________________________________________ GetZipBytesTest.test_get_encoded_zip_files[gb2312] _____________________________________________________________________
[gw32] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_python.GetZipBytesTest object at 0x7f2d52f55910>, encoding = 'gb2312'
@pytest.mark.parametrize(
"encoding",
["utf-8", "gb2312", "hebrew", "shift_jis", "cp1252"],
)
def test_get_encoded_zip_files(self, encoding):
# See igor.py, do_zipmods, for the text of these files.
zip_file = "tests/zipmods.zip"
sys.path.append(zip_file) # So we can import the files.
filename = zip_file + "/encoded_" + encoding + ".py"
filename = os_sep(filename)
zip_data = get_zip_bytes(filename)
> zip_text = zip_data.decode(encoding)
E AttributeError: 'NoneType' object has no attribute 'decode'
tests/test_python.py:33: AttributeError
____________________________________________________________________ GetZipBytesTest.test_get_encoded_zip_files[hebrew] _____________________________________________________________________
[gw32] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_python.GetZipBytesTest object at 0x7f2d52f55b80>, encoding = 'hebrew'
@pytest.mark.parametrize(
"encoding",
["utf-8", "gb2312", "hebrew", "shift_jis", "cp1252"],
)
def test_get_encoded_zip_files(self, encoding):
# See igor.py, do_zipmods, for the text of these files.
zip_file = "tests/zipmods.zip"
sys.path.append(zip_file) # So we can import the files.
filename = zip_file + "/encoded_" + encoding + ".py"
filename = os_sep(filename)
zip_data = get_zip_bytes(filename)
> zip_text = zip_data.decode(encoding)
E AttributeError: 'NoneType' object has no attribute 'decode'
tests/test_python.py:33: AttributeError
___________________________________________________________________ GetZipBytesTest.test_get_encoded_zip_files[shift_jis] ___________________________________________________________________
[gw32] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_python.GetZipBytesTest object at 0x7f2d52f55cd0>, encoding = 'shift_jis'
@pytest.mark.parametrize(
"encoding",
["utf-8", "gb2312", "hebrew", "shift_jis", "cp1252"],
)
def test_get_encoded_zip_files(self, encoding):
# See igor.py, do_zipmods, for the text of these files.
zip_file = "tests/zipmods.zip"
sys.path.append(zip_file) # So we can import the files.
filename = zip_file + "/encoded_" + encoding + ".py"
filename = os_sep(filename)
zip_data = get_zip_bytes(filename)
> zip_text = zip_data.decode(encoding)
E AttributeError: 'NoneType' object has no attribute 'decode'
tests/test_python.py:33: AttributeError
_______________________________________________________________________________ ProcessTest.test_fullcoverage _______________________________________________________________________________
[gw47] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_process.ProcessTest object at 0x7fe25a906640>
@pytest.mark.expensive
@pytest.mark.skipif(not env.C_TRACER, reason="fullcoverage only works with the C tracer.")
@pytest.mark.skipif(env.METACOV, reason="Can't test fullcoverage when measuring ourselves")
def test_fullcoverage(self):
# fullcoverage is a trick to get stdlib modules measured from
# the very beginning of the process. Here we import os and
# then check how many lines are measured.
self.make_file("getenv.py", """\
import os
print("FOOEY == %s" % os.getenv("FOOEY"))
""")
fullcov = os.path.join(os.path.dirname(coverage.__file__), "fullcoverage")
self.set_environ("FOOEY", "BOO")
self.set_environ("PYTHONPATH", fullcov)
out = self.run_command("python -X frozen_modules=off -m coverage run -L getenv.py")
> assert out == "FOOEY == BOO\n"
E AssertionError: assert '/usr/bin/pyt...ed coverage\n' == 'FOOEY == BOO\n'
E - FOOEY == BOO
E + /usr/bin/python3: No module named coverage
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/test_process.py:570: AssertionError
----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------
/usr/bin/python3: No module named coverage
__________________________________________________________ ProcessStartupWithSourceTest.test_pth_and_source_work_together[main--] ___________________________________________________________
[gw15] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_process.ProcessStartupWithSourceTest object at 0x7f5756a8a370>, dashm = '', package = '', source = 'main'
@pytest.mark.parametrize("dashm", ["-m", ""])
@pytest.mark.parametrize("package", ["pkg", ""])
@pytest.mark.parametrize("source", ["main", "sub"])
def test_pth_and_source_work_together(self, dashm, package, source):
"""Run the test for a particular combination of factors.
The arguments are all strings:
* `dashm`: Either "" (run the program as a file) or "-m" (run the
program as a module).
* `package`: Either "" (put the source at the top level) or a
package name to use to hold the source.
* `source`: Either "main" or "sub", which file to use as the
``--source`` argument.
"""
def fullname(modname):
"""What is the full module name for `modname` for this test?"""
if package and dashm:
return '.'.join((package, modname))
else:
return modname
def path(basename):
"""Where should `basename` be created for this test?"""
return os.path.join(package, basename)
# Main will run sub.py.
self.make_file(path("main.py"), """\
import %s
a = 2
b = 3
""" % fullname('sub'))
if package:
self.make_file(path("__init__.py"), "")
# sub.py will write a few lines.
self.make_file(path("sub.py"), """\
# Avoid 'with' so Jython can play along.
f = open("out.txt", "w")
f.write("Hello, world!")
f.close()
""")
self.make_file("coverage.ini", """\
[run]
source = %s
""" % fullname(source))
self.set_environ("COVERAGE_PROCESS_START", "coverage.ini")
if dashm:
cmd = "python -m %s" % fullname('main')
else:
cmd = "python %s" % path('main.py')
self.run_command(cmd)
with open("out.txt") as f:
assert f.read() == "Hello, world!"
# Read the data from .coverage
> self.assert_exists(".coverage")
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/test_process.py:1287:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_process.ProcessStartupWithSourceTest object at 0x7f5756a8a370>, fname = '.coverage'
def assert_exists(self, fname):
"""Assert that `fname` is a file that exists."""
> assert os.path.exists(fname), f"File {fname!r} should exist"
E AssertionError: File '.coverage' should exist
E assert False
E + where False = <function exists at 0x7f575d7bbca0>('.coverage')
E + where <function exists at 0x7f575d7bbca0> = <module 'posixpath' from '/usr/lib64/python3.8/posixpath.py'>.exists
E + where <module 'posixpath' from '/usr/lib64/python3.8/posixpath.py'> = os.path
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/coveragetest.py:297: AssertionError
----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------
____________________________________________________________________ GetZipBytesTest.test_get_encoded_zip_files[cp1252] _____________________________________________________________________
[gw32] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_python.GetZipBytesTest object at 0x7f2d52f55d90>, encoding = 'cp1252'
@pytest.mark.parametrize(
"encoding",
["utf-8", "gb2312", "hebrew", "shift_jis", "cp1252"],
)
def test_get_encoded_zip_files(self, encoding):
# See igor.py, do_zipmods, for the text of these files.
zip_file = "tests/zipmods.zip"
sys.path.append(zip_file) # So we can import the files.
filename = zip_file + "/encoded_" + encoding + ".py"
filename = os_sep(filename)
zip_data = get_zip_bytes(filename)
> zip_text = zip_data.decode(encoding)
E AttributeError: 'NoneType' object has no attribute 'decode'
tests/test_python.py:33: AttributeError
________________________________________________________ ProcessStartupWithSourceTest.test_pth_and_source_work_together[main-pkg--m] ________________________________________________________
[gw19] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_process.ProcessStartupWithSourceTest object at 0x7fd6c6cfa160>, dashm = '-m', package = 'pkg', source = 'main'
@pytest.mark.parametrize("dashm", ["-m", ""])
@pytest.mark.parametrize("package", ["pkg", ""])
@pytest.mark.parametrize("source", ["main", "sub"])
def test_pth_and_source_work_together(self, dashm, package, source):
"""Run the test for a particular combination of factors.
The arguments are all strings:
* `dashm`: Either "" (run the program as a file) or "-m" (run the
program as a module).
* `package`: Either "" (put the source at the top level) or a
package name to use to hold the source.
* `source`: Either "main" or "sub", which file to use as the
``--source`` argument.
"""
def fullname(modname):
"""What is the full module name for `modname` for this test?"""
if package and dashm:
return '.'.join((package, modname))
else:
return modname
def path(basename):
"""Where should `basename` be created for this test?"""
return os.path.join(package, basename)
# Main will run sub.py.
self.make_file(path("main.py"), """\
import %s
a = 2
b = 3
""" % fullname('sub'))
if package:
self.make_file(path("__init__.py"), "")
# sub.py will write a few lines.
self.make_file(path("sub.py"), """\
# Avoid 'with' so Jython can play along.
f = open("out.txt", "w")
f.write("Hello, world!")
f.close()
""")
self.make_file("coverage.ini", """\
[run]
source = %s
""" % fullname(source))
self.set_environ("COVERAGE_PROCESS_START", "coverage.ini")
if dashm:
cmd = "python -m %s" % fullname('main')
else:
cmd = "python %s" % path('main.py')
self.run_command(cmd)
with open("out.txt") as f:
assert f.read() == "Hello, world!"
# Read the data from .coverage
> self.assert_exists(".coverage")
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/test_process.py:1287:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_process.ProcessStartupWithSourceTest object at 0x7fd6c6cfa160>, fname = '.coverage'
def assert_exists(self, fname):
"""Assert that `fname` is a file that exists."""
> assert os.path.exists(fname), f"File {fname!r} should exist"
E AssertionError: File '.coverage' should exist
E assert False
E + where False = <function exists at 0x7fd6cda39ca0>('.coverage')
E + where <function exists at 0x7fd6cda39ca0> = <module 'posixpath' from '/usr/lib64/python3.8/posixpath.py'>.exists
E + where <module 'posixpath' from '/usr/lib64/python3.8/posixpath.py'> = os.path
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/coveragetest.py:297: AssertionError
----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------
_________________________________________________________ ProcessStartupWithSourceTest.test_pth_and_source_work_together[main---m] __________________________________________________________
[gw41] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_process.ProcessStartupWithSourceTest object at 0x7f9942a3a550>, dashm = '-m', package = '', source = 'main'
@pytest.mark.parametrize("dashm", ["-m", ""])
@pytest.mark.parametrize("package", ["pkg", ""])
@pytest.mark.parametrize("source", ["main", "sub"])
def test_pth_and_source_work_together(self, dashm, package, source):
"""Run the test for a particular combination of factors.
The arguments are all strings:
* `dashm`: Either "" (run the program as a file) or "-m" (run the
program as a module).
* `package`: Either "" (put the source at the top level) or a
package name to use to hold the source.
* `source`: Either "main" or "sub", which file to use as the
``--source`` argument.
"""
def fullname(modname):
"""What is the full module name for `modname` for this test?"""
if package and dashm:
return '.'.join((package, modname))
else:
return modname
def path(basename):
"""Where should `basename` be created for this test?"""
return os.path.join(package, basename)
# Main will run sub.py.
self.make_file(path("main.py"), """\
import %s
a = 2
b = 3
""" % fullname('sub'))
if package:
self.make_file(path("__init__.py"), "")
# sub.py will write a few lines.
self.make_file(path("sub.py"), """\
# Avoid 'with' so Jython can play along.
f = open("out.txt", "w")
f.write("Hello, world!")
f.close()
""")
self.make_file("coverage.ini", """\
[run]
source = %s
""" % fullname(source))
self.set_environ("COVERAGE_PROCESS_START", "coverage.ini")
if dashm:
cmd = "python -m %s" % fullname('main')
else:
cmd = "python %s" % path('main.py')
self.run_command(cmd)
with open("out.txt") as f:
assert f.read() == "Hello, world!"
# Read the data from .coverage
> self.assert_exists(".coverage")
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/test_process.py:1287:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_process.ProcessStartupWithSourceTest object at 0x7f9942a3a550>, fname = '.coverage'
def assert_exists(self, fname):
"""Assert that `fname` is a file that exists."""
> assert os.path.exists(fname), f"File {fname!r} should exist"
E AssertionError: File '.coverage' should exist
E assert False
E + where False = <function exists at 0x7f9949766ca0>('.coverage')
E + where <function exists at 0x7f9949766ca0> = <module 'posixpath' from '/usr/lib64/python3.8/posixpath.py'>.exists
E + where <module 'posixpath' from '/usr/lib64/python3.8/posixpath.py'> = os.path
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/coveragetest.py:297: AssertionError
----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------
_________________________________________________________ ProcessStartupWithSourceTest.test_pth_and_source_work_together[sub-pkg-] __________________________________________________________
[gw45] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_process.ProcessStartupWithSourceTest object at 0x7fc0294f5eb0>, dashm = '', package = 'pkg', source = 'sub'
@pytest.mark.parametrize("dashm", ["-m", ""])
@pytest.mark.parametrize("package", ["pkg", ""])
@pytest.mark.parametrize("source", ["main", "sub"])
def test_pth_and_source_work_together(self, dashm, package, source):
"""Run the test for a particular combination of factors.
The arguments are all strings:
* `dashm`: Either "" (run the program as a file) or "-m" (run the
program as a module).
* `package`: Either "" (put the source at the top level) or a
package name to use to hold the source.
* `source`: Either "main" or "sub", which file to use as the
``--source`` argument.
"""
def fullname(modname):
"""What is the full module name for `modname` for this test?"""
if package and dashm:
return '.'.join((package, modname))
else:
return modname
def path(basename):
"""Where should `basename` be created for this test?"""
return os.path.join(package, basename)
# Main will run sub.py.
self.make_file(path("main.py"), """\
import %s
a = 2
b = 3
""" % fullname('sub'))
if package:
self.make_file(path("__init__.py"), "")
# sub.py will write a few lines.
self.make_file(path("sub.py"), """\
# Avoid 'with' so Jython can play along.
f = open("out.txt", "w")
f.write("Hello, world!")
f.close()
""")
self.make_file("coverage.ini", """\
[run]
source = %s
""" % fullname(source))
self.set_environ("COVERAGE_PROCESS_START", "coverage.ini")
if dashm:
cmd = "python -m %s" % fullname('main')
else:
cmd = "python %s" % path('main.py')
self.run_command(cmd)
with open("out.txt") as f:
assert f.read() == "Hello, world!"
# Read the data from .coverage
> self.assert_exists(".coverage")
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/test_process.py:1287:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_process.ProcessStartupWithSourceTest object at 0x7fc0294f5eb0>, fname = '.coverage'
def assert_exists(self, fname):
"""Assert that `fname` is a file that exists."""
> assert os.path.exists(fname), f"File {fname!r} should exist"
E AssertionError: File '.coverage' should exist
E assert False
E + where False = <function exists at 0x7fc02c225ca0>('.coverage')
E + where <function exists at 0x7fc02c225ca0> = <module 'posixpath' from '/usr/lib64/python3.8/posixpath.py'>.exists
E + where <module 'posixpath' from '/usr/lib64/python3.8/posixpath.py'> = os.path
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/coveragetest.py:297: AssertionError
----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------
__________________________________________________________________________________ SummaryTest.test_report __________________________________________________________________________________
[gw28] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_summary.SummaryTest object at 0x7f5f81a559a0>
def test_report(self):
self.make_mycode()
cov = coverage.Coverage()
> self.start_import_stop(cov, "mycode")
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/test_summary.py:43:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/coveragetest.py:80: in start_import_stop
mod = import_local_file(modname, modfile)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/coverage/misc.py:366: in import_local_file
spec.loader.exec_module(mod)
<frozen importlib._bootstrap_external>:843: in exec_module
???
<frozen importlib._bootstrap>:219: in _call_with_frames_removed
???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
import covmod1
> import covmodzip1
E ModuleNotFoundError: No module named 'covmodzip1'
/tmp/pytest-of-tkloczko/pytest-14/popen-gw28/t19/mycode.py:2: ModuleNotFoundError
_____________________________________________________________________ ProcessStartupTest.test_subprocess_with_pth_files _____________________________________________________________________
[gw23] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_process.ProcessStartupTest object at 0x7f91f0f1e8b0>
def test_subprocess_with_pth_files(self):
# An existing data file should not be read when a subprocess gets
# measured automatically. Create the data file here with bogus data in
# it.
data = coverage.CoverageData(".mycovdata")
data.add_lines({os.path.abspath('sub.py'): range(100)})
data.write()
self.make_file("coverage.ini", """\
[run]
data_file = .mycovdata
""")
self.set_environ("COVERAGE_PROCESS_START", "coverage.ini")
import main # pylint: disable=unused-import, import-error
with open("out.txt") as f:
assert f.read() == "Hello, world!\n"
# Read the data from .coverage
self.assert_exists(".mycovdata")
data = coverage.CoverageData(".mycovdata")
data.read()
> assert line_counts(data)['sub.py'] == 3
E assert 100 == 3
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/test_process.py:1179: AssertionError
________________________________________________________ ProcessStartupWithSourceTest.test_pth_and_source_work_together[sub-pkg--m] _________________________________________________________
[gw35] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_process.ProcessStartupWithSourceTest object at 0x7f2836261cd0>, dashm = '-m', package = 'pkg', source = 'sub'
@pytest.mark.parametrize("dashm", ["-m", ""])
@pytest.mark.parametrize("package", ["pkg", ""])
@pytest.mark.parametrize("source", ["main", "sub"])
def test_pth_and_source_work_together(self, dashm, package, source):
"""Run the test for a particular combination of factors.
The arguments are all strings:
* `dashm`: Either "" (run the program as a file) or "-m" (run the
program as a module).
* `package`: Either "" (put the source at the top level) or a
package name to use to hold the source.
* `source`: Either "main" or "sub", which file to use as the
``--source`` argument.
"""
def fullname(modname):
"""What is the full module name for `modname` for this test?"""
if package and dashm:
return '.'.join((package, modname))
else:
return modname
def path(basename):
"""Where should `basename` be created for this test?"""
return os.path.join(package, basename)
# Main will run sub.py.
self.make_file(path("main.py"), """\
import %s
a = 2
b = 3
""" % fullname('sub'))
if package:
self.make_file(path("__init__.py"), "")
# sub.py will write a few lines.
self.make_file(path("sub.py"), """\
# Avoid 'with' so Jython can play along.
f = open("out.txt", "w")
f.write("Hello, world!")
f.close()
""")
self.make_file("coverage.ini", """\
[run]
source = %s
""" % fullname(source))
self.set_environ("COVERAGE_PROCESS_START", "coverage.ini")
if dashm:
cmd = "python -m %s" % fullname('main')
else:
cmd = "python %s" % path('main.py')
self.run_command(cmd)
with open("out.txt") as f:
assert f.read() == "Hello, world!"
# Read the data from .coverage
> self.assert_exists(".coverage")
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/test_process.py:1287:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_process.ProcessStartupWithSourceTest object at 0x7f2836261cd0>, fname = '.coverage'
def assert_exists(self, fname):
"""Assert that `fname` is a file that exists."""
> assert os.path.exists(fname), f"File {fname!r} should exist"
E AssertionError: File '.coverage' should exist
E assert False
E + where False = <function exists at 0x7f283cf91ca0>('.coverage')
E + where <function exists at 0x7f283cf91ca0> = <module 'posixpath' from '/usr/lib64/python3.8/posixpath.py'>.exists
E + where <module 'posixpath' from '/usr/lib64/python3.8/posixpath.py'> = os.path
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/coveragetest.py:297: AssertionError
----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------
_________________________________________________________ ProcessStartupWithSourceTest.test_pth_and_source_work_together[main-pkg-] _________________________________________________________
[gw47] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_process.ProcessStartupWithSourceTest object at 0x7fe25a772280>, dashm = '', package = 'pkg', source = 'main'
@pytest.mark.parametrize("dashm", ["-m", ""])
@pytest.mark.parametrize("package", ["pkg", ""])
@pytest.mark.parametrize("source", ["main", "sub"])
def test_pth_and_source_work_together(self, dashm, package, source):
"""Run the test for a particular combination of factors.
The arguments are all strings:
* `dashm`: Either "" (run the program as a file) or "-m" (run the
program as a module).
* `package`: Either "" (put the source at the top level) or a
package name to use to hold the source.
* `source`: Either "main" or "sub", which file to use as the
``--source`` argument.
"""
def fullname(modname):
"""What is the full module name for `modname` for this test?"""
if package and dashm:
return '.'.join((package, modname))
else:
return modname
def path(basename):
"""Where should `basename` be created for this test?"""
return os.path.join(package, basename)
# Main will run sub.py.
self.make_file(path("main.py"), """\
import %s
a = 2
b = 3
""" % fullname('sub'))
if package:
self.make_file(path("__init__.py"), "")
# sub.py will write a few lines.
self.make_file(path("sub.py"), """\
# Avoid 'with' so Jython can play along.
f = open("out.txt", "w")
f.write("Hello, world!")
f.close()
""")
self.make_file("coverage.ini", """\
[run]
source = %s
""" % fullname(source))
self.set_environ("COVERAGE_PROCESS_START", "coverage.ini")
if dashm:
cmd = "python -m %s" % fullname('main')
else:
cmd = "python %s" % path('main.py')
self.run_command(cmd)
with open("out.txt") as f:
assert f.read() == "Hello, world!"
# Read the data from .coverage
> self.assert_exists(".coverage")
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/test_process.py:1287:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_process.ProcessStartupWithSourceTest object at 0x7fe25a772280>, fname = '.coverage'
def assert_exists(self, fname):
"""Assert that `fname` is a file that exists."""
> assert os.path.exists(fname), f"File {fname!r} should exist"
E AssertionError: File '.coverage' should exist
E assert False
E + where False = <function exists at 0x7fe26149cca0>('.coverage')
E + where <function exists at 0x7fe26149cca0> = <module 'posixpath' from '/usr/lib64/python3.8/posixpath.py'>.exists
E + where <module 'posixpath' from '/usr/lib64/python3.8/posixpath.py'> = os.path
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/coveragetest.py:297: AssertionError
----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------
___________________________________________________________ ProcessStartupWithSourceTest.test_pth_and_source_work_together[sub--] ___________________________________________________________
[gw14] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_process.ProcessStartupWithSourceTest object at 0x7f26577fb310>, dashm = '', package = '', source = 'sub'
@pytest.mark.parametrize("dashm", ["-m", ""])
@pytest.mark.parametrize("package", ["pkg", ""])
@pytest.mark.parametrize("source", ["main", "sub"])
def test_pth_and_source_work_together(self, dashm, package, source):
"""Run the test for a particular combination of factors.
The arguments are all strings:
* `dashm`: Either "" (run the program as a file) or "-m" (run the
program as a module).
* `package`: Either "" (put the source at the top level) or a
package name to use to hold the source.
* `source`: Either "main" or "sub", which file to use as the
``--source`` argument.
"""
def fullname(modname):
"""What is the full module name for `modname` for this test?"""
if package and dashm:
return '.'.join((package, modname))
else:
return modname
def path(basename):
"""Where should `basename` be created for this test?"""
return os.path.join(package, basename)
# Main will run sub.py.
self.make_file(path("main.py"), """\
import %s
a = 2
b = 3
""" % fullname('sub'))
if package:
self.make_file(path("__init__.py"), "")
# sub.py will write a few lines.
self.make_file(path("sub.py"), """\
# Avoid 'with' so Jython can play along.
f = open("out.txt", "w")
f.write("Hello, world!")
f.close()
""")
self.make_file("coverage.ini", """\
[run]
source = %s
""" % fullname(source))
self.set_environ("COVERAGE_PROCESS_START", "coverage.ini")
if dashm:
cmd = "python -m %s" % fullname('main')
else:
cmd = "python %s" % path('main.py')
self.run_command(cmd)
with open("out.txt") as f:
assert f.read() == "Hello, world!"
# Read the data from .coverage
> self.assert_exists(".coverage")
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/test_process.py:1287:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_process.ProcessStartupWithSourceTest object at 0x7f26577fb310>, fname = '.coverage'
def assert_exists(self, fname):
"""Assert that `fname` is a file that exists."""
> assert os.path.exists(fname), f"File {fname!r} should exist"
E AssertionError: File '.coverage' should exist
E assert False
E + where False = <function exists at 0x7f265e508ca0>('.coverage')
E + where <function exists at 0x7f265e508ca0> = <module 'posixpath' from '/usr/lib64/python3.8/posixpath.py'>.exists
E + where <module 'posixpath' from '/usr/lib64/python3.8/posixpath.py'> = os.path
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/coveragetest.py:297: AssertionError
----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------
_____________________________________________________________________ EnvironmentTest.test_coverage_zip_is_like_python ______________________________________________________________________
[gw8] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_process.EnvironmentTest object at 0x7fa16d74a580>
def test_coverage_zip_is_like_python(self):
# Test running coverage from a zip file itself. Some environments
# (windows?) zip up the coverage main to be used as the coverage
# command.
with open(TRY_EXECFILE) as f:
self.make_file("run_me.py", f.read())
expected = self.run_command("python run_me.py")
cov_main = os.path.join(TESTS_DIR, "covmain.zip")
actual = self.run_command(f"python {cov_main} run run_me.py")
> self.assert_tryexecfile_output(expected, actual)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/test_process.py:808:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_process.EnvironmentTest object at 0x7fa16d74a580>
expected = '{\n "DATA": "xyzzy",\n "FN_VAL": "my_fn(\'fooey\')",\n "__builtins__.dir": [\n "ArithmeticError Asser...8/lib-dynload",\n "/usr/lib64/python3.8/site-packages",\n "/usr/lib/python3.8/site-packages"\n ]\n}\n'
actual = "python3: can't open file '/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/covmain.zip': [Errno 2] No such file or directory\n"
def assert_tryexecfile_output(self, expected, actual):
"""Assert that the output we got is a successful run of try_execfile.py.
`expected` and `actual` must be the same, modulo a few slight known
platform differences.
"""
# First, is this even credible try_execfile.py output?
> assert '"DATA": "xyzzy"' in actual
E assert '"DATA": "xyzzy"' in "python3: can't open file '/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/covmain.zip': [Errno 2] No such file or directory\n"
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/test_process.py:671: AssertionError
----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------
{
"DATA": "xyzzy",
"FN_VAL": "my_fn('fooey')",
"__builtins__.dir": [
"ArithmeticError AssertionError AttributeError BaseException BlockingIOError BrokenPipeError BufferError BytesWarning ChildProcessError ConnectionAbortedError ConnectionError ConnectionRefusedError ConnectionResetError",
"DeprecationWarning EOFError Ellipsis EnvironmentError Exception False FileExistsError FileNotFoundError FloatingPointError FutureWarning",
"GeneratorExit IOError ImportError ImportWarning IndentationError IndexError InterruptedError IsADirectoryError",
"KeyError KeyboardInterrupt LookupError MemoryError ModuleNotFoundError NameError None NotADirectoryError NotImplemented NotImplementedError",
"OSError OverflowError PendingDeprecationWarning PermissionError ProcessLookupError RecursionError ReferenceError ResourceWarning RuntimeError RuntimeWarning",
"StopAsyncIteration StopIteration SyntaxError SyntaxWarning SystemError SystemExit TabError TimeoutError True TypeError",
"UnboundLocalError UnicodeDecodeError UnicodeEncodeError UnicodeError UnicodeTranslateError UnicodeWarning UserWarning",
"ValueError Warning ZeroDivisionError __build_class__ __debug__ __doc__ __import__ __loader__ __name__ __package__ __spec__",
"abs all any ascii bin bool breakpoint bytearray bytes",
"callable chr classmethod compile complex copyright credits delattr dict dir divmod",
"enumerate eval exec exit filter float format frozenset getattr globals",
"hasattr hash help hex id input int isinstance issubclass iter",
"len license list locals map max memoryview min next object oct open ord",
"pow print property quit range repr reversed round",
"set setattr slice sorted staticmethod str sum super tuple type vars zip"
],
"__builtins__.has_open": true,
"__doc__": "Test file for run_python_file.\n\nThis file is executed two ways::\n\n $ coverage run try_execfile.py\n\nand::\n\n $ python try_execfile.py\n\nThe output is compared to see that the program execution context is the same\nunder coverage and under Python.\n\nIt is not crucial that the execution be identical, there are some differences\nthat are OK. This program canonicalizes the output to gloss over those\ndifferences and get a clean diff.\n\n",
"__file__": "run_me.py",
"__loader__ exists": true,
"__loader__.fullname": "__main__",
"__main__.DATA": "xyzzy",
"__name__": "__main__",
"__package__": null,
"__spec__ exists": false,
"argv0": "run_me.py",
"argv1-n": [],
"os.getcwd": "/tmp/pytest-of-tkloczko/pytest-14/popen-gw8/t19",
"path": [
"/tmp/pytest-of-tkloczko/pytest-14/popen-gw8/t19",
"/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-7.0.1-2.fc35.x86_64/usr/lib64/python3.8/site-packages",
"/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-7.0.1-2.fc35.x86_64/usr/lib/python3.8/site-packages",
"/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/modules",
"/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/zipmods.zip",
"/usr/lib64/python38.zip",
"/usr/lib64/python3.8",
"/usr/lib64/python3.8/lib-dynload",
"/usr/lib64/python3.8/site-packages",
"/usr/lib/python3.8/site-packages"
]
}
python3: can't open file '/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/covmain.zip': [Errno 2] No such file or directory
__________________________________________________________ ProcessStartupWithSourceTest.test_pth_and_source_work_together[sub---m] __________________________________________________________
[gw9] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_process.ProcessStartupWithSourceTest object at 0x7f9fecb2bc10>, dashm = '-m', package = '', source = 'sub'
@pytest.mark.parametrize("dashm", ["-m", ""])
@pytest.mark.parametrize("package", ["pkg", ""])
@pytest.mark.parametrize("source", ["main", "sub"])
def test_pth_and_source_work_together(self, dashm, package, source):
"""Run the test for a particular combination of factors.
The arguments are all strings:
* `dashm`: Either "" (run the program as a file) or "-m" (run the
program as a module).
* `package`: Either "" (put the source at the top level) or a
package name to use to hold the source.
* `source`: Either "main" or "sub", which file to use as the
``--source`` argument.
"""
def fullname(modname):
"""What is the full module name for `modname` for this test?"""
if package and dashm:
return '.'.join((package, modname))
else:
return modname
def path(basename):
"""Where should `basename` be created for this test?"""
return os.path.join(package, basename)
# Main will run sub.py.
self.make_file(path("main.py"), """\
import %s
a = 2
b = 3
""" % fullname('sub'))
if package:
self.make_file(path("__init__.py"), "")
# sub.py will write a few lines.
self.make_file(path("sub.py"), """\
# Avoid 'with' so Jython can play along.
f = open("out.txt", "w")
f.write("Hello, world!")
f.close()
""")
self.make_file("coverage.ini", """\
[run]
source = %s
""" % fullname(source))
self.set_environ("COVERAGE_PROCESS_START", "coverage.ini")
if dashm:
cmd = "python -m %s" % fullname('main')
else:
cmd = "python %s" % path('main.py')
self.run_command(cmd)
with open("out.txt") as f:
assert f.read() == "Hello, world!"
# Read the data from .coverage
> self.assert_exists(".coverage")
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/test_process.py:1287:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_process.ProcessStartupWithSourceTest object at 0x7f9fecb2bc10>, fname = '.coverage'
def assert_exists(self, fname):
"""Assert that `fname` is a file that exists."""
> assert os.path.exists(fname), f"File {fname!r} should exist"
E AssertionError: File '.coverage' should exist
E assert False
E + where False = <function exists at 0x7f9fef866ca0>('.coverage')
E + where <function exists at 0x7f9fef866ca0> = <module 'posixpath' from '/usr/lib64/python3.8/posixpath.py'>.exists
E + where <module 'posixpath' from '/usr/lib64/python3.8/posixpath.py'> = os.path
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/coveragetest.py:297: AssertionError
----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------
______________________________________________________________ ProcessStartupTest.test_subprocess_with_pth_files_and_parallel _______________________________________________________________
[gw2] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_process.ProcessStartupTest object at 0x7fe1c959e1f0>
def test_subprocess_with_pth_files_and_parallel(self):
# https://github.com/nedbat/coveragepy/issues/492
self.make_file("coverage.ini", """\
[run]
parallel = true
""")
self.set_environ("COVERAGE_PROCESS_START", "coverage.ini")
self.run_command("coverage run main.py")
with open("out.txt") as f:
assert f.read() == "Hello, world!\n"
self.run_command("coverage combine")
# assert that the combined .coverage data file is correct
self.assert_exists(".coverage")
data = coverage.CoverageData()
data.read()
> assert line_counts(data)['sub.py'] == 3
E KeyError: 'sub.py'
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/test_process.py:1200: KeyError
----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------
No data to combine
__________________________________________________________________________ test_xdist_sys_path_nuttiness_is_fixed ___________________________________________________________________________
[gw31] linux -- Python 3.8.16 /usr/bin/python3
def test_xdist_sys_path_nuttiness_is_fixed():
# See conftest.py:fix_xdist_sys_path
assert sys.path[1] != ''
> assert os.environ.get('PYTHONPATH') is None
E AssertionError: assert '/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-7.0.1-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-7.0.1-2.fc35.x86_64/usr/lib/python3.8/site-packages' is None
E + where '/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-7.0.1-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-7.0.1-2.fc35.x86_64/usr/lib/python3.8/site-packages' = <bound method Mapping.get of environ({'PATH': '/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-7.0.1-2.fc35.x86_64/u...T_WORKER_COUNT': '48', 'PYTEST_CURRENT_TEST': 'tests/test_testing.py::test_xdist_sys_path_nuttiness_is_fixed (call)'})>('PYTHONPATH')
E + where <bound method Mapping.get of environ({'PATH': '/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-7.0.1-2.fc35.x86_64/u...T_WORKER_COUNT': '48', 'PYTEST_CURRENT_TEST': 'tests/test_testing.py::test_xdist_sys_path_nuttiness_is_fixed (call)'})> = environ({'PATH': '/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-7.0.1-2.fc35.x86_64/usr/bin:/usr/bin:/usr/sbin:/us...ST_WORKER_COUNT': '48', 'PYTEST_CURRENT_TEST': 'tests/test_testing.py::test_xdist_sys_path_nuttiness_is_fixed (call)'}).get
E + where environ({'PATH': '/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-7.0.1-2.fc35.x86_64/usr/bin:/usr/bin:/usr/sbin:/us...ST_WORKER_COUNT': '48', 'PYTEST_CURRENT_TEST': 'tests/test_testing.py::test_xdist_sys_path_nuttiness_is_fixed (call)'}) = os.environ
tests/test_testing.py:29: AssertionError
_____________________________________________________________________________ SummaryTest.test_report_omitting ______________________________________________________________________________
[gw25] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_summary.SummaryTest object at 0x7f92714934c0>
def test_report_omitting(self):
# Try reporting while omitting some modules
self.make_mycode()
cov = coverage.Coverage()
> self.start_import_stop(cov, "mycode")
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/test_summary.py:104:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/coveragetest.py:80: in start_import_stop
mod = import_local_file(modname, modfile)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/coverage/misc.py:366: in import_local_file
spec.loader.exec_module(mod)
<frozen importlib._bootstrap_external>:843: in exec_module
???
<frozen importlib._bootstrap>:219: in _call_with_frames_removed
???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
import covmod1
> import covmodzip1
E ModuleNotFoundError: No module named 'covmodzip1'
/tmp/pytest-of-tkloczko/pytest-14/popen-gw25/t17/mycode.py:2: ModuleNotFoundError
_____________________________________________________________________________ SummaryTest.test_report_wildcard ______________________________________________________________________________
[gw39] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_summary.SummaryTest object at 0x7f72111e0160>
def test_report_wildcard(self):
# Try reporting using wildcards to get the modules.
self.make_mycode()
# Wildcard is handled by shell or cmdline.py, so use real commands
self.run_command("coverage run mycode.py")
report = self.report_from_command("coverage report my*.py")
# Name Stmts Miss Cover
# -------------------------------
# mycode.py 4 0 100%
# -------------------------------
# TOTAL 4 0 100%
assert self.line_count(report) == 5
assert "/coverage/" not in report
assert "/tests/modules/covmod1.py " not in report
assert "/tests/zipmods.zip/covmodzip1.py " not in report
assert "mycode.py " in report
> assert self.last_line_squeezed(report) == "TOTAL 4 0 100%"
E AssertionError: assert 'TOTAL 4 2 50%' == 'TOTAL 4 0 100%'
E - TOTAL 4 0 100%
E + TOTAL 4 2 50%
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/test_summary.py:98: AssertionError
----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------
Traceback (most recent call last):
File "mycode.py", line 2, in <module>
import covmodzip1
ModuleNotFoundError: No module named 'covmodzip1'
Name Stmts Miss Cover
-------------------------------
mycode.py 4 2 50%
-------------------------------
TOTAL 4 2 50%
_____________________________________________________________________________ SummaryTest.test_report_including _____________________________________________________________________________
[gw5] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_summary.SummaryTest object at 0x7eff83345e20>
def test_report_including(self):
# Try reporting while including some modules
self.make_mycode()
cov = coverage.Coverage()
> self.start_import_stop(cov, "mycode")
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/test_summary.py:124:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/coveragetest.py:80: in start_import_stop
mod = import_local_file(modname, modfile)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/coverage/misc.py:366: in import_local_file
spec.loader.exec_module(mod)
<frozen importlib._bootstrap_external>:843: in exec_module
???
<frozen importlib._bootstrap>:219: in _call_with_frames_removed
???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
import covmod1
> import covmodzip1
E ModuleNotFoundError: No module named 'covmodzip1'
/tmp/pytest-of-tkloczko/pytest-14/popen-gw5/t20/mycode.py:2: ModuleNotFoundError
_____________________________________________________________________________ SummaryTest.test_report_just_one ______________________________________________________________________________
[gw43] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_summary.SummaryTest object at 0x7f8b513d8a90>
def test_report_just_one(self):
# Try reporting just one module
self.make_mycode()
cov = coverage.Coverage()
> self.start_import_stop(cov, "mycode")
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/test_summary.py:65:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/coveragetest.py:80: in start_import_stop
mod = import_local_file(modname, modfile)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/coverage/misc.py:366: in import_local_file
spec.loader.exec_module(mod)
<frozen importlib._bootstrap_external>:843: in exec_module
???
<frozen importlib._bootstrap>:219: in _call_with_frames_removed
???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
import covmod1
> import covmodzip1
E ModuleNotFoundError: No module named 'covmodzip1'
/tmp/pytest-of-tkloczko/pytest-14/popen-gw43/t15/mycode.py:2: ModuleNotFoundError
===================================================================================== warnings summary ======================================================================================
tests/test_plugins.py::GoodFileTracerTest::test_defer_to_python
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/coverage/control.py:539: CoverageWarning: Plugin file tracers (fairly_odd_plugin.Plugin) aren't supported with PyTracer
self._warn(
tests/test_plugins.py::BadFileTracerTest::test_plugin_has_inherited_filereporter_method
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/coverage/control.py:539: CoverageWarning: Plugin file tracers (bad_plugin.Plugin) aren't supported with PyTracer
self._warn(
tests/test_plugins.py::GoodFileTracerTest::test_find_unexecuted
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/coverage/control.py:539: CoverageWarning: Plugin file tracers (unexecuted_plugin.Plugin) aren't supported with PyTracer
self._warn(
tests/test_plugins.py::GoodFileTracerTest::test_plugin2_with_text_report
tests/test_plugins.py::GoodFileTracerTest::test_plugin2_with_html_report
tests/test_plugins.py::GoodFileTracerTest::test_plugin2_with_xml_report
tests/test_plugins.py::GoodFileTracerTest::test_plugin2
tests/test_plugins.py::GoodFileTracerTest::test_plugin2_with_branch
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/coverage/control.py:539: CoverageWarning: Plugin file tracers (tests.plugin2.Plugin) aren't supported with PyTracer
self._warn(
tests/test_plugins.py::GoodFileTracerTest::test_plugin1
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/coverage/control.py:539: CoverageWarning: Plugin file tracers (tests.plugin1.Plugin) aren't supported with PyTracer
self._warn(
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
================================================================================== short test summary info ==================================================================================
SKIPPED [1] tests/test_arcs.py:1365: Match-case is new in 3.10
SKIPPED [1] tests/test_arcs.py:1334: Match-case is new in 3.10
SKIPPED [1] tests/test_arcs.py:1318: Match-case is new in 3.10
SKIPPED [1] tests/test_arcs.py:1350: Match-case is new in 3.10
SKIPPED [3] tests/test_concurrency.py:224: Can't test: Couldn't trace with concurrency=eventlet, the module isn't installed.
SKIPPED [2] tests/test_concurrency.py:478: Can't test: Couldn't trace with concurrency=eventlet, the module isn't installed.
SKIPPED [2] tests/test_concurrency.py:224: Can't test: Couldn't trace with concurrency=gevent, the module isn't installed.
SKIPPED [1] tests/test_concurrency.py:341: Can't run test without gevent installed.
SKIPPED [2] tests/test_concurrency.py:224: Can't test: Couldn't trace with concurrency=greenlet, the module isn't installed.
SKIPPED [1] tests/test_files.py:550: This test assumes Windows file system
SKIPPED [1] tests/test_files.py:662: Only need to run Windows tests on Windows.
SKIPPED [1] tests/test_misc.py:89: Contracts are disabled, can't test them
SKIPPED [1] tests/test_misc.py:99: Contracts are disabled, can't test them
SKIPPED [1] tests/test_misc.py:122: Contracts are disabled, can't test them
SKIPPED [1] tests/test_misc.py:109: Contracts are disabled, can't test them
SKIPPED [1] tests/test_oddball.py:209: This is too expensive for now (30s)
SKIPPED [1] tests/test_parser.py:432: Match-case is new in 3.10
SKIPPED [1] tests/test_phystokens.py:119: Soft keywords are new in Python 3.10
SKIPPED [1] tests/test_plugins.py:267: This test is only about PyTracer.
SKIPPED [1] tests/test_python.py:50: not windows
SKIPPED [1] tests/test_summary.py:730: .pyw files are only on Windows.
XFAIL tests/test_arcs.py::LoopArcTest::test_incorrect_loop_exit_bug_1175 - <3.10 traced final pass incorrectly
XFAIL tests/test_arcs.py::LoopArcTest::test_incorrect_if_bug_1175 - <3.10 traced final pass incorrectly
ERROR tests/test_venv.py::VirtualenvTest::test_third_party_venv_isnt_measured[coverage] - assert 127 == 0
ERROR tests/test_venv.py::VirtualenvTest::test_third_party_venv_isnt_measured[python -m coverage] - assert 127 == 0
ERROR tests/test_venv.py::VirtualenvTest::test_us_in_venv_isnt_measured[coverage] - assert 127 == 0
ERROR tests/test_venv.py::VirtualenvTest::test_us_in_venv_isnt_measured[python -m coverage] - assert 127 == 0
ERROR tests/test_venv.py::VirtualenvTest::test_venv_isnt_measured[coverage] - assert 127 == 0
ERROR tests/test_venv.py::VirtualenvTest::test_venv_isnt_measured[python -m coverage] - assert 127 == 0
ERROR tests/test_venv.py::VirtualenvTest::test_venv_with_dynamic_plugin[coverage] - assert 127 == 0
ERROR tests/test_venv.py::VirtualenvTest::test_venv_with_dynamic_plugin[python -m coverage] - assert 127 == 0
ERROR tests/test_venv.py::VirtualenvTest::test_installed_namespace_packages[coverage] - assert 127 == 0
ERROR tests/test_venv.py::VirtualenvTest::test_installed_namespace_packages[python -m coverage] - assert 127 == 0
ERROR tests/test_venv.py::VirtualenvTest::test_bug_888[coverage] - assert 127 == 0
ERROR tests/test_venv.py::VirtualenvTest::test_bug_888[python -m coverage] - assert 127 == 0
FAILED tests/test_cmdline.py::CmdLineStdoutTest::test_version - AssertionError: assert 'with C extension' in 'Coverage.py, version 7.0.1 without C extension\nFull documentation is at https://coverage.readthedocs.io\n'
FAILED tests/test_debug.py::DebugTraceTest::test_debug_sys_ctracer - AssertionError: assert 'CTracer: available' == 'CTracer: unavailable'
FAILED tests/test_filereporter.py::FileReporterTest::test_zipfile - ModuleNotFoundError: No module named 'zip1'
FAILED tests/test_plugins.py::GoodFileTracerTest::test_defer_to_python - AssertionError: assert ['Name ... 3 50%'] == ['Name ... 0 100%']
FAILED tests/test_plugins.py::PluginTest::test_plugin_sys_info - AssertionError: assert 'plugins.file_tracers: plugin_sys_info.Plugin' in ['-- sys -------------------------------------------------------', 'coverage_version: 7.0.1', 'coverage_module:...
FAILED tests/test_plugins.py::BadFileTracerTest::test_plugin_has_inherited_filereporter_method - Failed: DID NOT RAISE <class 'NotImplementedError'>
FAILED tests/test_plugins.py::BadFileTracerTest::test_file_tracer_has_inherited_sourcefilename_method - assert "Disabling plug-in 'bad_plugin.Plugin' due to " in "Plugin file tracers (bad_plugin.Plugin) aren't supported with PyTracer"
FAILED tests/test_plugins.py::GoodFileTracerTest::test_find_unexecuted - assert [1] == [99, 999, 9999]
FAILED tests/test_plugins.py::BadFileTracerTest::test_file_tracer_fails - assert 0 == 1
FAILED tests/test_plugins.py::BadFileTracerTest::test_line_number_range_returns_triple - assert "Disabling plug-in 'bad_plugin.Plugin' due to " in "Plugin file tracers (bad_plugin.Plugin) aren't supported with PyTracer"
FAILED tests/test_plugins.py::BadFileTracerTest::test_line_number_range_raises_error - assert "Disabling plug-in 'bad_plugin.Plugin' due to " in "Plugin file tracers (bad_plugin.Plugin) aren't supported with PyTracer"
FAILED tests/test_plugins.py::BadFileTracerTest::test_line_number_range_returns_non_tuple - assert "Disabling plug-in 'bad_plugin.Plugin' due to " in "Plugin file tracers (bad_plugin.Plugin) aren't supported with PyTracer"
FAILED tests/test_plugins.py::BadFileTracerTest::test_source_filename_fails - assert 0 == 1
FAILED tests/test_plugins.py::BadFileTracerTest::test_dynamic_source_filename_fails - assert 0 == 1
FAILED tests/test_plugins.py::BadFileTracerTest::test_file_tracer_fails_eventually - assert 0 == 1
FAILED tests/test_plugins.py::BadFileTracerTest::test_file_tracer_returns_wrong - assert "Disabling plug-in 'bad_plugin.Plugin' due to " in "Plugin file tracers (bad_plugin.Plugin) aren't supported with PyTracer"
FAILED tests/test_plugins.py::BadFileTracerTest::test_line_number_range_returns_pair_of_strings - assert "Disabling plug-in 'bad_plugin.Plugin' due to " in "Plugin file tracers (bad_plugin.Plugin) aren't supported with PyTracer"
FAILED tests/test_plugins.py::GoodFileTracerTest::test_plugin2_with_text_report - coverage.exceptions.NoDataError: No data to report.
FAILED tests/test_plugins.py::GoodFileTracerTest::test_plugin2_with_html_report - coverage.exceptions.NoDataError: No data to report.
FAILED tests/test_plugins.py::GoodFileTracerTest::test_plugin2_with_xml_report - coverage.exceptions.NoDataError: No data to report.
FAILED tests/test_plugins.py::BadFileTracerTest::test_source_filename_returns_wrong - assert "Disabling plug-in 'bad_plugin.Plugin' due to " in "Plugin file tracers (bad_plugin.Plugin) aren't supported with PyTracer"
FAILED tests/test_plugins.py::GoodFileTracerTest::test_plugin2 - coverage.exceptions.NotPython: Couldn't parse '/tmp/pytest-of-tkloczko/pytest-14/popen-gw24/t19/foo_7.html' as Python source: 'invalid syntax' at line 1
FAILED tests/test_plugins.py::BadFileTracerTest::test_has_dynamic_source_filename_fails - assert 0 == 1
FAILED tests/test_plugins.py::GoodFileTracerTest::test_plugin1 - coverage.exceptions.NoSource: No source for code: '/src/try_ABC.zz'.
FAILED tests/test_plugins.py::GoodFileTracerTest::test_plugin2_with_branch - coverage.exceptions.NotPython: Couldn't parse '/tmp/pytest-of-tkloczko/pytest-14/popen-gw4/t17/foo_7.html' as Python source: 'invalid syntax' at line 1
FAILED tests/test_plugins.py::BadFileTracerTest::test_file_tracer_has_no_file_tracer_method - assert "Disabling plug-in 'bad_plugin.Plugin' due to " in "Plugin file tracers (bad_plugin.Plugin) aren't supported with PyTracer"
FAILED tests/test_process.py::ProcessTest::test_tests_dir_is_importable - assert "Traceback (m...covmodzip1'\n" == 'done\n'
FAILED tests/test_python.py::GetZipBytesTest::test_get_encoded_zip_files[utf-8] - AttributeError: 'NoneType' object has no attribute 'decode'
FAILED tests/test_python.py::GetZipBytesTest::test_get_encoded_zip_files[gb2312] - AttributeError: 'NoneType' object has no attribute 'decode'
FAILED tests/test_python.py::GetZipBytesTest::test_get_encoded_zip_files[hebrew] - AttributeError: 'NoneType' object has no attribute 'decode'
FAILED tests/test_python.py::GetZipBytesTest::test_get_encoded_zip_files[shift_jis] - AttributeError: 'NoneType' object has no attribute 'decode'
FAILED tests/test_process.py::ProcessTest::test_fullcoverage - AssertionError: assert '/usr/bin/pyt...ed coverage\n' == 'FOOEY == BOO\n'
FAILED tests/test_process.py::ProcessStartupWithSourceTest::test_pth_and_source_work_together[main--] - AssertionError: File '.coverage' should exist
FAILED tests/test_python.py::GetZipBytesTest::test_get_encoded_zip_files[cp1252] - AttributeError: 'NoneType' object has no attribute 'decode'
FAILED tests/test_process.py::ProcessStartupWithSourceTest::test_pth_and_source_work_together[main-pkg--m] - AssertionError: File '.coverage' should exist
FAILED tests/test_process.py::ProcessStartupWithSourceTest::test_pth_and_source_work_together[main---m] - AssertionError: File '.coverage' should exist
FAILED tests/test_process.py::ProcessStartupWithSourceTest::test_pth_and_source_work_together[sub-pkg-] - AssertionError: File '.coverage' should exist
FAILED tests/test_summary.py::SummaryTest::test_report - ModuleNotFoundError: No module named 'covmodzip1'
FAILED tests/test_process.py::ProcessStartupTest::test_subprocess_with_pth_files - assert 100 == 3
FAILED tests/test_process.py::ProcessStartupWithSourceTest::test_pth_and_source_work_together[sub-pkg--m] - AssertionError: File '.coverage' should exist
FAILED tests/test_process.py::ProcessStartupWithSourceTest::test_pth_and_source_work_together[main-pkg-] - AssertionError: File '.coverage' should exist
FAILED tests/test_process.py::ProcessStartupWithSourceTest::test_pth_and_source_work_together[sub--] - AssertionError: File '.coverage' should exist
FAILED tests/test_process.py::EnvironmentTest::test_coverage_zip_is_like_python - assert '"DATA": "xyzzy"' in "python3: can't open file '/home/tkloczko/rpmbuild/BUILD/coveragepy-7.0.1/tests/covmain.zip': [Errno 2] No such file or directory\n"
FAILED tests/test_process.py::ProcessStartupWithSourceTest::test_pth_and_source_work_together[sub---m] - AssertionError: File '.coverage' should exist
FAILED tests/test_process.py::ProcessStartupTest::test_subprocess_with_pth_files_and_parallel - KeyError: 'sub.py'
FAILED tests/test_testing.py::test_xdist_sys_path_nuttiness_is_fixed - AssertionError: assert '/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-7.0.1-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-7.0.1-...
FAILED tests/test_summary.py::SummaryTest::test_report_omitting - ModuleNotFoundError: No module named 'covmodzip1'
FAILED tests/test_summary.py::SummaryTest::test_report_wildcard - AssertionError: assert 'TOTAL 4 2 50%' == 'TOTAL 4 0 100%'
FAILED tests/test_summary.py::SummaryTest::test_report_including - ModuleNotFoundError: No module named 'covmodzip1'
FAILED tests/test_summary.py::SummaryTest::test_report_just_one - ModuleNotFoundError: No module named 'covmodzip1'
50 failed, 1226 passed, 26 skipped, 2 xfailed, 9 warnings, 12 errors in 14.88s
/usr/lib/python3.8/site-packages/_pytest/pathlib.py:79: PytestWarning: (rm_rf) error removing /tmp/pytest-of-tkloczko/garbage-16a01919-b319-49f9-871c-afade6895c4c/test_rmtree_errorhandler_rerai0
<class 'OSError'>: [Errno 39] Directory not empty: 'test_rmtree_errorhandler_rerai0'
warnings.warn(
/usr/lib/python3.8/site-packages/_pytest/pathlib.py:79: PytestWarning: (rm_rf) error removing /tmp/pytest-of-tkloczko/garbage-16a01919-b319-49f9-871c-afade6895c4c/test_rmtree_errorhandler_reado0
<class 'OSError'>: [Errno 39] Directory not empty: 'test_rmtree_errorhandler_reado0'
warnings.warn(
/usr/lib/python3.8/site-packages/_pytest/pathlib.py:79: PytestWarning: (rm_rf) error removing /tmp/pytest-of-tkloczko/garbage-16a01919-b319-49f9-871c-afade6895c4c/test_safe_delete_no_perms0
<class 'OSError'>: [Errno 39] Directory not empty: 'test_safe_delete_no_perms0'
warnings.warn(
/usr/lib/python3.8/site-packages/_pytest/pathlib.py:79: PytestWarning: (rm_rf) error removing /tmp/pytest-of-tkloczko/garbage-16a01919-b319-49f9-871c-afade6895c4c/test_safe_set_no_perms0
<class 'OSError'>: [Errno 39] Directory not empty: 'test_safe_set_no_perms0'
warnings.warn(
/usr/lib/python3.8/site-packages/_pytest/pathlib.py:79: PytestWarning: (rm_rf) error removing /tmp/pytest-of-tkloczko/garbage-16a01919-b319-49f9-871c-afade6895c4c/test_safe_get_no_perms0
<class 'OSError'>: [Errno 39] Directory not empty: 'test_safe_get_no_perms0'
warnings.warn(
/usr/lib/python3.8/site-packages/_pytest/pathlib.py:79: PytestWarning: (rm_rf) error removing /tmp/pytest-of-tkloczko/garbage-16a01919-b319-49f9-871c-afade6895c4c
<class 'OSError'>: [Errno 39] Directory not empty: '/tmp/pytest-of-tkloczko/garbage-16a01919-b319-49f9-871c-afade6895c4c'
warnings.warn( |
Things like Now question only os why this .. why that assumption with only try writing a .pth file in a directory if there's already a .pth file there was necessary? 🤔 |
I'm going add in my packaging procedure tempporary those failing units to --deselect list to have some working baseline. |
Just please try to execute in project source root directory something like below: python3 -sBm build -w --no-isolation Instead |
First issue which needs to be sorted out is hardcoded |
I'm open to suggestions about how to make the tests runnable in more environments, but there's a limit to how complex I will make things. I already use sys.executable to run Python: coveragepy/tests/coveragetest.py Lines 428 to 434 in 31c216b
Do you have specific changes to suggest? |
Look .. that wherenever is necessary to use python executable its name ishoud be not used hardcoded [tkloczko@pers-jacek coveragepy-7.2.5]$ grep -r "python " tests
tests/balance_xdist_plugin.py:# python -c "from tests.balance_xdist_plugin import show_worker_times as f; f()"
tests/coveragetest.py: # Use the real name of our own executable. So "python foo.py" might
tests/modules/process_test/try_execfile.py: $ python try_execfile.py
tests/test_config.py: python igor.py zip_mods
tests/test_debug.py: python platform implementation executable
tests/test_filereporter.py:from coverage.python import PythonFileReporter
tests/test_html.py: self.make_file("innocuous.html", "<h1>This isn't python at all!</h1>")
tests/test_html.py: self.make_file("liar.html", "{# Whoops, not python code #}")
tests/test_oddball.py: status, out = self.run_command_status("python main.py")
tests/test_oddball.py: status, out = self.run_command_status("python atexit_gettrace.py")
tests/test_phystokens.py:from coverage.python import get_python_source
tests/test_plugins.py: # A plugin that measures, but then wants built-in python reporting.
tests/test_process.py: out = self.run_command("python envornot.py")
tests/test_process.py: out2 = self.run_command("python throw.py")
tests/test_process.py: status2, out2 = self.run_command_status("python exit.py")
tests/test_process.py: status2, out2 = self.run_command_status("python exit_none.py")
tests/test_process.py: py_out = self.run_command("python showtrace.py")
tests/test_process.py: out = self.run_command("python hello.py")
tests/test_process.py: out = self.run_command("python -X frozen_modules=off -m coverage run -L getenv.py")
tests/test_process.py: out = self.run_command("python allok.py")
tests/test_process.py: out = self.run_command("python run_twice.py")
tests/test_process.py: # $ python -m coverage
tests/test_process.py: out = self.run_command("python -m coverage")
tests/test_process.py: expected = self.run_command("python run_me.py")
tests/test_process.py: expected = self.run_command("python sub/overthere/prog.py")
tests/test_process.py: expected = self.run_command("python -m process_test.try_execfile")
tests/test_process.py: expected = self.run_command("python with_main")
tests/test_process.py: expected = self.run_command("python -m with_main")
tests/test_process.py: expected = self.run_command("python -m with_main")
tests/test_process.py: expected = self.run_command("python -m process_test.try_execfile")
tests/test_process.py: expected = self.run_command("python -m process_test.try_execfile")
tests/test_process.py: expected = self.run_command("python myscript")
tests/test_process.py: expected = self.run_command("python -m sub.run_me")
tests/test_process.py: expected = self.run_command("python -m package")
tests/test_process.py: expected = self.run_command("python run_me.py")
tests/test_process.py: actual = self.run_command(f"python {cov_main} run run_me.py")
tests/test_process.py: out = self.run_command("python run_coverage.py run how_is_it.py")
tests/test_process.py: out = self.run_command("python -m run_coverage run how_is_it.py")
tests/test_process.py: py_st, py_out = self.run_command_status("python excepthook.py")
tests/test_process.py: py_st, py_out = self.run_command_status("python excepthook_exit.py")
tests/test_process.py: py_st, py_out = self.run_command_status("python excepthook_throw.py")
tests/test_process.py: out = self.run_command("python -m pydoc " + name)
tests/test_process.py: 1. -m versus a simple script argument (for example, `python myscript`),
tests/test_process.py: cmd = "python -m %s" % fullname('main')
tests/test_process.py: cmd = "python %s" % path('main.py')
tests/test_python.py:from coverage.python import get_zip_bytes, source_for_file
tests/test_setup.py: "python setup.py --description --version --url --author"
tests/test_summary.py: self.make_file("mycode.py", "This isn't python at all!")
tests/test_summary.py: self.make_file("accented\xe2.py", "This isn't python at all!")
tests/test_summary.py: self.make_file("mycode.py", "This isn't python at all!")
tests/test_summary.py: self.make_file("mycode.html", "<h1>This isn't python at all!</h1>")
tests/test_summary.py: # This is a python file though it doesn't look like it, like a main script.
tests/test_testing.py: out_lines = self.run_command("python showme.py").splitlines()
tests/test_testing.py: out = self.run_command("python outputs.py")
tests/test_venv.py: run_command("python -m venv venv")
tests/test_venv.py: "python -m pip install " +
tests/test_venv.py: "python -m coverage",
tests/test_venv.py: run_in_venv("python -m pip install .") So as you see in in many places where All pip and coverage executions not done over |
With below grep output it is better vidsible [tkloczko@pers-jacek coveragepy-7.2.5]$ grep -r 'run_command_status("python' tests
tests/test_oddball.py: status, out = self.run_command_status("python main.py")
tests/test_oddball.py: status, out = self.run_command_status("python atexit_gettrace.py")
tests/test_process.py: status2, out2 = self.run_command_status("python exit.py")
tests/test_process.py: status2, out2 = self.run_command_status("python exit_none.py")
tests/test_process.py: py_st, py_out = self.run_command_status("python excepthook.py")
tests/test_process.py: py_st, py_out = self.run_command_status("python excepthook_exit.py")
tests/test_process.py: py_st, py_out = self.run_command_status("python excepthook_throw.py") |
If you look at the code I linked you to earlier, it's the |
Please have look one more time on pytest output which I've provides. You can find there fragments like # Install everything.
> run_in_venv(
"python -m pip install " +
"./third_pkg " +
"-e ./another_pkg " +
"-e ./bug888/app -e ./bug888/plugin " +
COVERAGE_INSTALL_ARGS
) Where |
Are you sure changing those uses will fix your problem? |
So why it fails? 🤔 |
Maybe we can go back to your original goal. Why are you running "pytest" directly? There are steps needed to get the world right for the tests. Tox does this for me. If you use tox, there are still a few failures, but only five: mkdir /tmp/bug1373
cd /tmp/bug1373
git clone https://github.com/nedbat/coveragepy
python3.7 -m venv venv
. ./venv/bin/activate
cd coveragepy
pip install -r requirements/dev.pip
python3 -m pip install build installer wheel
python3 -sBm build -w --no-isolation
python3 -sBm installer dist/*.whl --destdir /tmp/coveragepy
PYTHONPATH=/tmp/coveragepy/$(python3 -Ic "import sysconfig; print(sysconfig.get_path('purelib'))") tox -r -e py37
|
As I wrote I'm building rpm package with your module. Above methodology is widely used on building not only rpm but Debian deb packages as well. BuildRequires: gcc
BuildRequires: python3-devel
BuildRequires: python3dist(build)
BuildRequires: python3dist(installer)
BuildRequires: python3dist(setuptools)
BuildRequires: python3dist(sphinx)
BuildRequires: python3dist(sphinxcontrib-restbuilder)
BuildRequires: python3dist(sphinxcontrib-spelling)
BuildRequires: python3dist(sphinx-rst-builder)
BuildRequires: python3dist(sphinx-rtd-theme)
BuildRequires: python3dist(sphinx-tabs)
BuildRequires: python3dist(wheel)
# CheckRequires:
BuildRequires: python3dist(flaky)
BuildRequires: python3dist(hypothesis)
BuildRequires: python3dist(pytest)
BuildRequires: python3dist(pytest-xdist) What is not on above list have been installed as above install time dependencies. If you need more details about context feel free to ask .. I'll try to explain everything as good as I only cane 😋 |
I know nothing about rpm packages. I don't know where the list of BuildRequires came from. Why are hypothesis and sphinx-tabs in the list, but tox is not? Why don't we just add tox to the list if it's required to run the tests? The alternative is to use the tox.ini as a model of what is needed to configure the world properly to run the tests. Simply running "pytest" isn't going to be enough. |
@kloczek For which distribution are you building this RPM? |
@kloczek Fedora is building rpm's, maybe you can see how they are doing it: https://src.fedoraproject.org/rpms/python-coverage |
rpm has nothing to do here as this tooling is only part oof broader context which I've described you why I'm doing thing isn exact way to give you possibility to understand fact that behind those steps are some rational causes.
My own. That distribution however shares almost 100% methodologies used in Fedora.
If you will look closer you woul find that Fedora spec file for
That is the problem of the Fedora that as all community maintained disstribution it is problem with use common methodologies as bradly as it is ony possible. More time takes poitless discussion on introducing such methodologires, voting nad approving thhan actual change which could be introduced in matter of minutes on scale of all packages. Fedora python-coverage.spec file has been added first time +13 years ago and maintainer of that package is really lagging even in context of use of alredy approved/recommended Fedora packaging methodologies. To give you example what I've done here is my python-coverage.spec file # BUG: pytest is failing https://github.com/nedbat/coveragepy/issues/1373
%bcond_with failing_tests # By default skip some failing test units
Summary: Code coverage testing module for Python
Name: python-coverage
Version: 7.2.5
Release: 2%{?dist}
License: Apache-2.0 (https://spdx.org/licenses/Apache-2.0.html)
URL: https://pypi.org/project/coverage/
VCS: https://github.com/nedbat/coveragepy/
Source: %{VCS}/archive/%{version}/%{name}-%{version}.tar.gz
Patch: %{name}-man3_level.patch
Patch: %{name}-add_module_path_in_conf.py.patch
BuildRequires: gcc
BuildRequires: python3-devel
BuildRequires: python3dist(build)
BuildRequires: python3dist(installer)
BuildRequires: python3dist(setuptools)
BuildRequires: python3dist(sphinx)
BuildRequires: python3dist(sphinxcontrib-restbuilder)
BuildRequires: python3dist(sphinxcontrib-spelling)
BuildRequires: python3dist(sphinx-rst-builder)
BuildRequires: python3dist(sphinx-rtd-theme)
BuildRequires: python3dist(sphinx-tabs)
BuildRequires: python3dist(wheel)
# CheckRequires:
BuildRequires: python3dist(flaky)
BuildRequires: python3dist(hypothesis)
BuildRequires: python3dist(pytest)
BuildRequires: python3dist(pytest-xdist)
Obsoletes: python3-coverage
%description
Coverage.py is a Python module that measures code coverage during Python
execution. It uses the code analysis tools and tracing hooks provided in the
Python standard library to determine which lines are executable, and which have
been executed.
%prep
%autosetup -p1 -n coveragepy-%{version}
%build
%pyproject_wheel
%sphinx_build_man doc
%install
%pyproject_install
%__install -Dm644 build/sphinx/man/*.3 -t %{buildroot}%{_mandir}/man3
%check
> %{buildroot}%{python3_sitearch}/foo.pth
%pytest %{!?with_failing_tests: \
--deselect tests/test_cmdline.py::CmdLineStdoutTest::test_version \
--deselect tests/test_concurrency.py::SigtermTest::test_sigterm_threading_saves_data \
--deselect tests/test_debug.py::DebugTraceTest::test_debug_sys_ctracer \
--deselect tests/test_filereporter.py::FileReporterTest::test_zipfile \
--deselect tests/test_plugins.py::BadFileTracerTest::test_dynamic_source_filename_fails \
--deselect tests/test_plugins.py::BadFileTracerTest::test_file_tracer_fails \
--deselect tests/test_plugins.py::BadFileTracerTest::test_file_tracer_fails_eventually \
--deselect tests/test_plugins.py::BadFileTracerTest::test_file_tracer_has_inherited_sourcefilename_method \
--deselect tests/test_plugins.py::BadFileTracerTest::test_file_tracer_has_no_file_tracer_method \
--deselect tests/test_plugins.py::BadFileTracerTest::test_file_tracer_returns_wrong \
--deselect tests/test_plugins.py::BadFileTracerTest::test_has_dynamic_source_filename_fails \
--deselect tests/test_plugins.py::BadFileTracerTest::test_line_number_range_raises_error \
--deselect tests/test_plugins.py::BadFileTracerTest::test_line_number_range_returns_non_tuple \
--deselect tests/test_plugins.py::BadFileTracerTest::test_line_number_range_returns_pair_of_strings \
--deselect tests/test_plugins.py::BadFileTracerTest::test_line_number_range_returns_triple \
--deselect tests/test_plugins.py::BadFileTracerTest::test_plugin_has_inherited_filereporter_method \
--deselect tests/test_plugins.py::BadFileTracerTest::test_source_filename_fails \
--deselect tests/test_plugins.py::BadFileTracerTest::test_source_filename_returns_wrong \
--deselect tests/test_plugins.py::GoodFileTracerTest::test_defer_to_python \
--deselect tests/test_plugins.py::GoodFileTracerTest::test_find_unexecuted \
--deselect tests/test_plugins.py::GoodFileTracerTest::test_plugin1 \
--deselect tests/test_plugins.py::GoodFileTracerTest::test_plugin2 \
--deselect tests/test_plugins.py::GoodFileTracerTest::test_plugin2_with_branch \
--deselect tests/test_plugins.py::GoodFileTracerTest::test_plugin2_with_html_report \
--deselect tests/test_plugins.py::GoodFileTracerTest::test_plugin2_with_text_report \
--deselect tests/test_plugins.py::GoodFileTracerTest::test_plugin2_with_xml_report \
--deselect tests/test_plugins.py::PluginTest::test_plugin_sys_info \
--deselect tests/test_process.py::EnvironmentTest::test_coverage_zip_is_like_python \
--deselect tests/test_process.py::ProcessStartupTest::test_subprocess_with_pth_files \
--deselect tests/test_process.py::ProcessStartupTest::test_subprocess_with_pth_files_and_parallel \
--deselect tests/test_process.py::ProcessStartupWithSourceTest::test_pth_and_source_work_together[main---m] \
--deselect tests/test_process.py::ProcessStartupWithSourceTest::test_pth_and_source_work_together[main--] \
--deselect tests/test_process.py::ProcessStartupWithSourceTest::test_pth_and_source_work_together[main-pkg--m] \
--deselect tests/test_process.py::ProcessStartupWithSourceTest::test_pth_and_source_work_together[main-pkg-] \
--deselect tests/test_process.py::ProcessStartupWithSourceTest::test_pth_and_source_work_together[sub---m] \
--deselect tests/test_process.py::ProcessStartupWithSourceTest::test_pth_and_source_work_together[sub--] \
--deselect tests/test_process.py::ProcessStartupWithSourceTest::test_pth_and_source_work_together[sub-pkg--m] \
--deselect tests/test_process.py::ProcessStartupWithSourceTest::test_pth_and_source_work_together[sub-pkg-] \
--deselect tests/test_process.py::ProcessTest::test_fullcoverage \
--deselect tests/test_process.py::ProcessTest::test_tests_dir_is_importable \
--deselect tests/test_python.py::GetZipBytesTest::test_get_encoded_zip_files[cp1252] \
--deselect tests/test_python.py::GetZipBytesTest::test_get_encoded_zip_files[gb2312] \
--deselect tests/test_python.py::GetZipBytesTest::test_get_encoded_zip_files[hebrew] \
--deselect tests/test_python.py::GetZipBytesTest::test_get_encoded_zip_files[shift_jis] \
--deselect tests/test_python.py::GetZipBytesTest::test_get_encoded_zip_files[utf-8] \
--deselect tests/test_summary.py::SummaryTest::test_report \
--deselect tests/test_summary.py::SummaryTest::test_report_including \
--deselect tests/test_summary.py::SummaryTest::test_report_just_one \
--deselect tests/test_summary.py::SummaryTest::test_report_omitting \
--deselect tests/test_summary.py::SummaryTest::test_report_wildcard \
--deselect tests/test_testing.py::test_xdist_sys_path_nuttiness_is_fixed \
--deselect tests/test_venv.py::VirtualenvTest::test_bug_888[coverage] \
--deselect tests/test_venv.py::VirtualenvTest::test_bug_888['python -m coverage'] \
--deselect tests/test_venv.py::VirtualenvTest::test_installed_namespace_packages[coverage] \
--deselect tests/test_venv.py::VirtualenvTest::test_installed_namespace_packages['python -m coverage'] \
--deselect tests/test_venv.py::VirtualenvTest::test_third_party_venv_isnt_measured[coverage-False] \
--deselect tests/test_venv.py::VirtualenvTest::test_third_party_venv_isnt_measured[coverage-True] \
--deselect tests/test_venv.py::VirtualenvTest::test_third_party_venv_isnt_measured['python -m coverage-False'] \
--deselect tests/test_venv.py::VirtualenvTest::test_third_party_venv_isnt_measured['python -m coverage-True'] \
--deselect tests/test_venv.py::VirtualenvTest::test_us_in_venv_isnt_measured[coverage] \
--deselect tests/test_venv.py::VirtualenvTest::test_us_in_venv_isnt_measured['python -m coverage'] \
--deselect tests/test_venv.py::VirtualenvTest::test_venv_isnt_measured[coverage] \
--deselect tests/test_venv.py::VirtualenvTest::test_venv_isnt_measured['python -m coverage'] \
--deselect tests/test_venv.py::VirtualenvTest::test_venv_with_dynamic_plugin[coverage] \
--deselect tests/test_venv.py::VirtualenvTest::test_venv_with_dynamic_plugin['python -m coverage'] \
}
%__rm %{buildroot}%{python3_sitearch}/foo.pth
%files
%attr(755,root,root) %{_bindir}/*
%{_mandir}/man3/*
%{python3_sitearch}/coverage
%{python3_sitearch}/coverage*.*-info With that I csn for example quickly test is new version still have the same issues with failing test units. |
Going back to the subject .. |
@kloczek If you want to run tests without tox, you need to read the tox.ini file to see what it does, and duplicate that some other way. I have not heard of other distros having problems. I am going to close this issue. The title is no longer relevant, and you need to do some work on your end before we have more to discuss. |
Just checked ressults of the builds with enabled failing units and without those units and I see some progress/changes in 7.2.5 --- python-coverage.spec-7.2.4 2023-05-01 15:09:45.142162235 +0000
+++ python-coverage.spec 2023-05-01 15:08:49.867134971 +0000
@@ -4,7 +4,7 @@
Summary: Code coverage testing module for Python
Name: python-coverage
-Version: 7.2.4
+Version: 7.2.5
Release: 2%{?dist}
License: Apache-2.0 (https://spdx.org/licenses/Apache-2.0.html)
URL: https://pypi.org/project/coverage/
@@ -98,25 +98,27 @@
--deselect tests/test_python.py::GetZipBytesTest::test_get_encoded_zip_files[shift_jis] \
--deselect tests/test_python.py::GetZipBytesTest::test_get_encoded_zip_files[utf-8] \
--deselect tests/test_summary.py::SummaryTest::test_report \
+ --deselect tests/test_summary.py::SummaryTest::test_report_include_relative_files_and_path \
+ --deselect tests/test_summary.py::SummaryTest::test_report_include_relative_files_and_wildcard_path \
--deselect tests/test_summary.py::SummaryTest::test_report_including \
--deselect tests/test_summary.py::SummaryTest::test_report_just_one \
--deselect tests/test_summary.py::SummaryTest::test_report_omitting \
--deselect tests/test_summary.py::SummaryTest::test_report_wildcard \
--deselect tests/test_testing.py::test_xdist_sys_path_nuttiness_is_fixed \
- --deselect tests/test_venv.py::VirtualenvTest::test_bug_888[coverage] \
--deselect tests/test_venv.py::VirtualenvTest::test_bug_888['python -m coverage'] \
- --deselect tests/test_venv.py::VirtualenvTest::test_installed_namespace_packages[coverage] \
+ --deselect tests/test_venv.py::VirtualenvTest::test_bug_888[coverage] \
--deselect tests/test_venv.py::VirtualenvTest::test_installed_namespace_packages['python -m coverage'] \
- --deselect tests/test_venv.py::VirtualenvTest::test_third_party_venv_isnt_measured[coverage-False] \
- --deselect tests/test_venv.py::VirtualenvTest::test_third_party_venv_isnt_measured[coverage-True] \
+ --deselect tests/test_venv.py::VirtualenvTest::test_installed_namespace_packages[coverage] \
--deselect tests/test_venv.py::VirtualenvTest::test_third_party_venv_isnt_measured['python -m coverage-False'] \
--deselect tests/test_venv.py::VirtualenvTest::test_third_party_venv_isnt_measured['python -m coverage-True'] \
- --deselect tests/test_venv.py::VirtualenvTest::test_us_in_venv_isnt_measured[coverage] \
+ --deselect tests/test_venv.py::VirtualenvTest::test_third_party_venv_isnt_measured[coverage-False] \
+ --deselect tests/test_venv.py::VirtualenvTest::test_third_party_venv_isnt_measured[coverage-True] \
--deselect tests/test_venv.py::VirtualenvTest::test_us_in_venv_isnt_measured['python -m coverage'] \
- --deselect tests/test_venv.py::VirtualenvTest::test_venv_isnt_measured[coverage] \
+ --deselect tests/test_venv.py::VirtualenvTest::test_us_in_venv_isnt_measured[coverage] \
--deselect tests/test_venv.py::VirtualenvTest::test_venv_isnt_measured['python -m coverage'] \
- --deselect tests/test_venv.py::VirtualenvTest::test_venv_with_dynamic_plugin[coverage] \
+ --deselect tests/test_venv.py::VirtualenvTest::test_venv_isnt_measured[coverage] \
--deselect tests/test_venv.py::VirtualenvTest::test_venv_with_dynamic_plugin['python -m coverage'] \
+ --deselect tests/test_venv.py::VirtualenvTest::test_venv_with_dynamic_plugin[coverage] \
}
%__rm %{buildroot}%{python3_sitearch}/foo.pth
Here is pytest output withoy disable failing units + PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-7.2.5-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-7.2.5-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra -m 'not network'
bringing up nodes...
bringing up nodes...
........................................................................ [ 5%]
...............................................s.x........s............. [ 10%]
......x..............s....................s............................. [ 16%]
.....................F................................................... [ 21%]
.........................................................ss.s...ss...... [ 26%]
...............s..s.s..s............................s................... [ 32%]
........................................................................ [ 37%]
................................................................F....... [ 42%]
...................................F.......................F............ [ 48%]
......................................................................... [ 53%]
.....................................................................s.. [ 59%]
.........s.............................................................. [ 64%]
................................................................s....... [ 69%]
........................s...........s........sF.F...F..F.FFFFFFFFFFFFFFF [ 75%]
F.........F.F........F...F..F..............FF.s.......F................. [ 80%]
..F...F...................F...........sF.......F..F.F......F......F...... [ 86%]
FF.....F..................F.............FF....F......FF................. [ 91%]
.....F....................E...E.......E.....E.............E.s........E.. [ 96%]
.......E.E..FE...E.EE..E..E.....F......... [100%]
==================================== ERRORS ====================================
_ ERROR at setup of VirtualenvTest.test_third_party_venv_isnt_measured[coverage-True] _
[gw25] linux -- Python 3.8.16 /usr/bin/python3
tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-1/popen-gw25'), _trace=<pluggy._tracing.TagT...c880>, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-1/popen-gw25'), _retention_count=3, _retention_policy='all')
@pytest.fixture(scope="session", name="venv_world")
def venv_world_fixture(tmp_path_factory: pytest.TempPathFactory) -> Path:
"""Create a virtualenv with a few test packages for VirtualenvTest to use.
Returns the directory containing the "venv" virtualenv.
"""
venv_world = tmp_path_factory.mktemp("venv_world")
with change_dir(venv_world):
# Create a virtualenv.
run_command("python -m venv venv")
# A third-party package that installs a few different packages.
make_file("third_pkg/third/__init__.py", """\
import fourth
def third(x):
return 3 * x
""")
# Use plugin2.py as third.plugin
with open(os.path.join(os.path.dirname(__file__), "plugin2.py")) as f:
make_file("third_pkg/third/plugin.py", f.read())
# A render function for plugin2 to use for dynamic file names.
make_file("third_pkg/third/render.py", """\
def render(filename, linenum):
return "HTML: {}@{}".format(filename, linenum)
""")
# Another package that third can use.
make_file("third_pkg/fourth/__init__.py", """\
def fourth(x):
return 4 * x
""")
# Some namespace packages.
make_file("third_pkg/nspkg/fifth/__init__.py", """\
def fifth(x):
return 5 * x
""")
# The setup.py to install everything.
make_file("third_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="third",
packages=["third", "fourth", "nspkg.fifth"],
)
""")
# Some namespace packages.
make_file("another_pkg/nspkg/sixth/__init__.py", """\
def sixth(x):
return 6 * x
""")
make_file("another_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="another",
packages=["nspkg.sixth"],
)
""")
# Bug888 code.
make_file("bug888/app/setup.py", """\
from setuptools import setup
setup(
name='testcov',
packages=['testcov'],
namespace_packages=['testcov'],
)
""")
make_file("bug888/app/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/app/testcov/main.py", """\
try: # pragma: no cover
entry_points = __import__("pkg_resources").iter_entry_points('plugins')
except ImportError: # pragma: no cover
import importlib.metadata
entry_points = importlib.metadata.entry_points(group="plugins")
for entry_point in entry_points:
entry_point.load()()
""")
make_file("bug888/plugin/setup.py", """\
from setuptools import setup
setup(
name='testcov-plugin',
packages=['testcov'],
namespace_packages=['testcov'],
entry_points={'plugins': ['testp = testcov.plugin:testp']},
)
""")
make_file("bug888/plugin/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/plugin/testcov/plugin.py", """\
def testp():
print("Plugin here")
""")
# Install everything.
> run_in_venv(
"python -m pip install " +
"./third_pkg " +
"-e ./another_pkg " +
"-e ./bug888/app -e ./bug888/plugin " +
COVERAGE_INSTALL_ARGS
)
tests/test_venv.py:149:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5'
def run_in_venv(cmd: str) -> str:
r"""Run `cmd` in the virtualenv at `venv`.
The first word of the command will be adjusted to run it from the
venv/bin or venv\Scripts directory.
Returns the text output of the command.
"""
words = cmd.split()
if env.WINDOWS:
words[0] = fr"venv\Scripts\{words[0]}.exe"
else:
words[0] = fr"venv/bin/{words[0]}"
status, output = run_command(" ".join(words))
# Print the output so if it fails, we can tell what happened.
print(output)
> assert status == 0
E assert 127 == 0
tests/test_venv.py:40: AssertionError
---------------------------- Captured stdout setup -----------------------------
/bin/sh: line 1: venv/bin/python: No such file or directory
_ ERROR at setup of VirtualenvTest.test_third_party_venv_isnt_measured[coverage-False] _
[gw25] linux -- Python 3.8.16 /usr/bin/python3
tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-1/popen-gw25'), _trace=<pluggy._tracing.TagT...c880>, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-1/popen-gw25'), _retention_count=3, _retention_policy='all')
@pytest.fixture(scope="session", name="venv_world")
def venv_world_fixture(tmp_path_factory: pytest.TempPathFactory) -> Path:
"""Create a virtualenv with a few test packages for VirtualenvTest to use.
Returns the directory containing the "venv" virtualenv.
"""
venv_world = tmp_path_factory.mktemp("venv_world")
with change_dir(venv_world):
# Create a virtualenv.
run_command("python -m venv venv")
# A third-party package that installs a few different packages.
make_file("third_pkg/third/__init__.py", """\
import fourth
def third(x):
return 3 * x
""")
# Use plugin2.py as third.plugin
with open(os.path.join(os.path.dirname(__file__), "plugin2.py")) as f:
make_file("third_pkg/third/plugin.py", f.read())
# A render function for plugin2 to use for dynamic file names.
make_file("third_pkg/third/render.py", """\
def render(filename, linenum):
return "HTML: {}@{}".format(filename, linenum)
""")
# Another package that third can use.
make_file("third_pkg/fourth/__init__.py", """\
def fourth(x):
return 4 * x
""")
# Some namespace packages.
make_file("third_pkg/nspkg/fifth/__init__.py", """\
def fifth(x):
return 5 * x
""")
# The setup.py to install everything.
make_file("third_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="third",
packages=["third", "fourth", "nspkg.fifth"],
)
""")
# Some namespace packages.
make_file("another_pkg/nspkg/sixth/__init__.py", """\
def sixth(x):
return 6 * x
""")
make_file("another_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="another",
packages=["nspkg.sixth"],
)
""")
# Bug888 code.
make_file("bug888/app/setup.py", """\
from setuptools import setup
setup(
name='testcov',
packages=['testcov'],
namespace_packages=['testcov'],
)
""")
make_file("bug888/app/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/app/testcov/main.py", """\
try: # pragma: no cover
entry_points = __import__("pkg_resources").iter_entry_points('plugins')
except ImportError: # pragma: no cover
import importlib.metadata
entry_points = importlib.metadata.entry_points(group="plugins")
for entry_point in entry_points:
entry_point.load()()
""")
make_file("bug888/plugin/setup.py", """\
from setuptools import setup
setup(
name='testcov-plugin',
packages=['testcov'],
namespace_packages=['testcov'],
entry_points={'plugins': ['testp = testcov.plugin:testp']},
)
""")
make_file("bug888/plugin/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/plugin/testcov/plugin.py", """\
def testp():
print("Plugin here")
""")
# Install everything.
> run_in_venv(
"python -m pip install " +
"./third_pkg " +
"-e ./another_pkg " +
"-e ./bug888/app -e ./bug888/plugin " +
COVERAGE_INSTALL_ARGS
)
tests/test_venv.py:149:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5'
def run_in_venv(cmd: str) -> str:
r"""Run `cmd` in the virtualenv at `venv`.
The first word of the command will be adjusted to run it from the
venv/bin or venv\Scripts directory.
Returns the text output of the command.
"""
words = cmd.split()
if env.WINDOWS:
words[0] = fr"venv\Scripts\{words[0]}.exe"
else:
words[0] = fr"venv/bin/{words[0]}"
status, output = run_command(" ".join(words))
# Print the output so if it fails, we can tell what happened.
print(output)
> assert status == 0
E assert 127 == 0
tests/test_venv.py:40: AssertionError
_ ERROR at setup of VirtualenvTest.test_third_party_venv_isnt_measured[python -m coverage-True] _
[gw25] linux -- Python 3.8.16 /usr/bin/python3
tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-1/popen-gw25'), _trace=<pluggy._tracing.TagT...c880>, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-1/popen-gw25'), _retention_count=3, _retention_policy='all')
@pytest.fixture(scope="session", name="venv_world")
def venv_world_fixture(tmp_path_factory: pytest.TempPathFactory) -> Path:
"""Create a virtualenv with a few test packages for VirtualenvTest to use.
Returns the directory containing the "venv" virtualenv.
"""
venv_world = tmp_path_factory.mktemp("venv_world")
with change_dir(venv_world):
# Create a virtualenv.
run_command("python -m venv venv")
# A third-party package that installs a few different packages.
make_file("third_pkg/third/__init__.py", """\
import fourth
def third(x):
return 3 * x
""")
# Use plugin2.py as third.plugin
with open(os.path.join(os.path.dirname(__file__), "plugin2.py")) as f:
make_file("third_pkg/third/plugin.py", f.read())
# A render function for plugin2 to use for dynamic file names.
make_file("third_pkg/third/render.py", """\
def render(filename, linenum):
return "HTML: {}@{}".format(filename, linenum)
""")
# Another package that third can use.
make_file("third_pkg/fourth/__init__.py", """\
def fourth(x):
return 4 * x
""")
# Some namespace packages.
make_file("third_pkg/nspkg/fifth/__init__.py", """\
def fifth(x):
return 5 * x
""")
# The setup.py to install everything.
make_file("third_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="third",
packages=["third", "fourth", "nspkg.fifth"],
)
""")
# Some namespace packages.
make_file("another_pkg/nspkg/sixth/__init__.py", """\
def sixth(x):
return 6 * x
""")
make_file("another_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="another",
packages=["nspkg.sixth"],
)
""")
# Bug888 code.
make_file("bug888/app/setup.py", """\
from setuptools import setup
setup(
name='testcov',
packages=['testcov'],
namespace_packages=['testcov'],
)
""")
make_file("bug888/app/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/app/testcov/main.py", """\
try: # pragma: no cover
entry_points = __import__("pkg_resources").iter_entry_points('plugins')
except ImportError: # pragma: no cover
import importlib.metadata
entry_points = importlib.metadata.entry_points(group="plugins")
for entry_point in entry_points:
entry_point.load()()
""")
make_file("bug888/plugin/setup.py", """\
from setuptools import setup
setup(
name='testcov-plugin',
packages=['testcov'],
namespace_packages=['testcov'],
entry_points={'plugins': ['testp = testcov.plugin:testp']},
)
""")
make_file("bug888/plugin/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/plugin/testcov/plugin.py", """\
def testp():
print("Plugin here")
""")
# Install everything.
> run_in_venv(
"python -m pip install " +
"./third_pkg " +
"-e ./another_pkg " +
"-e ./bug888/app -e ./bug888/plugin " +
COVERAGE_INSTALL_ARGS
)
tests/test_venv.py:149:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5'
def run_in_venv(cmd: str) -> str:
r"""Run `cmd` in the virtualenv at `venv`.
The first word of the command will be adjusted to run it from the
venv/bin or venv\Scripts directory.
Returns the text output of the command.
"""
words = cmd.split()
if env.WINDOWS:
words[0] = fr"venv\Scripts\{words[0]}.exe"
else:
words[0] = fr"venv/bin/{words[0]}"
status, output = run_command(" ".join(words))
# Print the output so if it fails, we can tell what happened.
print(output)
> assert status == 0
E assert 127 == 0
tests/test_venv.py:40: AssertionError
_ ERROR at setup of VirtualenvTest.test_third_party_venv_isnt_measured[python -m coverage-False] _
[gw25] linux -- Python 3.8.16 /usr/bin/python3
tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-1/popen-gw25'), _trace=<pluggy._tracing.TagT...c880>, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-1/popen-gw25'), _retention_count=3, _retention_policy='all')
@pytest.fixture(scope="session", name="venv_world")
def venv_world_fixture(tmp_path_factory: pytest.TempPathFactory) -> Path:
"""Create a virtualenv with a few test packages for VirtualenvTest to use.
Returns the directory containing the "venv" virtualenv.
"""
venv_world = tmp_path_factory.mktemp("venv_world")
with change_dir(venv_world):
# Create a virtualenv.
run_command("python -m venv venv")
# A third-party package that installs a few different packages.
make_file("third_pkg/third/__init__.py", """\
import fourth
def third(x):
return 3 * x
""")
# Use plugin2.py as third.plugin
with open(os.path.join(os.path.dirname(__file__), "plugin2.py")) as f:
make_file("third_pkg/third/plugin.py", f.read())
# A render function for plugin2 to use for dynamic file names.
make_file("third_pkg/third/render.py", """\
def render(filename, linenum):
return "HTML: {}@{}".format(filename, linenum)
""")
# Another package that third can use.
make_file("third_pkg/fourth/__init__.py", """\
def fourth(x):
return 4 * x
""")
# Some namespace packages.
make_file("third_pkg/nspkg/fifth/__init__.py", """\
def fifth(x):
return 5 * x
""")
# The setup.py to install everything.
make_file("third_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="third",
packages=["third", "fourth", "nspkg.fifth"],
)
""")
# Some namespace packages.
make_file("another_pkg/nspkg/sixth/__init__.py", """\
def sixth(x):
return 6 * x
""")
make_file("another_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="another",
packages=["nspkg.sixth"],
)
""")
# Bug888 code.
make_file("bug888/app/setup.py", """\
from setuptools import setup
setup(
name='testcov',
packages=['testcov'],
namespace_packages=['testcov'],
)
""")
make_file("bug888/app/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/app/testcov/main.py", """\
try: # pragma: no cover
entry_points = __import__("pkg_resources").iter_entry_points('plugins')
except ImportError: # pragma: no cover
import importlib.metadata
entry_points = importlib.metadata.entry_points(group="plugins")
for entry_point in entry_points:
entry_point.load()()
""")
make_file("bug888/plugin/setup.py", """\
from setuptools import setup
setup(
name='testcov-plugin',
packages=['testcov'],
namespace_packages=['testcov'],
entry_points={'plugins': ['testp = testcov.plugin:testp']},
)
""")
make_file("bug888/plugin/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/plugin/testcov/plugin.py", """\
def testp():
print("Plugin here")
""")
# Install everything.
> run_in_venv(
"python -m pip install " +
"./third_pkg " +
"-e ./another_pkg " +
"-e ./bug888/app -e ./bug888/plugin " +
COVERAGE_INSTALL_ARGS
)
tests/test_venv.py:149:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5'
def run_in_venv(cmd: str) -> str:
r"""Run `cmd` in the virtualenv at `venv`.
The first word of the command will be adjusted to run it from the
venv/bin or venv\Scripts directory.
Returns the text output of the command.
"""
words = cmd.split()
if env.WINDOWS:
words[0] = fr"venv\Scripts\{words[0]}.exe"
else:
words[0] = fr"venv/bin/{words[0]}"
status, output = run_command(" ".join(words))
# Print the output so if it fails, we can tell what happened.
print(output)
> assert status == 0
E assert 127 == 0
tests/test_venv.py:40: AssertionError
___ ERROR at setup of VirtualenvTest.test_us_in_venv_isnt_measured[coverage] ___
[gw25] linux -- Python 3.8.16 /usr/bin/python3
tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-1/popen-gw25'), _trace=<pluggy._tracing.TagT...c880>, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-1/popen-gw25'), _retention_count=3, _retention_policy='all')
@pytest.fixture(scope="session", name="venv_world")
def venv_world_fixture(tmp_path_factory: pytest.TempPathFactory) -> Path:
"""Create a virtualenv with a few test packages for VirtualenvTest to use.
Returns the directory containing the "venv" virtualenv.
"""
venv_world = tmp_path_factory.mktemp("venv_world")
with change_dir(venv_world):
# Create a virtualenv.
run_command("python -m venv venv")
# A third-party package that installs a few different packages.
make_file("third_pkg/third/__init__.py", """\
import fourth
def third(x):
return 3 * x
""")
# Use plugin2.py as third.plugin
with open(os.path.join(os.path.dirname(__file__), "plugin2.py")) as f:
make_file("third_pkg/third/plugin.py", f.read())
# A render function for plugin2 to use for dynamic file names.
make_file("third_pkg/third/render.py", """\
def render(filename, linenum):
return "HTML: {}@{}".format(filename, linenum)
""")
# Another package that third can use.
make_file("third_pkg/fourth/__init__.py", """\
def fourth(x):
return 4 * x
""")
# Some namespace packages.
make_file("third_pkg/nspkg/fifth/__init__.py", """\
def fifth(x):
return 5 * x
""")
# The setup.py to install everything.
make_file("third_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="third",
packages=["third", "fourth", "nspkg.fifth"],
)
""")
# Some namespace packages.
make_file("another_pkg/nspkg/sixth/__init__.py", """\
def sixth(x):
return 6 * x
""")
make_file("another_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="another",
packages=["nspkg.sixth"],
)
""")
# Bug888 code.
make_file("bug888/app/setup.py", """\
from setuptools import setup
setup(
name='testcov',
packages=['testcov'],
namespace_packages=['testcov'],
)
""")
make_file("bug888/app/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/app/testcov/main.py", """\
try: # pragma: no cover
entry_points = __import__("pkg_resources").iter_entry_points('plugins')
except ImportError: # pragma: no cover
import importlib.metadata
entry_points = importlib.metadata.entry_points(group="plugins")
for entry_point in entry_points:
entry_point.load()()
""")
make_file("bug888/plugin/setup.py", """\
from setuptools import setup
setup(
name='testcov-plugin',
packages=['testcov'],
namespace_packages=['testcov'],
entry_points={'plugins': ['testp = testcov.plugin:testp']},
)
""")
make_file("bug888/plugin/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/plugin/testcov/plugin.py", """\
def testp():
print("Plugin here")
""")
# Install everything.
> run_in_venv(
"python -m pip install " +
"./third_pkg " +
"-e ./another_pkg " +
"-e ./bug888/app -e ./bug888/plugin " +
COVERAGE_INSTALL_ARGS
)
tests/test_venv.py:149:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5'
def run_in_venv(cmd: str) -> str:
r"""Run `cmd` in the virtualenv at `venv`.
The first word of the command will be adjusted to run it from the
venv/bin or venv\Scripts directory.
Returns the text output of the command.
"""
words = cmd.split()
if env.WINDOWS:
words[0] = fr"venv\Scripts\{words[0]}.exe"
else:
words[0] = fr"venv/bin/{words[0]}"
status, output = run_command(" ".join(words))
# Print the output so if it fails, we can tell what happened.
print(output)
> assert status == 0
E assert 127 == 0
tests/test_venv.py:40: AssertionError
_ ERROR at setup of VirtualenvTest.test_us_in_venv_isnt_measured[python -m coverage] _
[gw25] linux -- Python 3.8.16 /usr/bin/python3
tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-1/popen-gw25'), _trace=<pluggy._tracing.TagT...c880>, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-1/popen-gw25'), _retention_count=3, _retention_policy='all')
@pytest.fixture(scope="session", name="venv_world")
def venv_world_fixture(tmp_path_factory: pytest.TempPathFactory) -> Path:
"""Create a virtualenv with a few test packages for VirtualenvTest to use.
Returns the directory containing the "venv" virtualenv.
"""
venv_world = tmp_path_factory.mktemp("venv_world")
with change_dir(venv_world):
# Create a virtualenv.
run_command("python -m venv venv")
# A third-party package that installs a few different packages.
make_file("third_pkg/third/__init__.py", """\
import fourth
def third(x):
return 3 * x
""")
# Use plugin2.py as third.plugin
with open(os.path.join(os.path.dirname(__file__), "plugin2.py")) as f:
make_file("third_pkg/third/plugin.py", f.read())
# A render function for plugin2 to use for dynamic file names.
make_file("third_pkg/third/render.py", """\
def render(filename, linenum):
return "HTML: {}@{}".format(filename, linenum)
""")
# Another package that third can use.
make_file("third_pkg/fourth/__init__.py", """\
def fourth(x):
return 4 * x
""")
# Some namespace packages.
make_file("third_pkg/nspkg/fifth/__init__.py", """\
def fifth(x):
return 5 * x
""")
# The setup.py to install everything.
make_file("third_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="third",
packages=["third", "fourth", "nspkg.fifth"],
)
""")
# Some namespace packages.
make_file("another_pkg/nspkg/sixth/__init__.py", """\
def sixth(x):
return 6 * x
""")
make_file("another_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="another",
packages=["nspkg.sixth"],
)
""")
# Bug888 code.
make_file("bug888/app/setup.py", """\
from setuptools import setup
setup(
name='testcov',
packages=['testcov'],
namespace_packages=['testcov'],
)
""")
make_file("bug888/app/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/app/testcov/main.py", """\
try: # pragma: no cover
entry_points = __import__("pkg_resources").iter_entry_points('plugins')
except ImportError: # pragma: no cover
import importlib.metadata
entry_points = importlib.metadata.entry_points(group="plugins")
for entry_point in entry_points:
entry_point.load()()
""")
make_file("bug888/plugin/setup.py", """\
from setuptools import setup
setup(
name='testcov-plugin',
packages=['testcov'],
namespace_packages=['testcov'],
entry_points={'plugins': ['testp = testcov.plugin:testp']},
)
""")
make_file("bug888/plugin/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/plugin/testcov/plugin.py", """\
def testp():
print("Plugin here")
""")
# Install everything.
> run_in_venv(
"python -m pip install " +
"./third_pkg " +
"-e ./another_pkg " +
"-e ./bug888/app -e ./bug888/plugin " +
COVERAGE_INSTALL_ARGS
)
tests/test_venv.py:149:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5'
def run_in_venv(cmd: str) -> str:
r"""Run `cmd` in the virtualenv at `venv`.
The first word of the command will be adjusted to run it from the
venv/bin or venv\Scripts directory.
Returns the text output of the command.
"""
words = cmd.split()
if env.WINDOWS:
words[0] = fr"venv\Scripts\{words[0]}.exe"
else:
words[0] = fr"venv/bin/{words[0]}"
status, output = run_command(" ".join(words))
# Print the output so if it fails, we can tell what happened.
print(output)
> assert status == 0
E assert 127 == 0
tests/test_venv.py:40: AssertionError
______ ERROR at setup of VirtualenvTest.test_venv_isnt_measured[coverage] ______
[gw25] linux -- Python 3.8.16 /usr/bin/python3
tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-1/popen-gw25'), _trace=<pluggy._tracing.TagT...c880>, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-1/popen-gw25'), _retention_count=3, _retention_policy='all')
@pytest.fixture(scope="session", name="venv_world")
def venv_world_fixture(tmp_path_factory: pytest.TempPathFactory) -> Path:
"""Create a virtualenv with a few test packages for VirtualenvTest to use.
Returns the directory containing the "venv" virtualenv.
"""
venv_world = tmp_path_factory.mktemp("venv_world")
with change_dir(venv_world):
# Create a virtualenv.
run_command("python -m venv venv")
# A third-party package that installs a few different packages.
make_file("third_pkg/third/__init__.py", """\
import fourth
def third(x):
return 3 * x
""")
# Use plugin2.py as third.plugin
with open(os.path.join(os.path.dirname(__file__), "plugin2.py")) as f:
make_file("third_pkg/third/plugin.py", f.read())
# A render function for plugin2 to use for dynamic file names.
make_file("third_pkg/third/render.py", """\
def render(filename, linenum):
return "HTML: {}@{}".format(filename, linenum)
""")
# Another package that third can use.
make_file("third_pkg/fourth/__init__.py", """\
def fourth(x):
return 4 * x
""")
# Some namespace packages.
make_file("third_pkg/nspkg/fifth/__init__.py", """\
def fifth(x):
return 5 * x
""")
# The setup.py to install everything.
make_file("third_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="third",
packages=["third", "fourth", "nspkg.fifth"],
)
""")
# Some namespace packages.
make_file("another_pkg/nspkg/sixth/__init__.py", """\
def sixth(x):
return 6 * x
""")
make_file("another_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="another",
packages=["nspkg.sixth"],
)
""")
# Bug888 code.
make_file("bug888/app/setup.py", """\
from setuptools import setup
setup(
name='testcov',
packages=['testcov'],
namespace_packages=['testcov'],
)
""")
make_file("bug888/app/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/app/testcov/main.py", """\
try: # pragma: no cover
entry_points = __import__("pkg_resources").iter_entry_points('plugins')
except ImportError: # pragma: no cover
import importlib.metadata
entry_points = importlib.metadata.entry_points(group="plugins")
for entry_point in entry_points:
entry_point.load()()
""")
make_file("bug888/plugin/setup.py", """\
from setuptools import setup
setup(
name='testcov-plugin',
packages=['testcov'],
namespace_packages=['testcov'],
entry_points={'plugins': ['testp = testcov.plugin:testp']},
)
""")
make_file("bug888/plugin/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/plugin/testcov/plugin.py", """\
def testp():
print("Plugin here")
""")
# Install everything.
> run_in_venv(
"python -m pip install " +
"./third_pkg " +
"-e ./another_pkg " +
"-e ./bug888/app -e ./bug888/plugin " +
COVERAGE_INSTALL_ARGS
)
tests/test_venv.py:149:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5'
def run_in_venv(cmd: str) -> str:
r"""Run `cmd` in the virtualenv at `venv`.
The first word of the command will be adjusted to run it from the
venv/bin or venv\Scripts directory.
Returns the text output of the command.
"""
words = cmd.split()
if env.WINDOWS:
words[0] = fr"venv\Scripts\{words[0]}.exe"
else:
words[0] = fr"venv/bin/{words[0]}"
status, output = run_command(" ".join(words))
# Print the output so if it fails, we can tell what happened.
print(output)
> assert status == 0
E assert 127 == 0
tests/test_venv.py:40: AssertionError
_ ERROR at setup of VirtualenvTest.test_venv_isnt_measured[python -m coverage] _
[gw25] linux -- Python 3.8.16 /usr/bin/python3
tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-1/popen-gw25'), _trace=<pluggy._tracing.TagT...c880>, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-1/popen-gw25'), _retention_count=3, _retention_policy='all')
@pytest.fixture(scope="session", name="venv_world")
def venv_world_fixture(tmp_path_factory: pytest.TempPathFactory) -> Path:
"""Create a virtualenv with a few test packages for VirtualenvTest to use.
Returns the directory containing the "venv" virtualenv.
"""
venv_world = tmp_path_factory.mktemp("venv_world")
with change_dir(venv_world):
# Create a virtualenv.
run_command("python -m venv venv")
# A third-party package that installs a few different packages.
make_file("third_pkg/third/__init__.py", """\
import fourth
def third(x):
return 3 * x
""")
# Use plugin2.py as third.plugin
with open(os.path.join(os.path.dirname(__file__), "plugin2.py")) as f:
make_file("third_pkg/third/plugin.py", f.read())
# A render function for plugin2 to use for dynamic file names.
make_file("third_pkg/third/render.py", """\
def render(filename, linenum):
return "HTML: {}@{}".format(filename, linenum)
""")
# Another package that third can use.
make_file("third_pkg/fourth/__init__.py", """\
def fourth(x):
return 4 * x
""")
# Some namespace packages.
make_file("third_pkg/nspkg/fifth/__init__.py", """\
def fifth(x):
return 5 * x
""")
# The setup.py to install everything.
make_file("third_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="third",
packages=["third", "fourth", "nspkg.fifth"],
)
""")
# Some namespace packages.
make_file("another_pkg/nspkg/sixth/__init__.py", """\
def sixth(x):
return 6 * x
""")
make_file("another_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="another",
packages=["nspkg.sixth"],
)
""")
# Bug888 code.
make_file("bug888/app/setup.py", """\
from setuptools import setup
setup(
name='testcov',
packages=['testcov'],
namespace_packages=['testcov'],
)
""")
make_file("bug888/app/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/app/testcov/main.py", """\
try: # pragma: no cover
entry_points = __import__("pkg_resources").iter_entry_points('plugins')
except ImportError: # pragma: no cover
import importlib.metadata
entry_points = importlib.metadata.entry_points(group="plugins")
for entry_point in entry_points:
entry_point.load()()
""")
make_file("bug888/plugin/setup.py", """\
from setuptools import setup
setup(
name='testcov-plugin',
packages=['testcov'],
namespace_packages=['testcov'],
entry_points={'plugins': ['testp = testcov.plugin:testp']},
)
""")
make_file("bug888/plugin/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/plugin/testcov/plugin.py", """\
def testp():
print("Plugin here")
""")
# Install everything.
> run_in_venv(
"python -m pip install " +
"./third_pkg " +
"-e ./another_pkg " +
"-e ./bug888/app -e ./bug888/plugin " +
COVERAGE_INSTALL_ARGS
)
tests/test_venv.py:149:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5'
def run_in_venv(cmd: str) -> str:
r"""Run `cmd` in the virtualenv at `venv`.
The first word of the command will be adjusted to run it from the
venv/bin or venv\Scripts directory.
Returns the text output of the command.
"""
words = cmd.split()
if env.WINDOWS:
words[0] = fr"venv\Scripts\{words[0]}.exe"
else:
words[0] = fr"venv/bin/{words[0]}"
status, output = run_command(" ".join(words))
# Print the output so if it fails, we can tell what happened.
print(output)
> assert status == 0
E assert 127 == 0
tests/test_venv.py:40: AssertionError
___ ERROR at setup of VirtualenvTest.test_venv_with_dynamic_plugin[coverage] ___
[gw25] linux -- Python 3.8.16 /usr/bin/python3
tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-1/popen-gw25'), _trace=<pluggy._tracing.TagT...c880>, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-1/popen-gw25'), _retention_count=3, _retention_policy='all')
@pytest.fixture(scope="session", name="venv_world")
def venv_world_fixture(tmp_path_factory: pytest.TempPathFactory) -> Path:
"""Create a virtualenv with a few test packages for VirtualenvTest to use.
Returns the directory containing the "venv" virtualenv.
"""
venv_world = tmp_path_factory.mktemp("venv_world")
with change_dir(venv_world):
# Create a virtualenv.
run_command("python -m venv venv")
# A third-party package that installs a few different packages.
make_file("third_pkg/third/__init__.py", """\
import fourth
def third(x):
return 3 * x
""")
# Use plugin2.py as third.plugin
with open(os.path.join(os.path.dirname(__file__), "plugin2.py")) as f:
make_file("third_pkg/third/plugin.py", f.read())
# A render function for plugin2 to use for dynamic file names.
make_file("third_pkg/third/render.py", """\
def render(filename, linenum):
return "HTML: {}@{}".format(filename, linenum)
""")
# Another package that third can use.
make_file("third_pkg/fourth/__init__.py", """\
def fourth(x):
return 4 * x
""")
# Some namespace packages.
make_file("third_pkg/nspkg/fifth/__init__.py", """\
def fifth(x):
return 5 * x
""")
# The setup.py to install everything.
make_file("third_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="third",
packages=["third", "fourth", "nspkg.fifth"],
)
""")
# Some namespace packages.
make_file("another_pkg/nspkg/sixth/__init__.py", """\
def sixth(x):
return 6 * x
""")
make_file("another_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="another",
packages=["nspkg.sixth"],
)
""")
# Bug888 code.
make_file("bug888/app/setup.py", """\
from setuptools import setup
setup(
name='testcov',
packages=['testcov'],
namespace_packages=['testcov'],
)
""")
make_file("bug888/app/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/app/testcov/main.py", """\
try: # pragma: no cover
entry_points = __import__("pkg_resources").iter_entry_points('plugins')
except ImportError: # pragma: no cover
import importlib.metadata
entry_points = importlib.metadata.entry_points(group="plugins")
for entry_point in entry_points:
entry_point.load()()
""")
make_file("bug888/plugin/setup.py", """\
from setuptools import setup
setup(
name='testcov-plugin',
packages=['testcov'],
namespace_packages=['testcov'],
entry_points={'plugins': ['testp = testcov.plugin:testp']},
)
""")
make_file("bug888/plugin/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/plugin/testcov/plugin.py", """\
def testp():
print("Plugin here")
""")
# Install everything.
> run_in_venv(
"python -m pip install " +
"./third_pkg " +
"-e ./another_pkg " +
"-e ./bug888/app -e ./bug888/plugin " +
COVERAGE_INSTALL_ARGS
)
tests/test_venv.py:149:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5'
def run_in_venv(cmd: str) -> str:
r"""Run `cmd` in the virtualenv at `venv`.
The first word of the command will be adjusted to run it from the
venv/bin or venv\Scripts directory.
Returns the text output of the command.
"""
words = cmd.split()
if env.WINDOWS:
words[0] = fr"venv\Scripts\{words[0]}.exe"
else:
words[0] = fr"venv/bin/{words[0]}"
status, output = run_command(" ".join(words))
# Print the output so if it fails, we can tell what happened.
print(output)
> assert status == 0
E assert 127 == 0
tests/test_venv.py:40: AssertionError
_ ERROR at setup of VirtualenvTest.test_venv_with_dynamic_plugin[python -m coverage] _
[gw25] linux -- Python 3.8.16 /usr/bin/python3
tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-1/popen-gw25'), _trace=<pluggy._tracing.TagT...c880>, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-1/popen-gw25'), _retention_count=3, _retention_policy='all')
@pytest.fixture(scope="session", name="venv_world")
def venv_world_fixture(tmp_path_factory: pytest.TempPathFactory) -> Path:
"""Create a virtualenv with a few test packages for VirtualenvTest to use.
Returns the directory containing the "venv" virtualenv.
"""
venv_world = tmp_path_factory.mktemp("venv_world")
with change_dir(venv_world):
# Create a virtualenv.
run_command("python -m venv venv")
# A third-party package that installs a few different packages.
make_file("third_pkg/third/__init__.py", """\
import fourth
def third(x):
return 3 * x
""")
# Use plugin2.py as third.plugin
with open(os.path.join(os.path.dirname(__file__), "plugin2.py")) as f:
make_file("third_pkg/third/plugin.py", f.read())
# A render function for plugin2 to use for dynamic file names.
make_file("third_pkg/third/render.py", """\
def render(filename, linenum):
return "HTML: {}@{}".format(filename, linenum)
""")
# Another package that third can use.
make_file("third_pkg/fourth/__init__.py", """\
def fourth(x):
return 4 * x
""")
# Some namespace packages.
make_file("third_pkg/nspkg/fifth/__init__.py", """\
def fifth(x):
return 5 * x
""")
# The setup.py to install everything.
make_file("third_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="third",
packages=["third", "fourth", "nspkg.fifth"],
)
""")
# Some namespace packages.
make_file("another_pkg/nspkg/sixth/__init__.py", """\
def sixth(x):
return 6 * x
""")
make_file("another_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="another",
packages=["nspkg.sixth"],
)
""")
# Bug888 code.
make_file("bug888/app/setup.py", """\
from setuptools import setup
setup(
name='testcov',
packages=['testcov'],
namespace_packages=['testcov'],
)
""")
make_file("bug888/app/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/app/testcov/main.py", """\
try: # pragma: no cover
entry_points = __import__("pkg_resources").iter_entry_points('plugins')
except ImportError: # pragma: no cover
import importlib.metadata
entry_points = importlib.metadata.entry_points(group="plugins")
for entry_point in entry_points:
entry_point.load()()
""")
make_file("bug888/plugin/setup.py", """\
from setuptools import setup
setup(
name='testcov-plugin',
packages=['testcov'],
namespace_packages=['testcov'],
entry_points={'plugins': ['testp = testcov.plugin:testp']},
)
""")
make_file("bug888/plugin/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/plugin/testcov/plugin.py", """\
def testp():
print("Plugin here")
""")
# Install everything.
> run_in_venv(
"python -m pip install " +
"./third_pkg " +
"-e ./another_pkg " +
"-e ./bug888/app -e ./bug888/plugin " +
COVERAGE_INSTALL_ARGS
)
tests/test_venv.py:149:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5'
def run_in_venv(cmd: str) -> str:
r"""Run `cmd` in the virtualenv at `venv`.
The first word of the command will be adjusted to run it from the
venv/bin or venv\Scripts directory.
Returns the text output of the command.
"""
words = cmd.split()
if env.WINDOWS:
words[0] = fr"venv\Scripts\{words[0]}.exe"
else:
words[0] = fr"venv/bin/{words[0]}"
status, output = run_command(" ".join(words))
# Print the output so if it fails, we can tell what happened.
print(output)
> assert status == 0
E assert 127 == 0
tests/test_venv.py:40: AssertionError
_ ERROR at setup of VirtualenvTest.test_installed_namespace_packages[coverage] _
[gw25] linux -- Python 3.8.16 /usr/bin/python3
tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-1/popen-gw25'), _trace=<pluggy._tracing.TagT...c880>, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-1/popen-gw25'), _retention_count=3, _retention_policy='all')
@pytest.fixture(scope="session", name="venv_world")
def venv_world_fixture(tmp_path_factory: pytest.TempPathFactory) -> Path:
"""Create a virtualenv with a few test packages for VirtualenvTest to use.
Returns the directory containing the "venv" virtualenv.
"""
venv_world = tmp_path_factory.mktemp("venv_world")
with change_dir(venv_world):
# Create a virtualenv.
run_command("python -m venv venv")
# A third-party package that installs a few different packages.
make_file("third_pkg/third/__init__.py", """\
import fourth
def third(x):
return 3 * x
""")
# Use plugin2.py as third.plugin
with open(os.path.join(os.path.dirname(__file__), "plugin2.py")) as f:
make_file("third_pkg/third/plugin.py", f.read())
# A render function for plugin2 to use for dynamic file names.
make_file("third_pkg/third/render.py", """\
def render(filename, linenum):
return "HTML: {}@{}".format(filename, linenum)
""")
# Another package that third can use.
make_file("third_pkg/fourth/__init__.py", """\
def fourth(x):
return 4 * x
""")
# Some namespace packages.
make_file("third_pkg/nspkg/fifth/__init__.py", """\
def fifth(x):
return 5 * x
""")
# The setup.py to install everything.
make_file("third_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="third",
packages=["third", "fourth", "nspkg.fifth"],
)
""")
# Some namespace packages.
make_file("another_pkg/nspkg/sixth/__init__.py", """\
def sixth(x):
return 6 * x
""")
make_file("another_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="another",
packages=["nspkg.sixth"],
)
""")
# Bug888 code.
make_file("bug888/app/setup.py", """\
from setuptools import setup
setup(
name='testcov',
packages=['testcov'],
namespace_packages=['testcov'],
)
""")
make_file("bug888/app/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/app/testcov/main.py", """\
try: # pragma: no cover
entry_points = __import__("pkg_resources").iter_entry_points('plugins')
except ImportError: # pragma: no cover
import importlib.metadata
entry_points = importlib.metadata.entry_points(group="plugins")
for entry_point in entry_points:
entry_point.load()()
""")
make_file("bug888/plugin/setup.py", """\
from setuptools import setup
setup(
name='testcov-plugin',
packages=['testcov'],
namespace_packages=['testcov'],
entry_points={'plugins': ['testp = testcov.plugin:testp']},
)
""")
make_file("bug888/plugin/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/plugin/testcov/plugin.py", """\
def testp():
print("Plugin here")
""")
# Install everything.
> run_in_venv(
"python -m pip install " +
"./third_pkg " +
"-e ./another_pkg " +
"-e ./bug888/app -e ./bug888/plugin " +
COVERAGE_INSTALL_ARGS
)
tests/test_venv.py:149:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5'
def run_in_venv(cmd: str) -> str:
r"""Run `cmd` in the virtualenv at `venv`.
The first word of the command will be adjusted to run it from the
venv/bin or venv\Scripts directory.
Returns the text output of the command.
"""
words = cmd.split()
if env.WINDOWS:
words[0] = fr"venv\Scripts\{words[0]}.exe"
else:
words[0] = fr"venv/bin/{words[0]}"
status, output = run_command(" ".join(words))
# Print the output so if it fails, we can tell what happened.
print(output)
> assert status == 0
E assert 127 == 0
tests/test_venv.py:40: AssertionError
_ ERROR at setup of VirtualenvTest.test_installed_namespace_packages[python -m coverage] _
[gw25] linux -- Python 3.8.16 /usr/bin/python3
tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-1/popen-gw25'), _trace=<pluggy._tracing.TagT...c880>, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-1/popen-gw25'), _retention_count=3, _retention_policy='all')
@pytest.fixture(scope="session", name="venv_world")
def venv_world_fixture(tmp_path_factory: pytest.TempPathFactory) -> Path:
"""Create a virtualenv with a few test packages for VirtualenvTest to use.
Returns the directory containing the "venv" virtualenv.
"""
venv_world = tmp_path_factory.mktemp("venv_world")
with change_dir(venv_world):
# Create a virtualenv.
run_command("python -m venv venv")
# A third-party package that installs a few different packages.
make_file("third_pkg/third/__init__.py", """\
import fourth
def third(x):
return 3 * x
""")
# Use plugin2.py as third.plugin
with open(os.path.join(os.path.dirname(__file__), "plugin2.py")) as f:
make_file("third_pkg/third/plugin.py", f.read())
# A render function for plugin2 to use for dynamic file names.
make_file("third_pkg/third/render.py", """\
def render(filename, linenum):
return "HTML: {}@{}".format(filename, linenum)
""")
# Another package that third can use.
make_file("third_pkg/fourth/__init__.py", """\
def fourth(x):
return 4 * x
""")
# Some namespace packages.
make_file("third_pkg/nspkg/fifth/__init__.py", """\
def fifth(x):
return 5 * x
""")
# The setup.py to install everything.
make_file("third_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="third",
packages=["third", "fourth", "nspkg.fifth"],
)
""")
# Some namespace packages.
make_file("another_pkg/nspkg/sixth/__init__.py", """\
def sixth(x):
return 6 * x
""")
make_file("another_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="another",
packages=["nspkg.sixth"],
)
""")
# Bug888 code.
make_file("bug888/app/setup.py", """\
from setuptools import setup
setup(
name='testcov',
packages=['testcov'],
namespace_packages=['testcov'],
)
""")
make_file("bug888/app/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/app/testcov/main.py", """\
try: # pragma: no cover
entry_points = __import__("pkg_resources").iter_entry_points('plugins')
except ImportError: # pragma: no cover
import importlib.metadata
entry_points = importlib.metadata.entry_points(group="plugins")
for entry_point in entry_points:
entry_point.load()()
""")
make_file("bug888/plugin/setup.py", """\
from setuptools import setup
setup(
name='testcov-plugin',
packages=['testcov'],
namespace_packages=['testcov'],
entry_points={'plugins': ['testp = testcov.plugin:testp']},
)
""")
make_file("bug888/plugin/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/plugin/testcov/plugin.py", """\
def testp():
print("Plugin here")
""")
# Install everything.
> run_in_venv(
"python -m pip install " +
"./third_pkg " +
"-e ./another_pkg " +
"-e ./bug888/app -e ./bug888/plugin " +
COVERAGE_INSTALL_ARGS
)
tests/test_venv.py:149:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5'
def run_in_venv(cmd: str) -> str:
r"""Run `cmd` in the virtualenv at `venv`.
The first word of the command will be adjusted to run it from the
venv/bin or venv\Scripts directory.
Returns the text output of the command.
"""
words = cmd.split()
if env.WINDOWS:
words[0] = fr"venv\Scripts\{words[0]}.exe"
else:
words[0] = fr"venv/bin/{words[0]}"
status, output = run_command(" ".join(words))
# Print the output so if it fails, we can tell what happened.
print(output)
> assert status == 0
E assert 127 == 0
tests/test_venv.py:40: AssertionError
___________ ERROR at setup of VirtualenvTest.test_bug_888[coverage] ____________
[gw25] linux -- Python 3.8.16 /usr/bin/python3
tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-1/popen-gw25'), _trace=<pluggy._tracing.TagT...c880>, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-1/popen-gw25'), _retention_count=3, _retention_policy='all')
@pytest.fixture(scope="session", name="venv_world")
def venv_world_fixture(tmp_path_factory: pytest.TempPathFactory) -> Path:
"""Create a virtualenv with a few test packages for VirtualenvTest to use.
Returns the directory containing the "venv" virtualenv.
"""
venv_world = tmp_path_factory.mktemp("venv_world")
with change_dir(venv_world):
# Create a virtualenv.
run_command("python -m venv venv")
# A third-party package that installs a few different packages.
make_file("third_pkg/third/__init__.py", """\
import fourth
def third(x):
return 3 * x
""")
# Use plugin2.py as third.plugin
with open(os.path.join(os.path.dirname(__file__), "plugin2.py")) as f:
make_file("third_pkg/third/plugin.py", f.read())
# A render function for plugin2 to use for dynamic file names.
make_file("third_pkg/third/render.py", """\
def render(filename, linenum):
return "HTML: {}@{}".format(filename, linenum)
""")
# Another package that third can use.
make_file("third_pkg/fourth/__init__.py", """\
def fourth(x):
return 4 * x
""")
# Some namespace packages.
make_file("third_pkg/nspkg/fifth/__init__.py", """\
def fifth(x):
return 5 * x
""")
# The setup.py to install everything.
make_file("third_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="third",
packages=["third", "fourth", "nspkg.fifth"],
)
""")
# Some namespace packages.
make_file("another_pkg/nspkg/sixth/__init__.py", """\
def sixth(x):
return 6 * x
""")
make_file("another_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="another",
packages=["nspkg.sixth"],
)
""")
# Bug888 code.
make_file("bug888/app/setup.py", """\
from setuptools import setup
setup(
name='testcov',
packages=['testcov'],
namespace_packages=['testcov'],
)
""")
make_file("bug888/app/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/app/testcov/main.py", """\
try: # pragma: no cover
entry_points = __import__("pkg_resources").iter_entry_points('plugins')
except ImportError: # pragma: no cover
import importlib.metadata
entry_points = importlib.metadata.entry_points(group="plugins")
for entry_point in entry_points:
entry_point.load()()
""")
make_file("bug888/plugin/setup.py", """\
from setuptools import setup
setup(
name='testcov-plugin',
packages=['testcov'],
namespace_packages=['testcov'],
entry_points={'plugins': ['testp = testcov.plugin:testp']},
)
""")
make_file("bug888/plugin/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/plugin/testcov/plugin.py", """\
def testp():
print("Plugin here")
""")
# Install everything.
> run_in_venv(
"python -m pip install " +
"./third_pkg " +
"-e ./another_pkg " +
"-e ./bug888/app -e ./bug888/plugin " +
COVERAGE_INSTALL_ARGS
)
tests/test_venv.py:149:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5'
def run_in_venv(cmd: str) -> str:
r"""Run `cmd` in the virtualenv at `venv`.
The first word of the command will be adjusted to run it from the
venv/bin or venv\Scripts directory.
Returns the text output of the command.
"""
words = cmd.split()
if env.WINDOWS:
words[0] = fr"venv\Scripts\{words[0]}.exe"
else:
words[0] = fr"venv/bin/{words[0]}"
status, output = run_command(" ".join(words))
# Print the output so if it fails, we can tell what happened.
print(output)
> assert status == 0
E assert 127 == 0
tests/test_venv.py:40: AssertionError
______ ERROR at setup of VirtualenvTest.test_bug_888[python -m coverage] _______
[gw25] linux -- Python 3.8.16 /usr/bin/python3
tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-1/popen-gw25'), _trace=<pluggy._tracing.TagT...c880>, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-1/popen-gw25'), _retention_count=3, _retention_policy='all')
@pytest.fixture(scope="session", name="venv_world")
def venv_world_fixture(tmp_path_factory: pytest.TempPathFactory) -> Path:
"""Create a virtualenv with a few test packages for VirtualenvTest to use.
Returns the directory containing the "venv" virtualenv.
"""
venv_world = tmp_path_factory.mktemp("venv_world")
with change_dir(venv_world):
# Create a virtualenv.
run_command("python -m venv venv")
# A third-party package that installs a few different packages.
make_file("third_pkg/third/__init__.py", """\
import fourth
def third(x):
return 3 * x
""")
# Use plugin2.py as third.plugin
with open(os.path.join(os.path.dirname(__file__), "plugin2.py")) as f:
make_file("third_pkg/third/plugin.py", f.read())
# A render function for plugin2 to use for dynamic file names.
make_file("third_pkg/third/render.py", """\
def render(filename, linenum):
return "HTML: {}@{}".format(filename, linenum)
""")
# Another package that third can use.
make_file("third_pkg/fourth/__init__.py", """\
def fourth(x):
return 4 * x
""")
# Some namespace packages.
make_file("third_pkg/nspkg/fifth/__init__.py", """\
def fifth(x):
return 5 * x
""")
# The setup.py to install everything.
make_file("third_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="third",
packages=["third", "fourth", "nspkg.fifth"],
)
""")
# Some namespace packages.
make_file("another_pkg/nspkg/sixth/__init__.py", """\
def sixth(x):
return 6 * x
""")
make_file("another_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="another",
packages=["nspkg.sixth"],
)
""")
# Bug888 code.
make_file("bug888/app/setup.py", """\
from setuptools import setup
setup(
name='testcov',
packages=['testcov'],
namespace_packages=['testcov'],
)
""")
make_file("bug888/app/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/app/testcov/main.py", """\
try: # pragma: no cover
entry_points = __import__("pkg_resources").iter_entry_points('plugins')
except ImportError: # pragma: no cover
import importlib.metadata
entry_points = importlib.metadata.entry_points(group="plugins")
for entry_point in entry_points:
entry_point.load()()
""")
make_file("bug888/plugin/setup.py", """\
from setuptools import setup
setup(
name='testcov-plugin',
packages=['testcov'],
namespace_packages=['testcov'],
entry_points={'plugins': ['testp = testcov.plugin:testp']},
)
""")
make_file("bug888/plugin/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/plugin/testcov/plugin.py", """\
def testp():
print("Plugin here")
""")
# Install everything.
> run_in_venv(
"python -m pip install " +
"./third_pkg " +
"-e ./another_pkg " +
"-e ./bug888/app -e ./bug888/plugin " +
COVERAGE_INSTALL_ARGS
)
tests/test_venv.py:149:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5'
def run_in_venv(cmd: str) -> str:
r"""Run `cmd` in the virtualenv at `venv`.
The first word of the command will be adjusted to run it from the
venv/bin or venv\Scripts directory.
Returns the text output of the command.
"""
words = cmd.split()
if env.WINDOWS:
words[0] = fr"venv\Scripts\{words[0]}.exe"
else:
words[0] = fr"venv/bin/{words[0]}"
status, output = run_command(" ".join(words))
# Print the output so if it fails, we can tell what happened.
print(output)
> assert status == 0
E assert 127 == 0
tests/test_venv.py:40: AssertionError
=================================== FAILURES ===================================
________________________ CmdLineStdoutTest.test_version ________________________
[gw38] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_cmdline.CmdLineStdoutTest object at 0x7fda7db4d160>
def test_version(self) -> None:
self.command_line("--version")
out = self.stdout()
assert "ersion " in out
if env.C_TRACER:
> assert "with C extension" in out
E AssertionError: assert 'with C extension' in 'Coverage.py, version 7.2.5 without C extension\nFull documentation is at https://coverage.readthedocs.io/en/7.2.5\n'
tests/test_cmdline.py:1002: AssertionError
____________________ DebugTraceTest.test_debug_sys_ctracer _____________________
[gw22] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_debug.DebugTraceTest object at 0x7f456da61850>
def test_debug_sys_ctracer(self) -> None:
out_text = self.f1_debug_output(["sys"])
tracer_line = re_line(r"CTracer:", out_text).strip()
if env.C_TRACER:
expected = "CTracer: available"
else:
expected = "CTracer: unavailable"
> assert expected == tracer_line
E AssertionError: assert 'CTracer: available' == 'CTracer: unavailable'
E - CTracer: unavailable
E ? --
E + CTracer: available
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/test_debug.py:200: AssertionError
________________________ FileReporterTest.test_zipfile _________________________
[gw5] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_filereporter.FileReporterTest object at 0x7ff75948cd00>
def test_zipfile(self) -> None:
sys.path.append("tests/zip1.zip")
# Test that we can get files out of zipfiles, and read their source files.
# The zip1 module is installed by an action in igor.py.
> import zip1
E ModuleNotFoundError: No module named 'zip1'
tests/test_filereporter.py:93: ModuleNotFoundError
________________ SigtermTest.test_sigterm_threading_saves_data _________________
[gw3] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_concurrency.SigtermTest object at 0x7fce3e82d0a0>
def test_sigterm_threading_saves_data(self) -> None:
# A terminated process should save its coverage data.
self.make_file("handler.py", """\
import os, signal
print("START", flush=True)
print("SIGTERM", flush=True)
os.kill(os.getpid(), signal.SIGTERM)
print("NOT HERE", flush=True)
""")
self.make_file(".coveragerc", """\
[run]
# The default concurrency option.
concurrency = thread
sigterm = true
""")
out = self.run_command("coverage run handler.py")
if env.LINUX:
> assert out == "START\nSIGTERM\nTerminated\n"
E AssertionError: assert 'START\nSIGTERM\n' == 'START\nSIGTERM\nTerminated\n'
E START
E SIGTERM
E - Terminated
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/test_concurrency.py:772: AssertionError
----------------------------- Captured stdout call -----------------------------
START
SIGTERM
----------------------------- Captured stdout call -----------------------------
START
SIGTERM
----------------------------- Captured stdout call -----------------------------
START
SIGTERM
_______________________ PluginTest.test_plugin_sys_info ________________________
[gw4] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_plugins.PluginTest object at 0x7ff2a7de16d0>
def test_plugin_sys_info(self) -> None:
self.make_file("plugin_sys_info.py", """\
import coverage
class Plugin(coverage.CoveragePlugin):
def sys_info(self):
return [("hello", "world")]
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
debug_out = io.StringIO()
cov = coverage.Coverage(debug=["sys"])
cov._debug_file = debug_out
cov.set_option("run:plugins", ["plugin_sys_info"])
with swallow_warnings(
r"Plugin file tracers \(plugin_sys_info.Plugin\) aren't supported with PyTracer"
):
cov.start()
cov.stop() # pragma: nested
out_lines = [line.strip() for line in debug_out.getvalue().splitlines()]
if env.C_TRACER:
> assert 'plugins.file_tracers: plugin_sys_info.Plugin' in out_lines
E AssertionError: assert 'plugins.file_tracers: plugin_sys_info.Plugin' in ['-- sys -------------------------------------------------------', 'coverage_version: 7.2.5', 'coverage_module: /home/...init__.py', 'tracer: PyTracer', 'CTracer: unavailable', 'plugins.file_tracers: plugin_sys_info.Plugin (disabled)', ...]
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/test_plugins.py:216: AssertionError
___________________ GoodFileTracerTest.test_defer_to_python ____________________
[gw31] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_plugins.GoodFileTracerTest object at 0x7fbd06945520>
def test_defer_to_python(self) -> None:
# A plugin that measures, but then wants built-in python reporting.
self.make_file("fairly_odd_plugin.py", """\
# A plugin that claims all the odd lines are executed, and none of
# the even lines, and then punts reporting off to the built-in
# Python reporting.
import coverage.plugin
class Plugin(coverage.CoveragePlugin):
def file_tracer(self, filename):
return OddTracer(filename)
def file_reporter(self, filename):
return "python"
class OddTracer(coverage.plugin.FileTracer):
def __init__(self, filename):
self.filename = filename
def source_filename(self):
return self.filename
def line_number_range(self, frame):
lineno = frame.f_lineno
if lineno % 2:
return (lineno, lineno)
else:
return (-1, -1)
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
self.make_file("unsuspecting.py", """\
a = 1
b = 2
c = 3
d = 4
e = 5
f = 6
""")
cov = coverage.Coverage(include=["unsuspecting.py"])
cov.set_option("run:plugins", ["fairly_odd_plugin"])
self.start_import_stop(cov, "unsuspecting")
repout = io.StringIO()
total = cov.report(file=repout, show_missing=True)
report = repout.getvalue().splitlines()
expected = [
'Name Stmts Miss Cover Missing',
'-----------------------------------------------',
'unsuspecting.py 6 3 50% 2, 4, 6',
'-----------------------------------------------',
'TOTAL 6 3 50%',
]
> assert expected == report
E AssertionError: assert ['Name ... 3 50%'] == ['Name ... 0 100%']
E At index 2 diff: 'unsuspecting.py 6 3 50% 2, 4, 6' != 'unsuspecting.py 6 0 100%'
E Use -v to get more diff
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/test_plugins.py:532: AssertionError
_________ BadFileTracerTest.test_file_tracer_has_no_file_tracer_method _________
[gw27] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_plugins.BadFileTracerTest object at 0x7f2d358bef40>
def test_file_tracer_has_no_file_tracer_method(self) -> None:
self.make_file("bad_plugin.py", """\
class Plugin(object):
pass
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
> self.run_bad_plugin("bad_plugin", "Plugin", our_error=False)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/test_plugins.py:682:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_plugins.BadFileTracerTest object at 0x7f2d358bef40>
module_name = 'bad_plugin', plugin_name = 'Plugin', our_error = False
excmsg = None, excmsgs = None
def run_bad_plugin(
self,
module_name: str,
plugin_name: str,
our_error: bool = True,
excmsg: Optional[str] = None,
excmsgs: Optional[List[str]] = None,
) -> None:
"""Run a file, and see that the plugin failed.
`module_name` and `plugin_name` is the module and name of the plugin to
use.
`our_error` is True if the error reported to the user will be an
explicit error in our test code, marked with an '# Oh noes!' comment.
`excmsg`, if provided, is text that must appear in the stderr.
`excmsgs`, if provided, is a list of messages, one of which must
appear in the stderr.
The plugin will be disabled, and we check that a warning is output
explaining why.
"""
with pytest.warns(Warning) as warns:
self.run_plugin(module_name)
stderr = self.stderr()
stderr += "".join(str(w.message) for w in warns)
if our_error:
# The exception we're causing should only appear once.
assert stderr.count("# Oh noes!") == 1
# There should be a warning explaining what's happening, but only one.
# The message can be in two forms:
# Disabling plug-in '...' due to previous exception
# or:
# Disabling plug-in '...' due to an exception:
print([str(w) for w in warns.list])
warnings = [w for w in warns.list if issubclass(w.category, CoverageWarning)]
assert len(warnings) == 1
warnmsg = str(warnings[0].message)
> assert f"Disabling plug-in '{module_name}.{plugin_name}' due to " in warnmsg
E assert "Disabling plug-in 'bad_plugin.Plugin' due to " in "Plugin file tracers (bad_plugin.Plugin) aren't supported with PyTracer"
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/test_plugins.py:666: AssertionError
----------------------------- Captured stdout call -----------------------------
['{message : CoverageWarning("Plugin file tracers (bad_plugin.Plugin) aren\'t supported with PyTracer"), category : \'CoverageWarning\', filename : \'/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/coverage/control.py\', lineno : 553, line : None}']
___________ BadFileTracerTest.test_has_dynamic_source_filename_fails ___________
[gw35] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_plugins.BadFileTracerTest object at 0x7f0581a752b0>
def test_has_dynamic_source_filename_fails(self) -> None:
self.make_file("bad_plugin.py", """\
import coverage.plugin
class Plugin(coverage.plugin.CoveragePlugin):
def file_tracer(self, filename):
return BadFileTracer()
class BadFileTracer(coverage.plugin.FileTracer):
def has_dynamic_source_filename(self):
23/0 # Oh noes!
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
> self.run_bad_plugin("bad_plugin", "Plugin")
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/test_plugins.py:794:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_plugins.BadFileTracerTest object at 0x7f0581a752b0>
module_name = 'bad_plugin', plugin_name = 'Plugin', our_error = True
excmsg = None, excmsgs = None
def run_bad_plugin(
self,
module_name: str,
plugin_name: str,
our_error: bool = True,
excmsg: Optional[str] = None,
excmsgs: Optional[List[str]] = None,
) -> None:
"""Run a file, and see that the plugin failed.
`module_name` and `plugin_name` is the module and name of the plugin to
use.
`our_error` is True if the error reported to the user will be an
explicit error in our test code, marked with an '# Oh noes!' comment.
`excmsg`, if provided, is text that must appear in the stderr.
`excmsgs`, if provided, is a list of messages, one of which must
appear in the stderr.
The plugin will be disabled, and we check that a warning is output
explaining why.
"""
with pytest.warns(Warning) as warns:
self.run_plugin(module_name)
stderr = self.stderr()
stderr += "".join(str(w.message) for w in warns)
if our_error:
# The exception we're causing should only appear once.
> assert stderr.count("# Oh noes!") == 1
E assert 0 == 1
E + where 0 = <built-in method count of str object at 0x7f05817b94b0>('# Oh noes!')
E + where <built-in method count of str object at 0x7f05817b94b0> = "Plugin file tracers (bad_plugin.Plugin) aren't supported with PyTracer".count
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/test_plugins.py:655: AssertionError
___________________ GoodFileTracerTest.test_find_unexecuted ____________________
[gw44] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_plugins.GoodFileTracerTest object at 0x7fdc51406700>
def test_find_unexecuted(self) -> None:
self.make_file("unexecuted_plugin.py", """\
import os
import coverage.plugin
class Plugin(coverage.CoveragePlugin):
def file_tracer(self, filename):
if filename.endswith("foo.py"):
return MyTracer(filename)
def file_reporter(self, filename):
return MyReporter(filename)
def find_executable_files(self, src_dir):
# Check that src_dir is the right value
files = os.listdir(src_dir)
assert "foo.py" in files
assert "unexecuted_plugin.py" in files
return ["chimera.py"]
class MyTracer(coverage.plugin.FileTracer):
def __init__(self, filename):
self.filename = filename
def source_filename(self):
return self.filename
def line_number_range(self, frame):
return (999, 999)
class MyReporter(coverage.FileReporter):
def lines(self):
return {99, 999, 9999}
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
self.make_file("foo.py", "a = 1")
cov = coverage.Coverage(source=['.'])
cov.set_option("run:plugins", ["unexecuted_plugin"])
self.start_import_stop(cov, "foo")
# The file we executed claims to have run line 999.
_, statements, missing, _ = cov.analysis("foo.py")
> assert statements == [99, 999, 9999]
E assert [1] == [99, 999, 9999]
E At index 0 diff: 1 != 99
E Right contains 2 more items, first extra item: 999
E Use -v to get more diff
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/test_plugins.py:574: AssertionError
____________ BadFileTracerTest.test_line_number_range_raises_error _____________
[gw34] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_plugins.BadFileTracerTest object at 0x7ff851cd99a0>
def test_line_number_range_raises_error(self) -> None:
self.make_file("bad_plugin.py", """\
import coverage.plugin
class Plugin(coverage.plugin.CoveragePlugin):
def file_tracer(self, filename):
if filename.endswith("other.py"):
return BadFileTracer()
class BadFileTracer(coverage.plugin.FileTracer):
def source_filename(self):
return "something.foo"
def line_number_range(self, frame):
raise Exception("borked!")
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
> self.run_bad_plugin(
"bad_plugin", "Plugin", our_error=False, excmsg="borked!",
)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/test_plugins.py:873:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_plugins.BadFileTracerTest object at 0x7ff851cd99a0>
module_name = 'bad_plugin', plugin_name = 'Plugin', our_error = False
excmsg = 'borked!', excmsgs = None
def run_bad_plugin(
self,
module_name: str,
plugin_name: str,
our_error: bool = True,
excmsg: Optional[str] = None,
excmsgs: Optional[List[str]] = None,
) -> None:
"""Run a file, and see that the plugin failed.
`module_name` and `plugin_name` is the module and name of the plugin to
use.
`our_error` is True if the error reported to the user will be an
explicit error in our test code, marked with an '# Oh noes!' comment.
`excmsg`, if provided, is text that must appear in the stderr.
`excmsgs`, if provided, is a list of messages, one of which must
appear in the stderr.
The plugin will be disabled, and we check that a warning is output
explaining why.
"""
with pytest.warns(Warning) as warns:
self.run_plugin(module_name)
stderr = self.stderr()
stderr += "".join(str(w.message) for w in warns)
if our_error:
# The exception we're causing should only appear once.
assert stderr.count("# Oh noes!") == 1
# There should be a warning explaining what's happening, but only one.
# The message can be in two forms:
# Disabling plug-in '...' due to previous exception
# or:
# Disabling plug-in '...' due to an exception:
print([str(w) for w in warns.list])
warnings = [w for w in warns.list if issubclass(w.category, CoverageWarning)]
assert len(warnings) == 1
warnmsg = str(warnings[0].message)
> assert f"Disabling plug-in '{module_name}.{plugin_name}' due to " in warnmsg
E assert "Disabling plug-in 'bad_plugin.Plugin' due to " in "Plugin file tracers (bad_plugin.Plugin) aren't supported with PyTracer"
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/test_plugins.py:666: AssertionError
----------------------------- Captured stdout call -----------------------------
['{message : CoverageWarning("Plugin file tracers (bad_plugin.Plugin) aren\'t supported with PyTracer"), category : \'CoverageWarning\', filename : \'/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/coverage/control.py\', lineno : 553, line : None}']
_______________ BadFileTracerTest.test_file_tracer_returns_wrong _______________
[gw17] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_plugins.BadFileTracerTest object at 0x7f8d38ba6d60>
def test_file_tracer_returns_wrong(self) -> None:
self.make_file("bad_plugin.py", """\
import coverage.plugin
class Plugin(coverage.plugin.CoveragePlugin):
def file_tracer(self, filename):
return 3.14159
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
> self.run_bad_plugin(
"bad_plugin", "Plugin", our_error=False, excmsg="'float' object has no attribute",
)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/test_plugins.py:776:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_plugins.BadFileTracerTest object at 0x7f8d38ba6d60>
module_name = 'bad_plugin', plugin_name = 'Plugin', our_error = False
excmsg = "'float' object has no attribute", excmsgs = None
def run_bad_plugin(
self,
module_name: str,
plugin_name: str,
our_error: bool = True,
excmsg: Optional[str] = None,
excmsgs: Optional[List[str]] = None,
) -> None:
"""Run a file, and see that the plugin failed.
`module_name` and `plugin_name` is the module and name of the plugin to
use.
`our_error` is True if the error reported to the user will be an
explicit error in our test code, marked with an '# Oh noes!' comment.
`excmsg`, if provided, is text that must appear in the stderr.
`excmsgs`, if provided, is a list of messages, one of which must
appear in the stderr.
The plugin will be disabled, and we check that a warning is output
explaining why.
"""
with pytest.warns(Warning) as warns:
self.run_plugin(module_name)
stderr = self.stderr()
stderr += "".join(str(w.message) for w in warns)
if our_error:
# The exception we're causing should only appear once.
assert stderr.count("# Oh noes!") == 1
# There should be a warning explaining what's happening, but only one.
# The message can be in two forms:
# Disabling plug-in '...' due to previous exception
# or:
# Disabling plug-in '...' due to an exception:
print([str(w) for w in warns.list])
warnings = [w for w in warns.list if issubclass(w.category, CoverageWarning)]
assert len(warnings) == 1
warnmsg = str(warnings[0].message)
> assert f"Disabling plug-in '{module_name}.{plugin_name}' due to " in warnmsg
E assert "Disabling plug-in 'bad_plugin.Plugin' due to " in "Plugin file tracers (bad_plugin.Plugin) aren't supported with PyTracer"
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/test_plugins.py:666: AssertionError
----------------------------- Captured stdout call -----------------------------
['{message : CoverageWarning("Plugin file tracers (bad_plugin.Plugin) aren\'t supported with PyTracer"), category : \'CoverageWarning\', filename : \'/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/coverage/control.py\', lineno : 553, line : None}']
_____________ BadFileTracerTest.test_dynamic_source_filename_fails _____________
[gw42] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_plugins.BadFileTracerTest object at 0x7fd787354460>
def test_dynamic_source_filename_fails(self) -> None:
self.make_file("bad_plugin.py", """\
import coverage.plugin
class Plugin(coverage.plugin.CoveragePlugin):
def file_tracer(self, filename):
if filename.endswith("other.py"):
return BadFileTracer()
class BadFileTracer(coverage.plugin.FileTracer):
def has_dynamic_source_filename(self):
return True
def dynamic_source_filename(self, filename, frame):
101/0 # Oh noes!
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
> self.run_bad_plugin("bad_plugin", "Plugin")
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/test_plugins.py:853:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_plugins.BadFileTracerTest object at 0x7fd787354460>
module_name = 'bad_plugin', plugin_name = 'Plugin', our_error = True
excmsg = None, excmsgs = None
def run_bad_plugin(
self,
module_name: str,
plugin_name: str,
our_error: bool = True,
excmsg: Optional[str] = None,
excmsgs: Optional[List[str]] = None,
) -> None:
"""Run a file, and see that the plugin failed.
`module_name` and `plugin_name` is the module and name of the plugin to
use.
`our_error` is True if the error reported to the user will be an
explicit error in our test code, marked with an '# Oh noes!' comment.
`excmsg`, if provided, is text that must appear in the stderr.
`excmsgs`, if provided, is a list of messages, one of which must
appear in the stderr.
The plugin will be disabled, and we check that a warning is output
explaining why.
"""
with pytest.warns(Warning) as warns:
self.run_plugin(module_name)
stderr = self.stderr()
stderr += "".join(str(w.message) for w in warns)
if our_error:
# The exception we're causing should only appear once.
> assert stderr.count("# Oh noes!") == 1
E assert 0 == 1
E + where 0 = <built-in method count of str object at 0x7fd78739b7b0>('# Oh noes!')
E + where <built-in method count of str object at 0x7fd78739b7b0> = "Plugin file tracers (bad_plugin.Plugin) aren't supported with PyTracer".count
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/test_plugins.py:655: AssertionError
___________ BadFileTracerTest.test_line_number_range_returns_triple ____________
[gw38] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_plugins.BadFileTracerTest object at 0x7fda7d4e3040>
def test_line_number_range_returns_triple(self) -> None:
self.make_file("bad_plugin.py", """\
import coverage.plugin
class Plugin(coverage.plugin.CoveragePlugin):
def file_tracer(self, filename):
if filename.endswith("other.py"):
return BadFileTracer()
class BadFileTracer(coverage.plugin.FileTracer):
def source_filename(self):
return "something.foo"
def line_number_range(self, frame):
return (1, 2, 3)
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
> self.run_bad_plugin(
"bad_plugin", "Plugin", our_error=False, excmsg="line_number_range must return 2-tuple",
)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/test_plugins.py:917:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_plugins.BadFileTracerTest object at 0x7fda7d4e3040>
module_name = 'bad_plugin', plugin_name = 'Plugin', our_error = False
excmsg = 'line_number_range must return 2-tuple', excmsgs = None
def run_bad_plugin(
self,
module_name: str,
plugin_name: str,
our_error: bool = True,
excmsg: Optional[str] = None,
excmsgs: Optional[List[str]] = None,
) -> None:
"""Run a file, and see that the plugin failed.
`module_name` and `plugin_name` is the module and name of the plugin to
use.
`our_error` is True if the error reported to the user will be an
explicit error in our test code, marked with an '# Oh noes!' comment.
`excmsg`, if provided, is text that must appear in the stderr.
`excmsgs`, if provided, is a list of messages, one of which must
appear in the stderr.
The plugin will be disabled, and we check that a warning is output
explaining why.
"""
with pytest.warns(Warning) as warns:
self.run_plugin(module_name)
stderr = self.stderr()
stderr += "".join(str(w.message) for w in warns)
if our_error:
# The exception we're causing should only appear once.
assert stderr.count("# Oh noes!") == 1
# There should be a warning explaining what's happening, but only one.
# The message can be in two forms:
# Disabling plug-in '...' due to previous exception
# or:
# Disabling plug-in '...' due to an exception:
print([str(w) for w in warns.list])
warnings = [w for w in warns.list if issubclass(w.category, CoverageWarning)]
assert len(warnings) == 1
warnmsg = str(warnings[0].message)
> assert f"Disabling plug-in '{module_name}.{plugin_name}' due to " in warnmsg
E assert "Disabling plug-in 'bad_plugin.Plugin' due to " in "Plugin file tracers (bad_plugin.Plugin) aren't supported with PyTracer"
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/test_plugins.py:666: AssertionError
----------------------------- Captured stdout call -----------------------------
['{message : CoverageWarning("Plugin file tracers (bad_plugin.Plugin) aren\'t supported with PyTracer"), category : \'CoverageWarning\', filename : \'/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/coverage/control.py\', lineno : 553, line : None}']
____ BadFileTracerTest.test_file_tracer_has_inherited_sourcefilename_method ____
[gw47] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_plugins.BadFileTracerTest object at 0x7f062ed6f040>
def test_file_tracer_has_inherited_sourcefilename_method(self) -> None:
self.make_file("bad_plugin.py", """\
import coverage
class Plugin(coverage.CoveragePlugin):
def file_tracer(self, filename):
# Just grab everything.
return FileTracer()
class FileTracer(coverage.FileTracer):
pass
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
> self.run_bad_plugin(
"bad_plugin", "Plugin", our_error=False,
excmsg="Class 'bad_plugin.FileTracer' needs to implement source_filename()",
)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/test_plugins.py:698:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_plugins.BadFileTracerTest object at 0x7f062ed6f040>
module_name = 'bad_plugin', plugin_name = 'Plugin', our_error = False
excmsg = "Class 'bad_plugin.FileTracer' needs to implement source_filename()"
excmsgs = None
def run_bad_plugin(
self,
module_name: str,
plugin_name: str,
our_error: bool = True,
excmsg: Optional[str] = None,
excmsgs: Optional[List[str]] = None,
) -> None:
"""Run a file, and see that the plugin failed.
`module_name` and `plugin_name` is the module and name of the plugin to
use.
`our_error` is True if the error reported to the user will be an
explicit error in our test code, marked with an '# Oh noes!' comment.
`excmsg`, if provided, is text that must appear in the stderr.
`excmsgs`, if provided, is a list of messages, one of which must
appear in the stderr.
The plugin will be disabled, and we check that a warning is output
explaining why.
"""
with pytest.warns(Warning) as warns:
self.run_plugin(module_name)
stderr = self.stderr()
stderr += "".join(str(w.message) for w in warns)
if our_error:
# The exception we're causing should only appear once.
assert stderr.count("# Oh noes!") == 1
# There should be a warning explaining what's happening, but only one.
# The message can be in two forms:
# Disabling plug-in '...' due to previous exception
# or:
# Disabling plug-in '...' due to an exception:
print([str(w) for w in warns.list])
warnings = [w for w in warns.list if issubclass(w.category, CoverageWarning)]
assert len(warnings) == 1
warnmsg = str(warnings[0].message)
> assert f"Disabling plug-in '{module_name}.{plugin_name}' due to " in warnmsg
E assert "Disabling plug-in 'bad_plugin.Plugin' due to " in "Plugin file tracers (bad_plugin.Plugin) aren't supported with PyTracer"
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/test_plugins.py:666: AssertionError
----------------------------- Captured stdout call -----------------------------
['{message : CoverageWarning("Plugin file tracers (bad_plugin.Plugin) aren\'t supported with PyTracer"), category : \'CoverageWarning\', filename : \'/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/coverage/control.py\', lineno : 553, line : None}']
_____________ BadFileTracerTest.test_source_filename_returns_wrong _____________
[gw7] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_plugins.BadFileTracerTest object at 0x7fbb3f4fdac0>
def test_source_filename_returns_wrong(self) -> None:
self.make_file("bad_plugin.py", """\
import coverage.plugin
class Plugin(coverage.plugin.CoveragePlugin):
def file_tracer(self, filename):
return BadFileTracer()
class BadFileTracer(coverage.plugin.FileTracer):
def source_filename(self):
return 17.3
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
> self.run_bad_plugin(
"bad_plugin", "Plugin", our_error=False,
excmsgs=[
"expected str, bytes or os.PathLike object, not float",
"'float' object has no attribute",
"object of type 'float' has no len()",
"'float' object is unsubscriptable",
],
)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/test_plugins.py:826:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_plugins.BadFileTracerTest object at 0x7fbb3f4fdac0>
module_name = 'bad_plugin', plugin_name = 'Plugin', our_error = False
excmsg = None
excmsgs = ['expected str, bytes or os.PathLike object, not float', "'float' object has no attribute", "object of type 'float' has no len()", "'float' object is unsubscriptable"]
def run_bad_plugin(
self,
module_name: str,
plugin_name: str,
our_error: bool = True,
excmsg: Optional[str] = None,
excmsgs: Optional[List[str]] = None,
) -> None:
"""Run a file, and see that the plugin failed.
`module_name` and `plugin_name` is the module and name of the plugin to
use.
`our_error` is True if the error reported to the user will be an
explicit error in our test code, marked with an '# Oh noes!' comment.
`excmsg`, if provided, is text that must appear in the stderr.
`excmsgs`, if provided, is a list of messages, one of which must
appear in the stderr.
The plugin will be disabled, and we check that a warning is output
explaining why.
"""
with pytest.warns(Warning) as warns:
self.run_plugin(module_name)
stderr = self.stderr()
stderr += "".join(str(w.message) for w in warns)
if our_error:
# The exception we're causing should only appear once.
assert stderr.count("# Oh noes!") == 1
# There should be a warning explaining what's happening, but only one.
# The message can be in two forms:
# Disabling plug-in '...' due to previous exception
# or:
# Disabling plug-in '...' due to an exception:
print([str(w) for w in warns.list])
warnings = [w for w in warns.list if issubclass(w.category, CoverageWarning)]
assert len(warnings) == 1
warnmsg = str(warnings[0].message)
> assert f"Disabling plug-in '{module_name}.{plugin_name}' due to " in warnmsg
E assert "Disabling plug-in 'bad_plugin.Plugin' due to " in "Plugin file tracers (bad_plugin.Plugin) aren't supported with PyTracer"
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/test_plugins.py:666: AssertionError
----------------------------- Captured stdout call -----------------------------
['{message : CoverageWarning("Plugin file tracers (bad_plugin.Plugin) aren\'t supported with PyTracer"), category : \'CoverageWarning\', filename : \'/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/coverage/control.py\', lineno : 553, line : None}']
_____________ BadFileTracerTest.test_file_tracer_fails_eventually ______________
[gw36] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_plugins.BadFileTracerTest object at 0x7ff2e3d820d0>
def test_file_tracer_fails_eventually(self) -> None:
# Django coverage plugin can report on a few files and then fail.
# https://github.com/nedbat/coveragepy/issues/1011
self.make_file("bad_plugin.py", """\
import os.path
import coverage.plugin
class Plugin(coverage.plugin.CoveragePlugin):
def __init__(self):
self.calls = 0
def file_tracer(self, filename):
print(filename)
self.calls += 1
if self.calls <= 2:
return FileTracer(filename)
else:
17/0 # Oh noes!
class FileTracer(coverage.FileTracer):
def __init__(self, filename):
self.filename = filename
def source_filename(self):
return os.path.basename(self.filename).replace(".py", ".foo")
def line_number_range(self, frame):
return -1, -1
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
> self.run_bad_plugin("bad_plugin", "Plugin")
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/test_plugins.py:764:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_plugins.BadFileTracerTest object at 0x7ff2e3d820d0>
module_name = 'bad_plugin', plugin_name = 'Plugin', our_error = True
excmsg = None, excmsgs = None
def run_bad_plugin(
self,
module_name: str,
plugin_name: str,
our_error: bool = True,
excmsg: Optional[str] = None,
excmsgs: Optional[List[str]] = None,
) -> None:
"""Run a file, and see that the plugin failed.
`module_name` and `plugin_name` is the module and name of the plugin to
use.
`our_error` is True if the error reported to the user will be an
explicit error in our test code, marked with an '# Oh noes!' comment.
`excmsg`, if provided, is text that must appear in the stderr.
`excmsgs`, if provided, is a list of messages, one of which must
appear in the stderr.
The plugin will be disabled, and we check that a warning is output
explaining why.
"""
with pytest.warns(Warning) as warns:
self.run_plugin(module_name)
stderr = self.stderr()
stderr += "".join(str(w.message) for w in warns)
if our_error:
# The exception we're causing should only appear once.
> assert stderr.count("# Oh noes!") == 1
E assert 0 == 1
E + where 0 = <built-in method count of str object at 0x7ff2e3cac330>('# Oh noes!')
E + where <built-in method count of str object at 0x7ff2e3cac330> = "Plugin file tracers (bad_plugin.Plugin) aren't supported with PyTracer".count
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/test_plugins.py:655: AssertionError
___________________ BadFileTracerTest.test_file_tracer_fails ___________________
[gw2] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_plugins.BadFileTracerTest object at 0x7f338227edc0>
def test_file_tracer_fails(self) -> None:
self.make_file("bad_plugin.py", """\
import coverage.plugin
class Plugin(coverage.plugin.CoveragePlugin):
def file_tracer(self, filename):
17/0 # Oh noes!
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
> self.run_bad_plugin("bad_plugin", "Plugin")
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/test_plugins.py:733:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_plugins.BadFileTracerTest object at 0x7f338227edc0>
module_name = 'bad_plugin', plugin_name = 'Plugin', our_error = True
excmsg = None, excmsgs = None
def run_bad_plugin(
self,
module_name: str,
plugin_name: str,
our_error: bool = True,
excmsg: Optional[str] = None,
excmsgs: Optional[List[str]] = None,
) -> None:
"""Run a file, and see that the plugin failed.
`module_name` and `plugin_name` is the module and name of the plugin to
use.
`our_error` is True if the error reported to the user will be an
explicit error in our test code, marked with an '# Oh noes!' comment.
`excmsg`, if provided, is text that must appear in the stderr.
`excmsgs`, if provided, is a list of messages, one of which must
appear in the stderr.
The plugin will be disabled, and we check that a warning is output
explaining why.
"""
with pytest.warns(Warning) as warns:
self.run_plugin(module_name)
stderr = self.stderr()
stderr += "".join(str(w.message) for w in warns)
if our_error:
# The exception we're causing should only appear once.
> assert stderr.count("# Oh noes!") == 1
E assert 0 == 1
E + where 0 = <built-in method count of str object at 0x7f3381fd5930>('# Oh noes!')
E + where <built-in method count of str object at 0x7f3381fd5930> = "Plugin file tracers (bad_plugin.Plugin) aren't supported with PyTracer".count
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/test_plugins.py:655: AssertionError
_______ BadFileTracerTest.test_line_number_range_returns_pair_of_strings _______
[gw18] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_plugins.BadFileTracerTest object at 0x7f14902a3730>
def test_line_number_range_returns_pair_of_strings(self) -> None:
self.make_file("bad_plugin.py", """\
import coverage.plugin
class Plugin(coverage.plugin.CoveragePlugin):
def file_tracer(self, filename):
if filename.endswith("other.py"):
return BadFileTracer()
class BadFileTracer(coverage.plugin.FileTracer):
def source_filename(self):
return "something.foo"
def line_number_range(self, frame):
return ("5", "7")
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
> self.run_bad_plugin(
"bad_plugin", "Plugin", our_error=False,
excmsgs=[
"an integer is required",
"cannot be interpreted as an integer",
],
)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/test_plugins.py:939:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_plugins.BadFileTracerTest object at 0x7f14902a3730>
module_name = 'bad_plugin', plugin_name = 'Plugin', our_error = False
excmsg = None
excmsgs = ['an integer is required', 'cannot be interpreted as an integer']
def run_bad_plugin(
self,
module_name: str,
plugin_name: str,
our_error: bool = True,
excmsg: Optional[str] = None,
excmsgs: Optional[List[str]] = None,
) -> None:
"""Run a file, and see that the plugin failed.
`module_name` and `plugin_name` is the module and name of the plugin to
use.
`our_error` is True if the error reported to the user will be an
explicit error in our test code, marked with an '# Oh noes!' comment.
`excmsg`, if provided, is text that must appear in the stderr.
`excmsgs`, if provided, is a list of messages, one of which must
appear in the stderr.
The plugin will be disabled, and we check that a warning is output
explaining why.
"""
with pytest.warns(Warning) as warns:
self.run_plugin(module_name)
stderr = self.stderr()
stderr += "".join(str(w.message) for w in warns)
if our_error:
# The exception we're causing should only appear once.
assert stderr.count("# Oh noes!") == 1
# There should be a warning explaining what's happening, but only one.
# The message can be in two forms:
# Disabling plug-in '...' due to previous exception
# or:
# Disabling plug-in '...' due to an exception:
print([str(w) for w in warns.list])
warnings = [w for w in warns.list if issubclass(w.category, CoverageWarning)]
assert len(warnings) == 1
warnmsg = str(warnings[0].message)
> assert f"Disabling plug-in '{module_name}.{plugin_name}' due to " in warnmsg
E assert "Disabling plug-in 'bad_plugin.Plugin' due to " in "Plugin file tracers (bad_plugin.Plugin) aren't supported with PyTracer"
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/test_plugins.py:666: AssertionError
----------------------------- Captured stdout call -----------------------------
['{message : CoverageWarning("Plugin file tracers (bad_plugin.Plugin) aren\'t supported with PyTracer"), category : \'CoverageWarning\', filename : \'/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/coverage/control.py\', lineno : 553, line : None}']
_______________ GoodFileTracerTest.test_plugin2_with_xml_report ________________
[gw24] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_plugins.GoodFileTracerTest object at 0x7f5ff2cc0070>
def test_plugin2_with_xml_report(self) -> None:
self.make_render_and_caller()
cov = coverage.Coverage(branch=True, omit=["*quux*"])
cov.set_option("run:plugins", ["tests.plugin2"])
self.start_import_stop(cov, "caller")
> total = cov.xml_report(include=["*.html"], omit=["uni*.html"])
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/test_plugins.py:459:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/coverage/control.py:1190: in xml_report
return render_report(self.config.xml_output, XmlReporter(self), morfs, self._message)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/coverage/report.py:59: in render_report
ret = reporter.report(morfs, outfile=outfile)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/coverage/xmlreport.py:105: in report
for fr, analysis in get_analysis_to_report(self.coverage, morfs):
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
coverage = <coverage.control.Coverage object at 0x7f5ff2bf3310>, morfs = None
def get_analysis_to_report(
coverage: Coverage,
morfs: Optional[Iterable[TMorf]],
) -> Iterator[Tuple[FileReporter, Analysis]]:
"""Get the files to report on.
For each morf in `morfs`, if it should be reported on (based on the omit
and include configuration options), yield a pair, the `FileReporter` and
`Analysis` for the morf.
"""
file_reporters = coverage._get_file_reporters(morfs)
config = coverage.config
if config.report_include:
matcher = GlobMatcher(prep_patterns(config.report_include), "report_include")
file_reporters = [fr for fr in file_reporters if matcher.match(fr.filename)]
if config.report_omit:
matcher = GlobMatcher(prep_patterns(config.report_omit), "report_omit")
file_reporters = [fr for fr in file_reporters if not matcher.match(fr.filename)]
if not file_reporters:
> raise NoDataError("No data to report.")
E coverage.exceptions.NoDataError: No data to report.
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/coverage/report.py:94: NoDataError
_________________ BadFileTracerTest.test_source_filename_fails _________________
[gw8] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_plugins.BadFileTracerTest object at 0x7f5abd873730>
def test_source_filename_fails(self) -> None:
self.make_file("bad_plugin.py", """\
import coverage.plugin
class Plugin(coverage.plugin.CoveragePlugin):
def file_tracer(self, filename):
return BadFileTracer()
class BadFileTracer(coverage.plugin.FileTracer):
def source_filename(self):
42/0 # Oh noes!
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
> self.run_bad_plugin("bad_plugin", "Plugin")
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/test_plugins.py:810:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_plugins.BadFileTracerTest object at 0x7f5abd873730>
module_name = 'bad_plugin', plugin_name = 'Plugin', our_error = True
excmsg = None, excmsgs = None
def run_bad_plugin(
self,
module_name: str,
plugin_name: str,
our_error: bool = True,
excmsg: Optional[str] = None,
excmsgs: Optional[List[str]] = None,
) -> None:
"""Run a file, and see that the plugin failed.
`module_name` and `plugin_name` is the module and name of the plugin to
use.
`our_error` is True if the error reported to the user will be an
explicit error in our test code, marked with an '# Oh noes!' comment.
`excmsg`, if provided, is text that must appear in the stderr.
`excmsgs`, if provided, is a list of messages, one of which must
appear in the stderr.
The plugin will be disabled, and we check that a warning is output
explaining why.
"""
with pytest.warns(Warning) as warns:
self.run_plugin(module_name)
stderr = self.stderr()
stderr += "".join(str(w.message) for w in warns)
if our_error:
# The exception we're causing should only appear once.
> assert stderr.count("# Oh noes!") == 1
E assert 0 == 1
E + where 0 = <built-in method count of str object at 0x7f5aac75aeb0>('# Oh noes!')
E + where <built-in method count of str object at 0x7f5aac75aeb0> = "Plugin file tracers (bad_plugin.Plugin) aren't supported with PyTracer".count
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/test_plugins.py:655: AssertionError
__________ BadFileTracerTest.test_line_number_range_returns_non_tuple __________
[gw46] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_plugins.BadFileTracerTest object at 0x7f79756dde50>
def test_line_number_range_returns_non_tuple(self) -> None:
self.make_file("bad_plugin.py", """\
import coverage.plugin
class Plugin(coverage.plugin.CoveragePlugin):
def file_tracer(self, filename):
if filename.endswith("other.py"):
return BadFileTracer()
class BadFileTracer(coverage.plugin.FileTracer):
def source_filename(self):
return "something.foo"
def line_number_range(self, frame):
return 42.23
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
> self.run_bad_plugin(
"bad_plugin", "Plugin", our_error=False, excmsg="line_number_range must return 2-tuple",
)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/test_plugins.py:895:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_plugins.BadFileTracerTest object at 0x7f79756dde50>
module_name = 'bad_plugin', plugin_name = 'Plugin', our_error = False
excmsg = 'line_number_range must return 2-tuple', excmsgs = None
def run_bad_plugin(
self,
module_name: str,
plugin_name: str,
our_error: bool = True,
excmsg: Optional[str] = None,
excmsgs: Optional[List[str]] = None,
) -> None:
"""Run a file, and see that the plugin failed.
`module_name` and `plugin_name` is the module and name of the plugin to
use.
`our_error` is True if the error reported to the user will be an
explicit error in our test code, marked with an '# Oh noes!' comment.
`excmsg`, if provided, is text that must appear in the stderr.
`excmsgs`, if provided, is a list of messages, one of which must
appear in the stderr.
The plugin will be disabled, and we check that a warning is output
explaining why.
"""
with pytest.warns(Warning) as warns:
self.run_plugin(module_name)
stderr = self.stderr()
stderr += "".join(str(w.message) for w in warns)
if our_error:
# The exception we're causing should only appear once.
assert stderr.count("# Oh noes!") == 1
# There should be a warning explaining what's happening, but only one.
# The message can be in two forms:
# Disabling plug-in '...' due to previous exception
# or:
# Disabling plug-in '...' due to an exception:
print([str(w) for w in warns.list])
warnings = [w for w in warns.list if issubclass(w.category, CoverageWarning)]
assert len(warnings) == 1
warnmsg = str(warnings[0].message)
> assert f"Disabling plug-in '{module_name}.{plugin_name}' due to " in warnmsg
E assert "Disabling plug-in 'bad_plugin.Plugin' due to " in "Plugin file tracers (bad_plugin.Plugin) aren't supported with PyTracer"
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/test_plugins.py:666: AssertionError
----------------------------- Captured stdout call -----------------------------
['{message : CoverageWarning("Plugin file tracers (bad_plugin.Plugin) aren\'t supported with PyTracer"), category : \'CoverageWarning\', filename : \'/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/coverage/control.py\', lineno : 553, line : None}']
_______________ GoodFileTracerTest.test_plugin2_with_html_report _______________
[gw26] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_plugins.GoodFileTracerTest object at 0x7f8f39b79c40>
def test_plugin2_with_html_report(self) -> None:
self.make_render_and_caller()
cov = coverage.Coverage(branch=True, omit=["*quux*"])
cov.set_option("run:plugins", ["tests.plugin2"])
self.start_import_stop(cov, "caller")
> total = cov.html_report(include=["*.html"], omit=["uni*.html"])
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/test_plugins.py:444:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/coverage/control.py:1155: in html_report
ret = reporter.report(morfs)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/coverage/html.py:296: in report
for fr, analysis in get_analysis_to_report(self.coverage, morfs):
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
coverage = <coverage.control.Coverage object at 0x7f8f3959a6d0>, morfs = None
def get_analysis_to_report(
coverage: Coverage,
morfs: Optional[Iterable[TMorf]],
) -> Iterator[Tuple[FileReporter, Analysis]]:
"""Get the files to report on.
For each morf in `morfs`, if it should be reported on (based on the omit
and include configuration options), yield a pair, the `FileReporter` and
`Analysis` for the morf.
"""
file_reporters = coverage._get_file_reporters(morfs)
config = coverage.config
if config.report_include:
matcher = GlobMatcher(prep_patterns(config.report_include), "report_include")
file_reporters = [fr for fr in file_reporters if matcher.match(fr.filename)]
if config.report_omit:
matcher = GlobMatcher(prep_patterns(config.report_omit), "report_omit")
file_reporters = [fr for fr in file_reporters if not matcher.match(fr.filename)]
if not file_reporters:
> raise NoDataError("No data to report.")
E coverage.exceptions.NoDataError: No data to report.
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/coverage/report.py:94: NoDataError
_______________ GoodFileTracerTest.test_plugin2_with_text_report _______________
[gw12] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_plugins.GoodFileTracerTest object at 0x7fe685490a60>
def test_plugin2_with_text_report(self) -> None:
self.make_render_and_caller()
cov = coverage.Coverage(branch=True, omit=["*quux*"])
cov.set_option("run:plugins", ["tests.plugin2"])
self.start_import_stop(cov, "caller")
repout = io.StringIO()
> total = cov.report(file=repout, include=["*.html"], omit=["uni*.html"], show_missing=True)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/test_plugins.py:423:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/coverage/control.py:1059: in report
return reporter.report(morfs, outfile=file)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/coverage/summary.py:181: in report
for fr, analysis in get_analysis_to_report(self.coverage, morfs):
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
coverage = <coverage.control.Coverage object at 0x7fe684e93f40>, morfs = None
def get_analysis_to_report(
coverage: Coverage,
morfs: Optional[Iterable[TMorf]],
) -> Iterator[Tuple[FileReporter, Analysis]]:
"""Get the files to report on.
For each morf in `morfs`, if it should be reported on (based on the omit
and include configuration options), yield a pair, the `FileReporter` and
`Analysis` for the morf.
"""
file_reporters = coverage._get_file_reporters(morfs)
config = coverage.config
if config.report_include:
matcher = GlobMatcher(prep_patterns(config.report_include), "report_include")
file_reporters = [fr for fr in file_reporters if matcher.match(fr.filename)]
if config.report_omit:
matcher = GlobMatcher(prep_patterns(config.report_omit), "report_omit")
file_reporters = [fr for fr in file_reporters if not matcher.match(fr.filename)]
if not file_reporters:
> raise NoDataError("No data to report.")
E coverage.exceptions.NoDataError: No data to report.
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/coverage/report.py:94: NoDataError
_______ BadFileTracerTest.test_plugin_has_inherited_filereporter_method ________
[gw39] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_plugins.BadFileTracerTest object at 0x7f620df81fd0>
def test_plugin_has_inherited_filereporter_method(self) -> None:
self.make_file("bad_plugin.py", """\
import coverage
class Plugin(coverage.CoveragePlugin):
def file_tracer(self, filename):
# Just grab everything.
return FileTracer()
class FileTracer(coverage.FileTracer):
def source_filename(self):
return "foo.xxx"
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
cov = self.run_plugin("bad_plugin")
expected_msg = "Plugin 'bad_plugin.Plugin' needs to implement file_reporter()"
with pytest.raises(NotImplementedError, match=expected_msg):
> cov.report()
E Failed: DID NOT RAISE <class 'NotImplementedError'>
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/test_plugins.py:721: Failed
----------------------------- Captured stdout call -----------------------------
Name Stmts Miss Cover
--------------------------------
another.py 2 0 100%
other.py 2 0 100%
simple.py 5 0 100%
--------------------------------
TOTAL 9 0 100%
_______________ EnvironmentTest.test_coverage_zip_is_like_python _______________
[gw4] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_process.EnvironmentTest object at 0x7ff2a7ed74c0>
def test_coverage_zip_is_like_python(self) -> None:
# Test running coverage from a zip file itself. Some environments
# (windows?) zip up the coverage main to be used as the coverage
# command.
with open(TRY_EXECFILE) as f:
self.make_file("run_me.py", f.read())
expected = self.run_command("python run_me.py")
cov_main = os.path.join(TESTS_DIR, "covmain.zip")
actual = self.run_command(f"python {cov_main} run run_me.py")
> self.assert_tryexecfile_output(expected, actual)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/test_process.py:804:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_process.EnvironmentTest object at 0x7ff2a7ed74c0>
expected = '{\n "DATA": "xyzzy",\n "FN_VAL": "my_fn(\'fooey\')",\n "__builtins__.dir": [\n "ArithmeticError Asser...site-packages",\n "/usr/lib64/python3.8/site-packages",\n "/usr/lib/python3.8/site-packages"\n ]\n}\n'
actual = "python3: can't open file '/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/covmain.zip': [Errno 2] No such file or directory\n"
def assert_tryexecfile_output(self, expected: str, actual: str) -> None:
"""Assert that the output we got is a successful run of try_execfile.py.
`expected` and `actual` must be the same, modulo a few slight known
platform differences.
"""
# First, is this even credible try_execfile.py output?
> assert '"DATA": "xyzzy"' in actual
E assert '"DATA": "xyzzy"' in "python3: can't open file '/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/covmain.zip': [Errno 2] No such file or directory\n"
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/test_process.py:673: AssertionError
----------------------------- Captured stdout call -----------------------------
{
"DATA": "xyzzy",
"FN_VAL": "my_fn('fooey')",
"__builtins__.dir": [
"ArithmeticError AssertionError AttributeError BaseException BlockingIOError BrokenPipeError BufferError BytesWarning ChildProcessError ConnectionAbortedError ConnectionError ConnectionRefusedError ConnectionResetError",
"DeprecationWarning EOFError Ellipsis EnvironmentError Exception False FileExistsError FileNotFoundError FloatingPointError FutureWarning",
"GeneratorExit IOError ImportError ImportWarning IndentationError IndexError InterruptedError IsADirectoryError",
"KeyError KeyboardInterrupt LookupError MemoryError ModuleNotFoundError NameError None NotADirectoryError NotImplemented NotImplementedError",
"OSError OverflowError PendingDeprecationWarning PermissionError ProcessLookupError RecursionError ReferenceError ResourceWarning RuntimeError RuntimeWarning",
"StopAsyncIteration StopIteration SyntaxError SyntaxWarning SystemError SystemExit TabError TimeoutError True TypeError",
"UnboundLocalError UnicodeDecodeError UnicodeEncodeError UnicodeError UnicodeTranslateError UnicodeWarning UserWarning",
"ValueError Warning ZeroDivisionError __build_class__ __debug__ __doc__ __import__ __loader__ __name__ __package__ __spec__",
"abs all any ascii bin bool breakpoint bytearray bytes",
"callable chr classmethod compile complex copyright credits delattr dict dir divmod",
"enumerate eval exec exit filter float format frozenset getattr globals",
"hasattr hash help hex id input int isinstance issubclass iter",
"len license list locals map max memoryview min next object oct open ord",
"pow print property quit range repr reversed round",
"set setattr slice sorted staticmethod str sum super tuple type vars zip"
],
"__builtins__.has_open": true,
"__doc__": "Test file for run_python_file.\n\nThis file is executed two ways::\n\n $ coverage run try_execfile.py\n\nand::\n\n $ python try_execfile.py\n\nThe output is compared to see that the program execution context is the same\nunder coverage and under Python.\n\nIt is not crucial that the execution be identical, there are some differences\nthat are OK. This program canonicalizes the output to gloss over those\ndifferences and get a clean diff.\n\n",
"__file__": "run_me.py",
"__loader__ exists": true,
"__loader__.fullname": "__main__",
"__main__.DATA": "xyzzy",
"__name__": "__main__",
"__package__": null,
"__spec__ exists": false,
"argv0": "run_me.py",
"argv1-n": [],
"os.getcwd": "/tmp/pytest-of-tkloczko/pytest-1/popen-gw4/t16",
"path": [
"/tmp/pytest-of-tkloczko/pytest-1/popen-gw4/t16",
"/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-7.2.5-2.fc35.x86_64/usr/lib64/python3.8/site-packages",
"/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-7.2.5-2.fc35.x86_64/usr/lib/python3.8/site-packages",
"/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/modules",
"/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/zipmods.zip",
"/usr/lib64/python38.zip",
"/usr/lib64/python3.8",
"/usr/lib64/python3.8/lib-dynload",
"/home/tkloczko/.local/lib/python3.8/site-packages",
"/usr/lib64/python3.8/site-packages",
"/usr/lib/python3.8/site-packages"
]
}
python3: can't open file '/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/covmain.zip': [Errno 2] No such file or directory
_______________________ GoodFileTracerTest.test_plugin1 ________________________
[gw1] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_plugins.GoodFileTracerTest object at 0x7f59199e43d0>
def test_plugin1(self) -> None:
self.make_file("simple.py", """\
import try_xyz
a = 1
b = 2
""")
self.make_file("try_xyz.py", """\
c = 3
d = 4
""")
cov = coverage.Coverage()
CheckUniqueFilenames.hook(cov, '_should_trace')
CheckUniqueFilenames.hook(cov, '_check_include_omit_etc')
cov.set_option("run:plugins", ["tests.plugin1"])
# Import the Python file, executing it.
self.start_import_stop(cov, "simple")
_, statements, missing, _ = cov.analysis("simple.py")
assert statements == [1, 2, 3]
assert missing == []
zzfile = os.path.abspath(os.path.join("/src", "try_ABC.zz"))
> _, statements, _, _ = cov.analysis(zzfile)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/test_plugins.py:322:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/coverage/control.py:872: in analysis
f, s, _, m, mf = self.analysis2(morf)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/coverage/control.py:895: in analysis2
analysis = self._analyze(morf)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/coverage/control.py:920: in _analyze
return Analysis(data, self.config.precision, fr, self._file_mapper)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/coverage/results.py:35: in __init__
self.statements = self.file_reporter.lines()
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/coverage/python.py:193: in lines
return self.parser.statements
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/coverage/python.py:184: in parser
self._parser = PythonParser(
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/coverage/parser.py:56: in __init__
self.text = get_python_source(self.filename)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
filename = '/src/try_ABC.zz'
def get_python_source(filename: str) -> str:
"""Return the source code, as unicode."""
base, ext = os.path.splitext(filename)
if ext == ".py" and env.WINDOWS:
exts = [".py", ".pyw"]
else:
exts = [ext]
source_bytes: Optional[bytes]
for ext in exts:
try_filename = base + ext
if os.path.exists(try_filename):
# A regular text file: open it.
source_bytes = read_python_source(try_filename)
break
# Maybe it's in a zip file?
source_bytes = get_zip_bytes(try_filename)
if source_bytes is not None:
break
else:
# Couldn't find source.
> raise NoSource(f"No source for code: '{filename}'.")
E coverage.exceptions.NoSource: No source for code: '/src/try_ABC.zz'.
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/coverage/python.py:63: NoSource
___ ProcessStartupWithSourceTest.test_pth_and_source_work_together[main---m] ___
[gw23] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_process.ProcessStartupWithSourceTest object at 0x7fc6a0ef5fd0>
dashm = '-m', package = '', source = 'main'
@pytest.mark.parametrize("dashm", ["-m", ""])
@pytest.mark.parametrize("package", ["pkg", ""])
@pytest.mark.parametrize("source", ["main", "sub"])
def test_pth_and_source_work_together(self, dashm: str, package: str, source: str) -> None:
"""Run the test for a particular combination of factors.
The arguments are all strings:
* `dashm`: Either "" (run the program as a file) or "-m" (run the
program as a module).
* `package`: Either "" (put the source at the top level) or a
package name to use to hold the source.
* `source`: Either "main" or "sub", which file to use as the
``--source`` argument.
"""
def fullname(modname: str) -> str:
"""What is the full module name for `modname` for this test?"""
if package and dashm:
return '.'.join((package, modname))
else:
return modname
def path(basename: str) -> str:
"""Where should `basename` be created for this test?"""
return os.path.join(package, basename)
# Main will run sub.py.
self.make_file(path("main.py"), """\
import %s
a = 2
b = 3
""" % fullname('sub'))
if package:
self.make_file(path("__init__.py"), "")
# sub.py will write a few lines.
self.make_file(path("sub.py"), """\
f = open("out.txt", "w")
f.write("Hello, world!")
f.close()
""")
self.make_file("coverage.ini", """\
[run]
source = %s
""" % fullname(source))
self.set_environ("COVERAGE_PROCESS_START", "coverage.ini")
if dashm:
cmd = "python -m %s" % fullname('main')
else:
cmd = "python %s" % path('main.py')
self.run_command(cmd)
with open("out.txt") as f:
assert f.read() == "Hello, world!"
# Read the data from .coverage
> self.assert_exists(".coverage")
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/test_process.py:1277:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_process.ProcessStartupWithSourceTest object at 0x7fc6a0ef5fd0>
fname = '.coverage'
def assert_exists(self, fname: str) -> None:
"""Assert that `fname` is a file that exists."""
> assert os.path.exists(fname), f"File {fname!r} should exist"
E AssertionError: File '.coverage' should exist
E assert False
E + where False = <function exists at 0x7fc6a39b9ca0>('.coverage')
E + where <function exists at 0x7fc6a39b9ca0> = <module 'posixpath' from '/usr/lib64/python3.8/posixpath.py'>.exists
E + where <module 'posixpath' from '/usr/lib64/python3.8/posixpath.py'> = os.path
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/coveragetest.py:340: AssertionError
----------------------------- Captured stdout call -----------------------------
_________________ GoodFileTracerTest.test_plugin2_with_branch __________________
[gw14] linux -- Python 3.8.16 /usr/bin/python3
self = <coverage.parser.ByteParser object at 0x7f34d1d1ecd0>
text = 'line 0\nline 1\nline 2\nline 3\nline 4\nline 5\nline 6\n', code = None
filename = '/tmp/pytest-of-tkloczko/pytest-1/popen-gw14/t10/foo_7.html'
def __init__(
self,
text: str,
code: Optional[CodeType] = None,
filename: Optional[str] = None,
) -> None:
self.text = text
if code is not None:
self.code = code
else:
assert filename is not None
try:
> self.code = compile(text, filename, "exec", dont_inherit=True)
E File "/tmp/pytest-of-tkloczko/pytest-1/popen-gw14/t10/foo_7.html", line 1
E line 0
E ^
E SyntaxError: invalid syntax
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/coverage/parser.py:388: SyntaxError
The above exception was the direct cause of the following exception:
self = <tests.test_plugins.GoodFileTracerTest object at 0x7f34d1f25eb0>
def test_plugin2_with_branch(self) -> None:
self.make_render_and_caller()
cov = coverage.Coverage(branch=True, omit=["*quux*"])
CheckUniqueFilenames.hook(cov, '_should_trace')
CheckUniqueFilenames.hook(cov, '_check_include_omit_etc')
cov.set_option("run:plugins", ["tests.plugin2"])
self.start_import_stop(cov, "caller")
# The way plugin2 works, a file named foo_7.html will be claimed to
# have 7 lines in it. If render() was called with line number 4,
# then the plugin will claim that lines 4 and 5 were executed.
> analysis = cov._analyze("foo_7.html")
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/test_plugins.py:406:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/coverage/control.py:920: in _analyze
return Analysis(data, self.config.precision, fr, self._file_mapper)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/coverage/results.py:35: in __init__
self.statements = self.file_reporter.lines()
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/coverage/python.py:193: in lines
return self.parser.statements
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/coverage/python.py:188: in parser
self._parser.parse_source()
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/coverage/parser.py:253: in parse_source
self._raw_parse()
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/coverage/parser.py:211: in _raw_parse
byte_parser = ByteParser(self.text, filename=self.filename)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <coverage.parser.ByteParser object at 0x7f34d1d1ecd0>
text = 'line 0\nline 1\nline 2\nline 3\nline 4\nline 5\nline 6\n', code = None
filename = '/tmp/pytest-of-tkloczko/pytest-1/popen-gw14/t10/foo_7.html'
def __init__(
self,
text: str,
code: Optional[CodeType] = None,
filename: Optional[str] = None,
) -> None:
self.text = text
if code is not None:
self.code = code
else:
assert filename is not None
try:
self.code = compile(text, filename, "exec", dont_inherit=True)
except SyntaxError as synerr:
> raise NotPython(
"Couldn't parse '%s' as Python source: '%s' at line %d" % (
filename, synerr.msg, synerr.lineno or 0
)
) from synerr
E coverage.exceptions.NotPython: Couldn't parse '/tmp/pytest-of-tkloczko/pytest-1/popen-gw14/t10/foo_7.html' as Python source: 'invalid syntax' at line 1
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/coverage/parser.py:390: NotPython
__ ProcessStartupWithSourceTest.test_pth_and_source_work_together[sub-pkg--m] __
[gw45] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_process.ProcessStartupWithSourceTest object at 0x7f6dd030b2e0>
dashm = '-m', package = 'pkg', source = 'sub'
@pytest.mark.parametrize("dashm", ["-m", ""])
@pytest.mark.parametrize("package", ["pkg", ""])
@pytest.mark.parametrize("source", ["main", "sub"])
def test_pth_and_source_work_together(self, dashm: str, package: str, source: str) -> None:
"""Run the test for a particular combination of factors.
The arguments are all strings:
* `dashm`: Either "" (run the program as a file) or "-m" (run the
program as a module).
* `package`: Either "" (put the source at the top level) or a
package name to use to hold the source.
* `source`: Either "main" or "sub", which file to use as the
``--source`` argument.
"""
def fullname(modname: str) -> str:
"""What is the full module name for `modname` for this test?"""
if package and dashm:
return '.'.join((package, modname))
else:
return modname
def path(basename: str) -> str:
"""Where should `basename` be created for this test?"""
return os.path.join(package, basename)
# Main will run sub.py.
self.make_file(path("main.py"), """\
import %s
a = 2
b = 3
""" % fullname('sub'))
if package:
self.make_file(path("__init__.py"), "")
# sub.py will write a few lines.
self.make_file(path("sub.py"), """\
f = open("out.txt", "w")
f.write("Hello, world!")
f.close()
""")
self.make_file("coverage.ini", """\
[run]
source = %s
""" % fullname(source))
self.set_environ("COVERAGE_PROCESS_START", "coverage.ini")
if dashm:
cmd = "python -m %s" % fullname('main')
else:
cmd = "python %s" % path('main.py')
self.run_command(cmd)
with open("out.txt") as f:
assert f.read() == "Hello, world!"
# Read the data from .coverage
> self.assert_exists(".coverage")
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/test_process.py:1277:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_process.ProcessStartupWithSourceTest object at 0x7f6dd030b2e0>
fname = '.coverage'
def assert_exists(self, fname: str) -> None:
"""Assert that `fname` is a file that exists."""
> assert os.path.exists(fname), f"File {fname!r} should exist"
E AssertionError: File '.coverage' should exist
E assert False
E + where False = <function exists at 0x7f6dd2db9ca0>('.coverage')
E + where <function exists at 0x7f6dd2db9ca0> = <module 'posixpath' from '/usr/lib64/python3.8/posixpath.py'>.exists
E + where <module 'posixpath' from '/usr/lib64/python3.8/posixpath.py'> = os.path
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/coveragetest.py:340: AssertionError
----------------------------- Captured stdout call -----------------------------
____ ProcessStartupWithSourceTest.test_pth_and_source_work_together[sub--] _____
[gw20] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_process.ProcessStartupWithSourceTest object at 0x7f5922a75c70>
dashm = '', package = '', source = 'sub'
@pytest.mark.parametrize("dashm", ["-m", ""])
@pytest.mark.parametrize("package", ["pkg", ""])
@pytest.mark.parametrize("source", ["main", "sub"])
def test_pth_and_source_work_together(self, dashm: str, package: str, source: str) -> None:
"""Run the test for a particular combination of factors.
The arguments are all strings:
* `dashm`: Either "" (run the program as a file) or "-m" (run the
program as a module).
* `package`: Either "" (put the source at the top level) or a
package name to use to hold the source.
* `source`: Either "main" or "sub", which file to use as the
``--source`` argument.
"""
def fullname(modname: str) -> str:
"""What is the full module name for `modname` for this test?"""
if package and dashm:
return '.'.join((package, modname))
else:
return modname
def path(basename: str) -> str:
"""Where should `basename` be created for this test?"""
return os.path.join(package, basename)
# Main will run sub.py.
self.make_file(path("main.py"), """\
import %s
a = 2
b = 3
""" % fullname('sub'))
if package:
self.make_file(path("__init__.py"), "")
# sub.py will write a few lines.
self.make_file(path("sub.py"), """\
f = open("out.txt", "w")
f.write("Hello, world!")
f.close()
""")
self.make_file("coverage.ini", """\
[run]
source = %s
""" % fullname(source))
self.set_environ("COVERAGE_PROCESS_START", "coverage.ini")
if dashm:
cmd = "python -m %s" % fullname('main')
else:
cmd = "python %s" % path('main.py')
self.run_command(cmd)
with open("out.txt") as f:
assert f.read() == "Hello, world!"
# Read the data from .coverage
> self.assert_exists(".coverage")
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/test_process.py:1277:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_process.ProcessStartupWithSourceTest object at 0x7f5922a75c70>
fname = '.coverage'
def assert_exists(self, fname: str) -> None:
"""Assert that `fname` is a file that exists."""
> assert os.path.exists(fname), f"File {fname!r} should exist"
E AssertionError: File '.coverage' should exist
E assert False
E + where False = <function exists at 0x7f5936cf9ca0>('.coverage')
E + where <function exists at 0x7f5936cf9ca0> = <module 'posixpath' from '/usr/lib64/python3.8/posixpath.py'>.exists
E + where <module 'posixpath' from '/usr/lib64/python3.8/posixpath.py'> = os.path
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/coveragetest.py:340: AssertionError
----------------------------- Captured stdout call -----------------------------
_______________________ GoodFileTracerTest.test_plugin2 ________________________
[gw10] linux -- Python 3.8.16 /usr/bin/python3
self = <coverage.parser.ByteParser object at 0x7f8e6d44ee20>
text = 'line 0\nline 1\nline 2\nline 3\nline 4\nline 5\nline 6\n', code = None
filename = '/tmp/pytest-of-tkloczko/pytest-1/popen-gw10/t18/foo_7.html'
def __init__(
self,
text: str,
code: Optional[CodeType] = None,
filename: Optional[str] = None,
) -> None:
self.text = text
if code is not None:
self.code = code
else:
assert filename is not None
try:
> self.code = compile(text, filename, "exec", dont_inherit=True)
E File "/tmp/pytest-of-tkloczko/pytest-1/popen-gw10/t18/foo_7.html", line 1
E line 0
E ^
E SyntaxError: invalid syntax
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/coverage/parser.py:388: SyntaxError
The above exception was the direct cause of the following exception:
self = <tests.test_plugins.GoodFileTracerTest object at 0x7f8e6df575e0>
def test_plugin2(self) -> None:
self.make_render_and_caller()
cov = coverage.Coverage(omit=["*quux*"])
CheckUniqueFilenames.hook(cov, '_should_trace')
CheckUniqueFilenames.hook(cov, '_check_include_omit_etc')
cov.set_option("run:plugins", ["tests.plugin2"])
self.start_import_stop(cov, "caller")
# The way plugin2 works, a file named foo_7.html will be claimed to
# have 7 lines in it. If render() was called with line number 4,
# then the plugin will claim that lines 4 and 5 were executed.
> _, statements, missing, _ = cov.analysis("foo_7.html")
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/test_plugins.py:381:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/coverage/control.py:872: in analysis
f, s, _, m, mf = self.analysis2(morf)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/coverage/control.py:895: in analysis2
analysis = self._analyze(morf)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/coverage/control.py:920: in _analyze
return Analysis(data, self.config.precision, fr, self._file_mapper)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/coverage/results.py:35: in __init__
self.statements = self.file_reporter.lines()
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/coverage/python.py:193: in lines
return self.parser.statements
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/coverage/python.py:188: in parser
self._parser.parse_source()
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/coverage/parser.py:253: in parse_source
self._raw_parse()
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/coverage/parser.py:211: in _raw_parse
byte_parser = ByteParser(self.text, filename=self.filename)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <coverage.parser.ByteParser object at 0x7f8e6d44ee20>
text = 'line 0\nline 1\nline 2\nline 3\nline 4\nline 5\nline 6\n', code = None
filename = '/tmp/pytest-of-tkloczko/pytest-1/popen-gw10/t18/foo_7.html'
def __init__(
self,
text: str,
code: Optional[CodeType] = None,
filename: Optional[str] = None,
) -> None:
self.text = text
if code is not None:
self.code = code
else:
assert filename is not None
try:
self.code = compile(text, filename, "exec", dont_inherit=True)
except SyntaxError as synerr:
> raise NotPython(
"Couldn't parse '%s' as Python source: '%s' at line %d" % (
filename, synerr.msg, synerr.lineno or 0
)
) from synerr
E coverage.exceptions.NotPython: Couldn't parse '/tmp/pytest-of-tkloczko/pytest-1/popen-gw10/t18/foo_7.html' as Python source: 'invalid syntax' at line 1
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/coverage/parser.py:390: NotPython
___ ProcessStartupWithSourceTest.test_pth_and_source_work_together[sub---m] ____
[gw0] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_process.ProcessStartupWithSourceTest object at 0x7fc0729e0d00>
dashm = '-m', package = '', source = 'sub'
@pytest.mark.parametrize("dashm", ["-m", ""])
@pytest.mark.parametrize("package", ["pkg", ""])
@pytest.mark.parametrize("source", ["main", "sub"])
def test_pth_and_source_work_together(self, dashm: str, package: str, source: str) -> None:
"""Run the test for a particular combination of factors.
The arguments are all strings:
* `dashm`: Either "" (run the program as a file) or "-m" (run the
program as a module).
* `package`: Either "" (put the source at the top level) or a
package name to use to hold the source.
* `source`: Either "main" or "sub", which file to use as the
``--source`` argument.
"""
def fullname(modname: str) -> str:
"""What is the full module name for `modname` for this test?"""
if package and dashm:
return '.'.join((package, modname))
else:
return modname
def path(basename: str) -> str:
"""Where should `basename` be created for this test?"""
return os.path.join(package, basename)
# Main will run sub.py.
self.make_file(path("main.py"), """\
import %s
a = 2
b = 3
""" % fullname('sub'))
if package:
self.make_file(path("__init__.py"), "")
# sub.py will write a few lines.
self.make_file(path("sub.py"), """\
f = open("out.txt", "w")
f.write("Hello, world!")
f.close()
""")
self.make_file("coverage.ini", """\
[run]
source = %s
""" % fullname(source))
self.set_environ("COVERAGE_PROCESS_START", "coverage.ini")
if dashm:
cmd = "python -m %s" % fullname('main')
else:
cmd = "python %s" % path('main.py')
self.run_command(cmd)
with open("out.txt") as f:
assert f.read() == "Hello, world!"
# Read the data from .coverage
> self.assert_exists(".coverage")
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/test_process.py:1277:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_process.ProcessStartupWithSourceTest object at 0x7fc0729e0d00>
fname = '.coverage'
def assert_exists(self, fname: str) -> None:
"""Assert that `fname` is a file that exists."""
> assert os.path.exists(fname), f"File {fname!r} should exist"
E AssertionError: File '.coverage' should exist
E assert False
E + where False = <function exists at 0x7fc086cf9ca0>('.coverage')
E + where <function exists at 0x7fc086cf9ca0> = <module 'posixpath' from '/usr/lib64/python3.8/posixpath.py'>.exists
E + where <module 'posixpath' from '/usr/lib64/python3.8/posixpath.py'> = os.path
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/coveragetest.py:340: AssertionError
----------------------------- Captured stdout call -----------------------------
____ ProcessStartupWithSourceTest.test_pth_and_source_work_together[main--] ____
[gw23] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_process.ProcessStartupWithSourceTest object at 0x7fc6a0eecac0>
dashm = '', package = '', source = 'main'
@pytest.mark.parametrize("dashm", ["-m", ""])
@pytest.mark.parametrize("package", ["pkg", ""])
@pytest.mark.parametrize("source", ["main", "sub"])
def test_pth_and_source_work_together(self, dashm: str, package: str, source: str) -> None:
"""Run the test for a particular combination of factors.
The arguments are all strings:
* `dashm`: Either "" (run the program as a file) or "-m" (run the
program as a module).
* `package`: Either "" (put the source at the top level) or a
package name to use to hold the source.
* `source`: Either "main" or "sub", which file to use as the
``--source`` argument.
"""
def fullname(modname: str) -> str:
"""What is the full module name for `modname` for this test?"""
if package and dashm:
return '.'.join((package, modname))
else:
return modname
def path(basename: str) -> str:
"""Where should `basename` be created for this test?"""
return os.path.join(package, basename)
# Main will run sub.py.
self.make_file(path("main.py"), """\
import %s
a = 2
b = 3
""" % fullname('sub'))
if package:
self.make_file(path("__init__.py"), "")
# sub.py will write a few lines.
self.make_file(path("sub.py"), """\
f = open("out.txt", "w")
f.write("Hello, world!")
f.close()
""")
self.make_file("coverage.ini", """\
[run]
source = %s
""" % fullname(source))
self.set_environ("COVERAGE_PROCESS_START", "coverage.ini")
if dashm:
cmd = "python -m %s" % fullname('main')
else:
cmd = "python %s" % path('main.py')
self.run_command(cmd)
with open("out.txt") as f:
assert f.read() == "Hello, world!"
# Read the data from .coverage
> self.assert_exists(".coverage")
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/test_process.py:1277:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_process.ProcessStartupWithSourceTest object at 0x7fc6a0eecac0>
fname = '.coverage'
def assert_exists(self, fname: str) -> None:
"""Assert that `fname` is a file that exists."""
> assert os.path.exists(fname), f"File {fname!r} should exist"
E AssertionError: File '.coverage' should exist
E assert False
E + where False = <function exists at 0x7fc6a39b9ca0>('.coverage')
E + where <function exists at 0x7fc6a39b9ca0> = <module 'posixpath' from '/usr/lib64/python3.8/posixpath.py'>.exists
E + where <module 'posixpath' from '/usr/lib64/python3.8/posixpath.py'> = os.path
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/coveragetest.py:340: AssertionError
----------------------------- Captured stdout call -----------------------------
___ ProcessStartupWithSourceTest.test_pth_and_source_work_together[sub-pkg-] ___
[gw45] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_process.ProcessStartupWithSourceTest object at 0x7f6dd030b160>
dashm = '', package = 'pkg', source = 'sub'
@pytest.mark.parametrize("dashm", ["-m", ""])
@pytest.mark.parametrize("package", ["pkg", ""])
@pytest.mark.parametrize("source", ["main", "sub"])
def test_pth_and_source_work_together(self, dashm: str, package: str, source: str) -> None:
"""Run the test for a particular combination of factors.
The arguments are all strings:
* `dashm`: Either "" (run the program as a file) or "-m" (run the
program as a module).
* `package`: Either "" (put the source at the top level) or a
package name to use to hold the source.
* `source`: Either "main" or "sub", which file to use as the
``--source`` argument.
"""
def fullname(modname: str) -> str:
"""What is the full module name for `modname` for this test?"""
if package and dashm:
return '.'.join((package, modname))
else:
return modname
def path(basename: str) -> str:
"""Where should `basename` be created for this test?"""
return os.path.join(package, basename)
# Main will run sub.py.
self.make_file(path("main.py"), """\
import %s
a = 2
b = 3
""" % fullname('sub'))
if package:
self.make_file(path("__init__.py"), "")
# sub.py will write a few lines.
self.make_file(path("sub.py"), """\
f = open("out.txt", "w")
f.write("Hello, world!")
f.close()
""")
self.make_file("coverage.ini", """\
[run]
source = %s
""" % fullname(source))
self.set_environ("COVERAGE_PROCESS_START", "coverage.ini")
if dashm:
cmd = "python -m %s" % fullname('main')
else:
cmd = "python %s" % path('main.py')
self.run_command(cmd)
with open("out.txt") as f:
assert f.read() == "Hello, world!"
# Read the data from .coverage
> self.assert_exists(".coverage")
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/test_process.py:1277:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_process.ProcessStartupWithSourceTest object at 0x7f6dd030b160>
fname = '.coverage'
def assert_exists(self, fname: str) -> None:
"""Assert that `fname` is a file that exists."""
> assert os.path.exists(fname), f"File {fname!r} should exist"
E AssertionError: File '.coverage' should exist
E assert False
E + where False = <function exists at 0x7f6dd2db9ca0>('.coverage')
E + where <function exists at 0x7f6dd2db9ca0> = <module 'posixpath' from '/usr/lib64/python3.8/posixpath.py'>.exists
E + where <module 'posixpath' from '/usr/lib64/python3.8/posixpath.py'> = os.path
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/coveragetest.py:340: AssertionError
----------------------------- Captured stdout call -----------------------------
_______________________ SummaryTest.test_report_just_one _______________________
[gw4] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_summary.SummaryTest object at 0x7ff2a7f305e0>
def test_report_just_one(self) -> None:
# Try reporting just one module
self.make_mycode()
cov = coverage.Coverage()
> self.start_import_stop(cov, "mycode")
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/test_summary.py:70:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/coveragetest.py:93: in start_import_stop
mod = import_local_file(modname, modfile)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/coverage/misc.py:336: in import_local_file
spec.loader.exec_module(mod)
<frozen importlib._bootstrap_external>:843: in exec_module
???
<frozen importlib._bootstrap>:219: in _call_with_frames_removed
???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
import covmod1
> import covmodzip1
E ModuleNotFoundError: No module named 'covmodzip1'
/tmp/pytest-of-tkloczko/pytest-1/popen-gw4/t18/mycode.py:2: ModuleNotFoundError
_______________________ SummaryTest.test_report_omitting _______________________
[gw14] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_summary.SummaryTest object at 0x7f34d1e69fa0>
def test_report_omitting(self) -> None:
# Try reporting while omitting some modules
self.make_mycode()
cov = coverage.Coverage()
> self.start_import_stop(cov, "mycode")
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/test_summary.py:109:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/coveragetest.py:93: in start_import_stop
mod = import_local_file(modname, modfile)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/coverage/misc.py:336: in import_local_file
spec.loader.exec_module(mod)
<frozen importlib._bootstrap_external>:843: in exec_module
???
<frozen importlib._bootstrap>:219: in _call_with_frames_removed
???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
import covmod1
> import covmodzip1
E ModuleNotFoundError: No module named 'covmodzip1'
/tmp/pytest-of-tkloczko/pytest-1/popen-gw14/t12/mycode.py:2: ModuleNotFoundError
______________ ProcessStartupTest.test_subprocess_with_pth_files _______________
[gw46] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_process.ProcessStartupTest object at 0x7f7975904d90>
def test_subprocess_with_pth_files(self) -> None:
# An existing data file should not be read when a subprocess gets
# measured automatically. Create the data file here with bogus data in
# it.
data = coverage.CoverageData(".mycovdata")
data.add_lines({os.path.abspath('sub.py'): range(100)})
data.write()
self.make_file("coverage.ini", """\
[run]
data_file = .mycovdata
""")
self.set_environ("COVERAGE_PROCESS_START", "coverage.ini")
import main # pylint: disable=unused-import, import-error
with open("out.txt") as f:
assert f.read() == "Hello, world!\n"
# Read the data from .coverage
self.assert_exists(".mycovdata")
data = coverage.CoverageData(".mycovdata")
data.read()
> assert line_counts(data)['sub.py'] == 3
E assert 100 == 3
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/test_process.py:1170: AssertionError
___________________________ SummaryTest.test_report ____________________________
[gw29] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_summary.SummaryTest object at 0x7fe218293310>
def test_report(self) -> None:
self.make_mycode()
cov = coverage.Coverage()
> self.start_import_stop(cov, "mycode")
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/test_summary.py:48:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/coveragetest.py:93: in start_import_stop
mod = import_local_file(modname, modfile)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/coverage/misc.py:336: in import_local_file
spec.loader.exec_module(mod)
<frozen importlib._bootstrap_external>:843: in exec_module
???
<frozen importlib._bootstrap>:219: in _call_with_frames_removed
???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
import covmod1
> import covmodzip1
E ModuleNotFoundError: No module named 'covmodzip1'
/tmp/pytest-of-tkloczko/pytest-1/popen-gw29/t18/mycode.py:2: ModuleNotFoundError
______________ GetZipBytesTest.test_get_encoded_zip_files[utf-8] _______________
[gw25] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_python.GetZipBytesTest object at 0x7f1c30308fd0>
encoding = 'utf-8'
@pytest.mark.parametrize(
"encoding",
["utf-8", "gb2312", "hebrew", "shift_jis", "cp1252"],
)
def test_get_encoded_zip_files(self, encoding: str) -> None:
# See igor.py, do_zipmods, for the text of these files.
zip_file = "tests/zipmods.zip"
sys.path.append(zip_file) # So we can import the files.
filename = zip_file + "/encoded_" + encoding + ".py"
filename = os_sep(filename)
zip_data = get_zip_bytes(filename)
> assert zip_data is not None
E assert None is not None
tests/test_python.py:36: AssertionError
______________ GetZipBytesTest.test_get_encoded_zip_files[gb2312] ______________
[gw25] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_python.GetZipBytesTest object at 0x7f1c30308a60>
encoding = 'gb2312'
@pytest.mark.parametrize(
"encoding",
["utf-8", "gb2312", "hebrew", "shift_jis", "cp1252"],
)
def test_get_encoded_zip_files(self, encoding: str) -> None:
# See igor.py, do_zipmods, for the text of these files.
zip_file = "tests/zipmods.zip"
sys.path.append(zip_file) # So we can import the files.
filename = zip_file + "/encoded_" + encoding + ".py"
filename = os_sep(filename)
zip_data = get_zip_bytes(filename)
> assert zip_data is not None
E assert None is not None
tests/test_python.py:36: AssertionError
______________ GetZipBytesTest.test_get_encoded_zip_files[hebrew] ______________
[gw25] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_python.GetZipBytesTest object at 0x7f1c30308ac0>
encoding = 'hebrew'
@pytest.mark.parametrize(
"encoding",
["utf-8", "gb2312", "hebrew", "shift_jis", "cp1252"],
)
def test_get_encoded_zip_files(self, encoding: str) -> None:
# See igor.py, do_zipmods, for the text of these files.
zip_file = "tests/zipmods.zip"
sys.path.append(zip_file) # So we can import the files.
filename = zip_file + "/encoded_" + encoding + ".py"
filename = os_sep(filename)
zip_data = get_zip_bytes(filename)
> assert zip_data is not None
E assert None is not None
tests/test_python.py:36: AssertionError
____________ GetZipBytesTest.test_get_encoded_zip_files[shift_jis] _____________
[gw25] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_python.GetZipBytesTest object at 0x7f1c30308be0>
encoding = 'shift_jis'
@pytest.mark.parametrize(
"encoding",
["utf-8", "gb2312", "hebrew", "shift_jis", "cp1252"],
)
def test_get_encoded_zip_files(self, encoding: str) -> None:
# See igor.py, do_zipmods, for the text of these files.
zip_file = "tests/zipmods.zip"
sys.path.append(zip_file) # So we can import the files.
filename = zip_file + "/encoded_" + encoding + ".py"
filename = os_sep(filename)
zip_data = get_zip_bytes(filename)
> assert zip_data is not None
E assert None is not None
tests/test_python.py:36: AssertionError
_______ SummaryTest.test_report_include_relative_files_and_wildcard_path _______
[gw4] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_summary.SummaryTest object at 0x7ff2a7edd850>
def test_report_include_relative_files_and_wildcard_path(self) -> None:
self.make_mycode()
self.make_file(".coveragerc", """\
[run]
relative_files = true
""")
self.make_file("submodule/mycode.py", "import nested.submodule.mycode")
self.make_file("nested/submodule/mycode.py", "import mycode")
cov = coverage.Coverage()
> self.start_import_stop(cov, "submodule/mycode")
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/test_summary.py:182:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/coveragetest.py:93: in start_import_stop
mod = import_local_file(modname, modfile)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/coverage/misc.py:336: in import_local_file
spec.loader.exec_module(mod)
<frozen importlib._bootstrap_external>:843: in exec_module
???
<frozen importlib._bootstrap>:219: in _call_with_frames_removed
???
/tmp/pytest-of-tkloczko/pytest-1/popen-gw4/t19/submodule/mycode.py:1: in <module>
import nested.submodule.mycode
/tmp/pytest-of-tkloczko/pytest-1/popen-gw4/t19/nested/submodule/mycode.py:1: in <module>
import mycode
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
import covmod1
> import covmodzip1
E ModuleNotFoundError: No module named 'covmodzip1'
/tmp/pytest-of-tkloczko/pytest-1/popen-gw4/t19/mycode.py:2: ModuleNotFoundError
______________ GetZipBytesTest.test_get_encoded_zip_files[cp1252] ______________
[gw25] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_python.GetZipBytesTest object at 0x7f1c30308ca0>
encoding = 'cp1252'
@pytest.mark.parametrize(
"encoding",
["utf-8", "gb2312", "hebrew", "shift_jis", "cp1252"],
)
def test_get_encoded_zip_files(self, encoding: str) -> None:
# See igor.py, do_zipmods, for the text of these files.
zip_file = "tests/zipmods.zip"
sys.path.append(zip_file) # So we can import the files.
filename = zip_file + "/encoded_" + encoding + ".py"
filename = os_sep(filename)
zip_data = get_zip_bytes(filename)
> assert zip_data is not None
E assert None is not None
tests/test_python.py:36: AssertionError
___________ SummaryTest.test_report_include_relative_files_and_path ____________
[gw29] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_summary.SummaryTest object at 0x7fe2182b4550>
def test_report_include_relative_files_and_path(self) -> None:
"""
Test that when relative_files is True and a relative path to a module
is included, coverage is reported for the module.
Ref: https://github.com/nedbat/coveragepy/issues/1604
"""
self.make_mycode()
self.make_file(".coveragerc", """\
[run]
relative_files = true
""")
self.make_file("submodule/mycode.py", "import mycode")
cov = coverage.Coverage()
> self.start_import_stop(cov, "submodule/mycode")
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/test_summary.py:160:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/coveragetest.py:93: in start_import_stop
mod = import_local_file(modname, modfile)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/coverage/misc.py:336: in import_local_file
spec.loader.exec_module(mod)
<frozen importlib._bootstrap_external>:843: in exec_module
???
<frozen importlib._bootstrap>:219: in _call_with_frames_removed
???
/tmp/pytest-of-tkloczko/pytest-1/popen-gw29/t19/submodule/mycode.py:1: in <module>
import mycode
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
import covmod1
> import covmodzip1
E ModuleNotFoundError: No module named 'covmodzip1'
/tmp/pytest-of-tkloczko/pytest-1/popen-gw29/t19/mycode.py:2: ModuleNotFoundError
____________________ test_xdist_sys_path_nuttiness_is_fixed ____________________
[gw7] linux -- Python 3.8.16 /usr/bin/python3
def test_xdist_sys_path_nuttiness_is_fixed() -> None:
# See conftest.py:fix_xdist_sys_path
assert sys.path[1] != ''
> assert os.environ.get('PYTHONPATH') is None
E AssertionError: assert '/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-7.2.5-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-7.2.5-2.fc35.x86_64/usr/lib/python3.8/site-packages' is None
E + where '/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-7.2.5-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-7.2.5-2.fc35.x86_64/usr/lib/python3.8/site-packages' = <bound method Mapping.get of environ({'PATH': '/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-7.2.5-2.fc35.x86_64/u...T_WORKER_COUNT': '48', 'PYTEST_CURRENT_TEST': 'tests/test_testing.py::test_xdist_sys_path_nuttiness_is_fixed (call)'})>('PYTHONPATH')
E + where <bound method Mapping.get of environ({'PATH': '/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-7.2.5-2.fc35.x86_64/u...T_WORKER_COUNT': '48', 'PYTEST_CURRENT_TEST': 'tests/test_testing.py::test_xdist_sys_path_nuttiness_is_fixed (call)'})> = environ({'PATH': '/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-7.2.5-2.fc35.x86_64/usr/bin:/usr/bin:/usr/local/sb...ST_WORKER_COUNT': '48', 'PYTEST_CURRENT_TEST': 'tests/test_testing.py::test_xdist_sys_path_nuttiness_is_fixed (call)'}).get
E + where environ({'PATH': '/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-7.2.5-2.fc35.x86_64/usr/bin:/usr/bin:/usr/local/sb...ST_WORKER_COUNT': '48', 'PYTEST_CURRENT_TEST': 'tests/test_testing.py::test_xdist_sys_path_nuttiness_is_fixed (call)'}) = os.environ
tests/test_testing.py:33: AssertionError
__ ProcessStartupWithSourceTest.test_pth_and_source_work_together[main-pkg-] ___
[gw39] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_process.ProcessStartupWithSourceTest object at 0x7f620dfb8dc0>
dashm = '', package = 'pkg', source = 'main'
@pytest.mark.parametrize("dashm", ["-m", ""])
@pytest.mark.parametrize("package", ["pkg", ""])
@pytest.mark.parametrize("source", ["main", "sub"])
def test_pth_and_source_work_together(self, dashm: str, package: str, source: str) -> None:
"""Run the test for a particular combination of factors.
The arguments are all strings:
* `dashm`: Either "" (run the program as a file) or "-m" (run the
program as a module).
* `package`: Either "" (put the source at the top level) or a
package name to use to hold the source.
* `source`: Either "main" or "sub", which file to use as the
``--source`` argument.
"""
def fullname(modname: str) -> str:
"""What is the full module name for `modname` for this test?"""
if package and dashm:
return '.'.join((package, modname))
else:
return modname
def path(basename: str) -> str:
"""Where should `basename` be created for this test?"""
return os.path.join(package, basename)
# Main will run sub.py.
self.make_file(path("main.py"), """\
import %s
a = 2
b = 3
""" % fullname('sub'))
if package:
self.make_file(path("__init__.py"), "")
# sub.py will write a few lines.
self.make_file(path("sub.py"), """\
f = open("out.txt", "w")
f.write("Hello, world!")
f.close()
""")
self.make_file("coverage.ini", """\
[run]
source = %s
""" % fullname(source))
self.set_environ("COVERAGE_PROCESS_START", "coverage.ini")
if dashm:
cmd = "python -m %s" % fullname('main')
else:
cmd = "python %s" % path('main.py')
self.run_command(cmd)
with open("out.txt") as f:
assert f.read() == "Hello, world!"
# Read the data from .coverage
> self.assert_exists(".coverage")
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/test_process.py:1277:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_process.ProcessStartupWithSourceTest object at 0x7f620dfb8dc0>
fname = '.coverage'
def assert_exists(self, fname: str) -> None:
"""Assert that `fname` is a file that exists."""
> assert os.path.exists(fname), f"File {fname!r} should exist"
E AssertionError: File '.coverage' should exist
E assert False
E + where False = <function exists at 0x7f62109b9ca0>('.coverage')
E + where <function exists at 0x7f62109b9ca0> = <module 'posixpath' from '/usr/lib64/python3.8/posixpath.py'>.exists
E + where <module 'posixpath' from '/usr/lib64/python3.8/posixpath.py'> = os.path
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/coveragetest.py:340: AssertionError
----------------------------- Captured stdout call -----------------------------
_ ProcessStartupWithSourceTest.test_pth_and_source_work_together[main-pkg--m] __
[gw12] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_process.ProcessStartupWithSourceTest object at 0x7fe6850e02e0>
dashm = '-m', package = 'pkg', source = 'main'
@pytest.mark.parametrize("dashm", ["-m", ""])
@pytest.mark.parametrize("package", ["pkg", ""])
@pytest.mark.parametrize("source", ["main", "sub"])
def test_pth_and_source_work_together(self, dashm: str, package: str, source: str) -> None:
"""Run the test for a particular combination of factors.
The arguments are all strings:
* `dashm`: Either "" (run the program as a file) or "-m" (run the
program as a module).
* `package`: Either "" (put the source at the top level) or a
package name to use to hold the source.
* `source`: Either "main" or "sub", which file to use as the
``--source`` argument.
"""
def fullname(modname: str) -> str:
"""What is the full module name for `modname` for this test?"""
if package and dashm:
return '.'.join((package, modname))
else:
return modname
def path(basename: str) -> str:
"""Where should `basename` be created for this test?"""
return os.path.join(package, basename)
# Main will run sub.py.
self.make_file(path("main.py"), """\
import %s
a = 2
b = 3
""" % fullname('sub'))
if package:
self.make_file(path("__init__.py"), "")
# sub.py will write a few lines.
self.make_file(path("sub.py"), """\
f = open("out.txt", "w")
f.write("Hello, world!")
f.close()
""")
self.make_file("coverage.ini", """\
[run]
source = %s
""" % fullname(source))
self.set_environ("COVERAGE_PROCESS_START", "coverage.ini")
if dashm:
cmd = "python -m %s" % fullname('main')
else:
cmd = "python %s" % path('main.py')
self.run_command(cmd)
with open("out.txt") as f:
assert f.read() == "Hello, world!"
# Read the data from .coverage
> self.assert_exists(".coverage")
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/test_process.py:1277:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_process.ProcessStartupWithSourceTest object at 0x7fe6850e02e0>
fname = '.coverage'
def assert_exists(self, fname: str) -> None:
"""Assert that `fname` is a file that exists."""
> assert os.path.exists(fname), f"File {fname!r} should exist"
E AssertionError: File '.coverage' should exist
E assert False
E + where False = <function exists at 0x7fe687bb9ca0>('.coverage')
E + where <function exists at 0x7fe687bb9ca0> = <module 'posixpath' from '/usr/lib64/python3.8/posixpath.py'>.exists
E + where <module 'posixpath' from '/usr/lib64/python3.8/posixpath.py'> = os.path
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/coveragetest.py:340: AssertionError
----------------------------- Captured stdout call -----------------------------
________________________ ProcessTest.test_fullcoverage _________________________
[gw10] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_process.ProcessTest object at 0x7f8e6d62f550>
@pytest.mark.expensive
@pytest.mark.skipif(not env.C_TRACER, reason="fullcoverage only works with the C tracer.")
@pytest.mark.skipif(env.METACOV, reason="Can't test fullcoverage when measuring ourselves")
def test_fullcoverage(self) -> None:
# fullcoverage is a trick to get stdlib modules measured from
# the very beginning of the process. Here we import os and
# then check how many lines are measured.
self.make_file("getenv.py", """\
import os
print("FOOEY == %s" % os.getenv("FOOEY"))
""")
fullcov = os.path.join(os.path.dirname(coverage.__file__), "fullcoverage")
self.set_environ("FOOEY", "BOO")
self.set_environ("PYTHONPATH", fullcov)
out = self.run_command("python -X frozen_modules=off -m coverage run -L getenv.py")
> assert out == "FOOEY == BOO\n"
E AssertionError: assert '/usr/bin/pyt...ed coverage\n' == 'FOOEY == BOO\n'
E - FOOEY == BOO
E + /usr/bin/python3: No module named coverage
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/test_process.py:574: AssertionError
----------------------------- Captured stdout call -----------------------------
/usr/bin/python3: No module named coverage
______________________ SummaryTest.test_report_including _______________________
[gw20] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_summary.SummaryTest object at 0x7f5922834f70>
def test_report_including(self) -> None:
# Try reporting while including some modules
self.make_mycode()
cov = coverage.Coverage()
> self.start_import_stop(cov, "mycode")
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/test_summary.py:129:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/coveragetest.py:93: in start_import_stop
mod = import_local_file(modname, modfile)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/coverage/misc.py:336: in import_local_file
spec.loader.exec_module(mod)
<frozen importlib._bootstrap_external>:843: in exec_module
???
<frozen importlib._bootstrap>:219: in _call_with_frames_removed
???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
import covmod1
> import covmodzip1
E ModuleNotFoundError: No module named 'covmodzip1'
/tmp/pytest-of-tkloczko/pytest-1/popen-gw20/t20/mycode.py:2: ModuleNotFoundError
___________________ ProcessTest.test_tests_dir_is_importable ___________________
[gw40] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_process.ProcessTest object at 0x7f571d09f400>
def test_tests_dir_is_importable(self) -> None:
# Checks that we can import modules from the tests directory at all!
self.make_file("mycode.py", """\
import covmod1
import covmodzip1
a = 1
print('done')
""")
self.assert_doesnt_exist(".coverage")
out = self.run_command("coverage run mycode.py")
self.assert_exists(".coverage")
> assert out == 'done\n'
E assert "Traceback (m...covmodzip1'\n" == 'done\n'
E - done
E + Traceback (most recent call last):
E + File "mycode.py", line 2, in <module>
E + import covmodzip1
E + ModuleNotFoundError: No module named 'covmodzip1'
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/test_process.py:54: AssertionError
----------------------------- Captured stdout call -----------------------------
Traceback (most recent call last):
File "mycode.py", line 2, in <module>
import covmodzip1
ModuleNotFoundError: No module named 'covmodzip1'
_______________________ SummaryTest.test_report_wildcard _______________________
[gw0] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_summary.SummaryTest object at 0x7fc072835820>
def test_report_wildcard(self) -> None:
# Try reporting using wildcards to get the modules.
self.make_mycode()
# Wildcard is handled by shell or cmdline.py, so use real commands
self.run_command("coverage run mycode.py")
report = self.report_from_command("coverage report my*.py")
# Name Stmts Miss Cover
# -------------------------------
# mycode.py 4 0 100%
# -------------------------------
# TOTAL 4 0 100%
assert self.line_count(report) == 5
assert "/coverage/" not in report
assert "/tests/modules/covmod1.py " not in report
assert "/tests/zipmods.zip/covmodzip1.py " not in report
assert "mycode.py " in report
> assert self.last_line_squeezed(report) == "TOTAL 4 0 100%"
E AssertionError: assert 'TOTAL 4 2 50%' == 'TOTAL 4 0 100%'
E - TOTAL 4 0 100%
E + TOTAL 4 2 50%
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/test_summary.py:103: AssertionError
----------------------------- Captured stdout call -----------------------------
Traceback (most recent call last):
File "mycode.py", line 2, in <module>
import covmodzip1
ModuleNotFoundError: No module named 'covmodzip1'
Name Stmts Miss Cover
-------------------------------
mycode.py 4 2 50%
-------------------------------
TOTAL 4 2 50%
________ ProcessStartupTest.test_subprocess_with_pth_files_and_parallel ________
[gw26] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_process.ProcessStartupTest object at 0x7f8f39861dc0>
def test_subprocess_with_pth_files_and_parallel(self) -> None:
# https://github.com/nedbat/coveragepy/issues/492
self.make_file("coverage.ini", """\
[run]
parallel = true
""")
self.set_environ("COVERAGE_PROCESS_START", "coverage.ini")
self.run_command("coverage run main.py")
with open("out.txt") as f:
assert f.read() == "Hello, world!\n"
self.run_command("coverage combine")
# assert that the combined .coverage data file is correct
self.assert_exists(".coverage")
data = coverage.CoverageData()
data.read()
> assert line_counts(data)['sub.py'] == 3
E KeyError: 'sub.py'
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/test_process.py:1191: KeyError
----------------------------- Captured stdout call -----------------------------
No data to combine
=============================== warnings summary ===============================
tests/test_plugins.py::GoodFileTracerTest::test_defer_to_python
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/coverage/control.py:553: CoverageWarning: Plugin file tracers (fairly_odd_plugin.Plugin) aren't supported with PyTracer
self._warn(
tests/test_plugins.py::GoodFileTracerTest::test_find_unexecuted
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/coverage/control.py:553: CoverageWarning: Plugin file tracers (unexecuted_plugin.Plugin) aren't supported with PyTracer
self._warn(
tests/test_plugins.py::GoodFileTracerTest::test_plugin2_with_xml_report
tests/test_plugins.py::GoodFileTracerTest::test_plugin2_with_html_report
tests/test_plugins.py::GoodFileTracerTest::test_plugin2_with_text_report
tests/test_plugins.py::GoodFileTracerTest::test_plugin2_with_branch
tests/test_plugins.py::GoodFileTracerTest::test_plugin2
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/coverage/control.py:553: CoverageWarning: Plugin file tracers (tests.plugin2.Plugin) aren't supported with PyTracer
self._warn(
tests/test_plugins.py::BadFileTracerTest::test_plugin_has_inherited_filereporter_method
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/coverage/control.py:553: CoverageWarning: Plugin file tracers (bad_plugin.Plugin) aren't supported with PyTracer
self._warn(
tests/test_plugins.py::GoodFileTracerTest::test_plugin1
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/coverage/control.py:553: CoverageWarning: Plugin file tracers (tests.plugin1.Plugin) aren't supported with PyTracer
self._warn(
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
SKIPPED [1] tests/test_arcs.py:1316: Match-case is new in 3.10
SKIPPED [1] tests/test_arcs.py:1363: Match-case is new in 3.10
SKIPPED [1] tests/test_arcs.py:1348: Match-case is new in 3.10
SKIPPED [1] tests/test_arcs.py:1332: Match-case is new in 3.10
SKIPPED [3] tests/test_concurrency.py:229: Can't test: Couldn't trace with concurrency=eventlet, the module isn't installed.
SKIPPED [2] tests/test_concurrency.py:229: Can't test: Couldn't trace with concurrency=greenlet, the module isn't installed.
SKIPPED [2] tests/test_concurrency.py:229: Can't test: Couldn't trace with concurrency=gevent, the module isn't installed.
SKIPPED [1] tests/test_concurrency.py:347: Can't run test without gevent installed.
SKIPPED [2] tests/test_concurrency.py:481: Can't test: Couldn't trace with concurrency=eventlet, the module isn't installed.
SKIPPED [1] tests/test_files.py:579: This test assumes Windows file system
SKIPPED [1] tests/test_files.py:691: Only need to run Windows tests on Windows.
SKIPPED [1] tests/test_oddball.py:210: This is too expensive for now (30s)
SKIPPED [1] tests/test_phystokens.py:119: Soft keywords are new in Python 3.10
SKIPPED [1] tests/test_parser.py:435: Match-case is new in 3.10
SKIPPED [1] tests/test_plugins.py:278: This test is only about PyTracer.
SKIPPED [1] tests/test_python.py:53: not windows
SKIPPED [1] tests/test_summary.py:787: .pyw files are only on Windows.
SKIPPED [1] tests/test_xml.py:482: trailing backslash is only for Windows
XFAIL tests/test_arcs.py::LoopArcTest::test_incorrect_if_bug_1175 - <3.10 traced final pass incorrectly
XFAIL tests/test_arcs.py::LoopArcTest::test_incorrect_loop_exit_bug_1175 - <3.10 traced final pass incorrectly
ERROR tests/test_venv.py::VirtualenvTest::test_third_party_venv_isnt_measured[coverage-True]
ERROR tests/test_venv.py::VirtualenvTest::test_third_party_venv_isnt_measured[coverage-False]
ERROR tests/test_venv.py::VirtualenvTest::test_third_party_venv_isnt_measured[python -m coverage-True]
ERROR tests/test_venv.py::VirtualenvTest::test_third_party_venv_isnt_measured[python -m coverage-False]
ERROR tests/test_venv.py::VirtualenvTest::test_us_in_venv_isnt_measured[coverage]
ERROR tests/test_venv.py::VirtualenvTest::test_us_in_venv_isnt_measured[python -m coverage]
ERROR tests/test_venv.py::VirtualenvTest::test_venv_isnt_measured[coverage]
ERROR tests/test_venv.py::VirtualenvTest::test_venv_isnt_measured[python -m coverage]
ERROR tests/test_venv.py::VirtualenvTest::test_venv_with_dynamic_plugin[coverage]
ERROR tests/test_venv.py::VirtualenvTest::test_venv_with_dynamic_plugin[python -m coverage]
ERROR tests/test_venv.py::VirtualenvTest::test_installed_namespace_packages[coverage]
ERROR tests/test_venv.py::VirtualenvTest::test_installed_namespace_packages[python -m coverage]
ERROR tests/test_venv.py::VirtualenvTest::test_bug_888[coverage] - assert 127...
ERROR tests/test_venv.py::VirtualenvTest::test_bug_888[python -m coverage] - ...
FAILED tests/test_cmdline.py::CmdLineStdoutTest::test_version - AssertionErro...
FAILED tests/test_debug.py::DebugTraceTest::test_debug_sys_ctracer - Assertio...
FAILED tests/test_filereporter.py::FileReporterTest::test_zipfile - ModuleNot...
FAILED tests/test_concurrency.py::SigtermTest::test_sigterm_threading_saves_data
FAILED tests/test_plugins.py::PluginTest::test_plugin_sys_info - AssertionErr...
FAILED tests/test_plugins.py::GoodFileTracerTest::test_defer_to_python - Asse...
FAILED tests/test_plugins.py::BadFileTracerTest::test_file_tracer_has_no_file_tracer_method
FAILED tests/test_plugins.py::BadFileTracerTest::test_has_dynamic_source_filename_fails
FAILED tests/test_plugins.py::GoodFileTracerTest::test_find_unexecuted - asse...
FAILED tests/test_plugins.py::BadFileTracerTest::test_line_number_range_raises_error
FAILED tests/test_plugins.py::BadFileTracerTest::test_file_tracer_returns_wrong
FAILED tests/test_plugins.py::BadFileTracerTest::test_dynamic_source_filename_fails
FAILED tests/test_plugins.py::BadFileTracerTest::test_line_number_range_returns_triple
FAILED tests/test_plugins.py::BadFileTracerTest::test_file_tracer_has_inherited_sourcefilename_method
FAILED tests/test_plugins.py::BadFileTracerTest::test_source_filename_returns_wrong
FAILED tests/test_plugins.py::BadFileTracerTest::test_file_tracer_fails_eventually
FAILED tests/test_plugins.py::BadFileTracerTest::test_file_tracer_fails - ass...
FAILED tests/test_plugins.py::BadFileTracerTest::test_line_number_range_returns_pair_of_strings
FAILED tests/test_plugins.py::GoodFileTracerTest::test_plugin2_with_xml_report
FAILED tests/test_plugins.py::BadFileTracerTest::test_source_filename_fails
FAILED tests/test_plugins.py::BadFileTracerTest::test_line_number_range_returns_non_tuple
FAILED tests/test_plugins.py::GoodFileTracerTest::test_plugin2_with_html_report
FAILED tests/test_plugins.py::GoodFileTracerTest::test_plugin2_with_text_report
FAILED tests/test_plugins.py::BadFileTracerTest::test_plugin_has_inherited_filereporter_method
FAILED tests/test_process.py::EnvironmentTest::test_coverage_zip_is_like_python
FAILED tests/test_plugins.py::GoodFileTracerTest::test_plugin1 - coverage.exc...
FAILED tests/test_process.py::ProcessStartupWithSourceTest::test_pth_and_source_work_together[main---m]
FAILED tests/test_plugins.py::GoodFileTracerTest::test_plugin2_with_branch - ...
FAILED tests/test_process.py::ProcessStartupWithSourceTest::test_pth_and_source_work_together[sub-pkg--m]
FAILED tests/test_process.py::ProcessStartupWithSourceTest::test_pth_and_source_work_together[sub--]
FAILED tests/test_plugins.py::GoodFileTracerTest::test_plugin2 - coverage.exc...
FAILED tests/test_process.py::ProcessStartupWithSourceTest::test_pth_and_source_work_together[sub---m]
FAILED tests/test_process.py::ProcessStartupWithSourceTest::test_pth_and_source_work_together[main--]
FAILED tests/test_process.py::ProcessStartupWithSourceTest::test_pth_and_source_work_together[sub-pkg-]
FAILED tests/test_summary.py::SummaryTest::test_report_just_one - ModuleNotFo...
FAILED tests/test_summary.py::SummaryTest::test_report_omitting - ModuleNotFo...
FAILED tests/test_process.py::ProcessStartupTest::test_subprocess_with_pth_files
FAILED tests/test_summary.py::SummaryTest::test_report - ModuleNotFoundError:...
FAILED tests/test_python.py::GetZipBytesTest::test_get_encoded_zip_files[utf-8]
FAILED tests/test_python.py::GetZipBytesTest::test_get_encoded_zip_files[gb2312]
FAILED tests/test_python.py::GetZipBytesTest::test_get_encoded_zip_files[hebrew]
FAILED tests/test_python.py::GetZipBytesTest::test_get_encoded_zip_files[shift_jis]
FAILED tests/test_summary.py::SummaryTest::test_report_include_relative_files_and_wildcard_path
FAILED tests/test_python.py::GetZipBytesTest::test_get_encoded_zip_files[cp1252]
FAILED tests/test_summary.py::SummaryTest::test_report_include_relative_files_and_path
FAILED tests/test_testing.py::test_xdist_sys_path_nuttiness_is_fixed - Assert...
FAILED tests/test_process.py::ProcessStartupWithSourceTest::test_pth_and_source_work_together[main-pkg-]
FAILED tests/test_process.py::ProcessStartupWithSourceTest::test_pth_and_source_work_together[main-pkg--m]
FAILED tests/test_process.py::ProcessTest::test_fullcoverage - AssertionError...
FAILED tests/test_summary.py::SummaryTest::test_report_including - ModuleNotF...
FAILED tests/test_process.py::ProcessTest::test_tests_dir_is_importable - ass...
FAILED tests/test_summary.py::SummaryTest::test_report_wildcard - AssertionEr...
FAILED tests/test_process.py::ProcessStartupTest::test_subprocess_with_pth_files_and_parallel
53 failed, 1249 passed, 23 skipped, 2 xfailed, 9 warnings, 14 errors in 14.96s |
BTW that issue pytest failing with INTERNALERROR if there is no .pth file in tested tree. |
Hmm .. why not embed those additional steps in pytest session scope? 🤔
Checked:
I have mirrored few other but I think that this covers most important distros 😄 So in other words .. it is really hard to have such problems like I'm reporting if for example on packaging is not executed test suite 😋
So what you suggesting in this case? 🤔 PS. Nevertheless .. thank you very much for your time and expertise. |
If your main issue is Without looking into it any further, it might not make sense to run all testcases downstream at all times. You can look at the testcases individually to see if they matter for your distribution.
|
Ah .. yes you are right 😞 [tkloczko@pers-jacek SPECS]$ ls -1 python-*|wc -l; grep %pytest python-* |wc -l
1134
1116 As you see I'm able to use pytest in +98% of all cases of all my already packaged python modules. This creates unique platform to perform additional mass control builds with altered build env by install additional pytest extensions env perform pytest tests without touching spec file. Such thing like above is not possible to have with tox .. |
In other words, you are rudely refusing to use a package the way the authors want you to. I don't want to deal with this. If you make a PR that makes the tests run with just pytest, I will review it. I am not going to do that work. |
Please try to have look on that from another angle:
Possible? 🤔 Issue is that pip and pypi provides only versions of modules served on pypi. If you will look again on my spec file you can find that I'm using not sdist file from pypi but tar ball autogenerated from VSC tag. With that I have 100% guarantee that I'll be able to add single line in spec file like
and push new package to build. [tkloczko@pers-jacek SPECS]$ ls -1 python-*|wc -l; grep Patch:.*%{VCS} python-* |wc -l
1134
601 Here how often I'm already using VCS tar balls in case of python modules packages. [tkloczko@pers-jacek SPECS]$ ls -1 python-*|wc -l; grep Source:.*%{VCS} -l python-* |wc -l
1134
1062 pip and pypi NEVER been designed to handle very quick fixes. Sadly we are living in not perfect world in which we are dealing with OBLY not-enough-testes-software. With full respect .. if someone will accept those conditions it is not matter of refusing something .. really. Look .. I'm IT eng with almost 3 decades long carrier and as almost last decade I've spent working as contractor I saw so many strange/fricking/bizarre cases that for me accepting those assumptions is result of that experience. And going back to I understand that our goals may look as orthogonal however at least it would be good to cooperate on those fields on which we are playing using the same bits .. only this and nothing more 😃 If you would agree that I would be able at least under this ticket drop time to time some updates for now it would be great. Sorry for such long comment .. EOT (if you will not have any other comments). |
Just FTR. + PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-7.2.7-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-7.2.7-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra -m 'not network'
bringing up nodes...
bringing up nodes...
........................................................................ [ 5%]
.....................................................s...sx............. [ 10%]
........s.........s...x.................................................. [ 15%]
................F....................................................... [ 21%]
...........................................................s....ss..s..s [ 26%]
.s.....ss..........s...s................................................ [ 31%]
......................................................................... [ 37%]
.............................................................F........... [ 42%]
........................................................................ [ 48%]
........F............................................................... [ 53%]
.......................................................................s [ 59%]
.....s.................................................................. [ 64%]
..........................................................s............. [ 69%]
....................s..s..F...F......s..FF.FF..F.FFFFF.FFF.FF.F.F.....F. [ 75%]
.F.FF....F.Fs....F....FF..F.F...........F.F.s.F.................F.....FF. [ 80%]
...........F............................................................ [ 85%]
............................F.....F......F..........F......F....F.....F. [ 91%]
.F.....................F............................E......E.s.EEF.E....F [ 96%]
............E....EE....E...E...EEEE.F......... [100%]
==================================== ERRORS ====================================
_ ERROR at setup of VirtualenvTest.test_third_party_venv_isnt_measured[coverage-True] _
[gw47] linux -- Python 3.8.16 /usr/bin/python3
tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-47/popen-gw47'), _trace=<pluggy._tracing.Tag...fa0>, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-47/popen-gw47'), _retention_count=3, _retention_policy='all')
@pytest.fixture(scope="session", name="venv_world")
def venv_world_fixture(tmp_path_factory: pytest.TempPathFactory) -> Path:
"""Create a virtualenv with a few test packages for VirtualenvTest to use.
Returns the directory containing the "venv" virtualenv.
"""
venv_world = tmp_path_factory.mktemp("venv_world")
with change_dir(venv_world):
# Create a virtualenv.
run_command("python -m venv venv")
# A third-party package that installs a few different packages.
make_file("third_pkg/third/__init__.py", """\
import fourth
def third(x):
return 3 * x
""")
# Use plugin2.py as third.plugin
with open(os.path.join(os.path.dirname(__file__), "plugin2.py")) as f:
make_file("third_pkg/third/plugin.py", f.read())
# A render function for plugin2 to use for dynamic file names.
make_file("third_pkg/third/render.py", """\
def render(filename, linenum):
return "HTML: {}@{}".format(filename, linenum)
""")
# Another package that third can use.
make_file("third_pkg/fourth/__init__.py", """\
def fourth(x):
return 4 * x
""")
# Some namespace packages.
make_file("third_pkg/nspkg/fifth/__init__.py", """\
def fifth(x):
return 5 * x
""")
# The setup.py to install everything.
make_file("third_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="third",
packages=["third", "fourth", "nspkg.fifth"],
)
""")
# Some namespace packages.
make_file("another_pkg/nspkg/sixth/__init__.py", """\
def sixth(x):
return 6 * x
""")
make_file("another_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="another",
packages=["nspkg.sixth"],
)
""")
# Bug888 code.
make_file("bug888/app/setup.py", """\
from setuptools import setup
setup(
name='testcov',
packages=['testcov'],
namespace_packages=['testcov'],
)
""")
make_file("bug888/app/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/app/testcov/main.py", """\
try: # pragma: no cover
entry_points = __import__("pkg_resources").iter_entry_points('plugins')
except ImportError: # pragma: no cover
import importlib.metadata
entry_points = importlib.metadata.entry_points(group="plugins")
for entry_point in entry_points:
entry_point.load()()
""")
make_file("bug888/plugin/setup.py", """\
from setuptools import setup
setup(
name='testcov-plugin',
packages=['testcov'],
namespace_packages=['testcov'],
entry_points={'plugins': ['testp = testcov.plugin:testp']},
)
""")
make_file("bug888/plugin/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/plugin/testcov/plugin.py", """\
def testp():
print("Plugin here")
""")
# Install everything.
> run_in_venv(
"python -m pip install " +
"./third_pkg " +
"-e ./another_pkg " +
"-e ./bug888/app -e ./bug888/plugin " +
COVERAGE_INSTALL_ARGS
)
tests/test_venv.py:149:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7'
def run_in_venv(cmd: str) -> str:
r"""Run `cmd` in the virtualenv at `venv`.
The first word of the command will be adjusted to run it from the
venv/bin or venv\Scripts directory.
Returns the text output of the command.
"""
words = cmd.split()
if env.WINDOWS:
words[0] = fr"venv\Scripts\{words[0]}.exe"
else:
words[0] = fr"venv/bin/{words[0]}"
status, output = run_command(" ".join(words))
# Print the output so if it fails, we can tell what happened.
print(output)
> assert status == 0
E assert 127 == 0
tests/test_venv.py:40: AssertionError
---------------------------- Captured stdout setup -----------------------------
/bin/sh: line 1: venv/bin/python: No such file or directory
_ ERROR at setup of VirtualenvTest.test_third_party_venv_isnt_measured[coverage-False] _
[gw47] linux -- Python 3.8.16 /usr/bin/python3
tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-47/popen-gw47'), _trace=<pluggy._tracing.Tag...fa0>, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-47/popen-gw47'), _retention_count=3, _retention_policy='all')
@pytest.fixture(scope="session", name="venv_world")
def venv_world_fixture(tmp_path_factory: pytest.TempPathFactory) -> Path:
"""Create a virtualenv with a few test packages for VirtualenvTest to use.
Returns the directory containing the "venv" virtualenv.
"""
venv_world = tmp_path_factory.mktemp("venv_world")
with change_dir(venv_world):
# Create a virtualenv.
run_command("python -m venv venv")
# A third-party package that installs a few different packages.
make_file("third_pkg/third/__init__.py", """\
import fourth
def third(x):
return 3 * x
""")
# Use plugin2.py as third.plugin
with open(os.path.join(os.path.dirname(__file__), "plugin2.py")) as f:
make_file("third_pkg/third/plugin.py", f.read())
# A render function for plugin2 to use for dynamic file names.
make_file("third_pkg/third/render.py", """\
def render(filename, linenum):
return "HTML: {}@{}".format(filename, linenum)
""")
# Another package that third can use.
make_file("third_pkg/fourth/__init__.py", """\
def fourth(x):
return 4 * x
""")
# Some namespace packages.
make_file("third_pkg/nspkg/fifth/__init__.py", """\
def fifth(x):
return 5 * x
""")
# The setup.py to install everything.
make_file("third_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="third",
packages=["third", "fourth", "nspkg.fifth"],
)
""")
# Some namespace packages.
make_file("another_pkg/nspkg/sixth/__init__.py", """\
def sixth(x):
return 6 * x
""")
make_file("another_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="another",
packages=["nspkg.sixth"],
)
""")
# Bug888 code.
make_file("bug888/app/setup.py", """\
from setuptools import setup
setup(
name='testcov',
packages=['testcov'],
namespace_packages=['testcov'],
)
""")
make_file("bug888/app/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/app/testcov/main.py", """\
try: # pragma: no cover
entry_points = __import__("pkg_resources").iter_entry_points('plugins')
except ImportError: # pragma: no cover
import importlib.metadata
entry_points = importlib.metadata.entry_points(group="plugins")
for entry_point in entry_points:
entry_point.load()()
""")
make_file("bug888/plugin/setup.py", """\
from setuptools import setup
setup(
name='testcov-plugin',
packages=['testcov'],
namespace_packages=['testcov'],
entry_points={'plugins': ['testp = testcov.plugin:testp']},
)
""")
make_file("bug888/plugin/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/plugin/testcov/plugin.py", """\
def testp():
print("Plugin here")
""")
# Install everything.
> run_in_venv(
"python -m pip install " +
"./third_pkg " +
"-e ./another_pkg " +
"-e ./bug888/app -e ./bug888/plugin " +
COVERAGE_INSTALL_ARGS
)
tests/test_venv.py:149:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7'
def run_in_venv(cmd: str) -> str:
r"""Run `cmd` in the virtualenv at `venv`.
The first word of the command will be adjusted to run it from the
venv/bin or venv\Scripts directory.
Returns the text output of the command.
"""
words = cmd.split()
if env.WINDOWS:
words[0] = fr"venv\Scripts\{words[0]}.exe"
else:
words[0] = fr"venv/bin/{words[0]}"
status, output = run_command(" ".join(words))
# Print the output so if it fails, we can tell what happened.
print(output)
> assert status == 0
E assert 127 == 0
tests/test_venv.py:40: AssertionError
_ ERROR at setup of VirtualenvTest.test_third_party_venv_isnt_measured[python -m coverage-True] _
[gw47] linux -- Python 3.8.16 /usr/bin/python3
tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-47/popen-gw47'), _trace=<pluggy._tracing.Tag...fa0>, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-47/popen-gw47'), _retention_count=3, _retention_policy='all')
@pytest.fixture(scope="session", name="venv_world")
def venv_world_fixture(tmp_path_factory: pytest.TempPathFactory) -> Path:
"""Create a virtualenv with a few test packages for VirtualenvTest to use.
Returns the directory containing the "venv" virtualenv.
"""
venv_world = tmp_path_factory.mktemp("venv_world")
with change_dir(venv_world):
# Create a virtualenv.
run_command("python -m venv venv")
# A third-party package that installs a few different packages.
make_file("third_pkg/third/__init__.py", """\
import fourth
def third(x):
return 3 * x
""")
# Use plugin2.py as third.plugin
with open(os.path.join(os.path.dirname(__file__), "plugin2.py")) as f:
make_file("third_pkg/third/plugin.py", f.read())
# A render function for plugin2 to use for dynamic file names.
make_file("third_pkg/third/render.py", """\
def render(filename, linenum):
return "HTML: {}@{}".format(filename, linenum)
""")
# Another package that third can use.
make_file("third_pkg/fourth/__init__.py", """\
def fourth(x):
return 4 * x
""")
# Some namespace packages.
make_file("third_pkg/nspkg/fifth/__init__.py", """\
def fifth(x):
return 5 * x
""")
# The setup.py to install everything.
make_file("third_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="third",
packages=["third", "fourth", "nspkg.fifth"],
)
""")
# Some namespace packages.
make_file("another_pkg/nspkg/sixth/__init__.py", """\
def sixth(x):
return 6 * x
""")
make_file("another_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="another",
packages=["nspkg.sixth"],
)
""")
# Bug888 code.
make_file("bug888/app/setup.py", """\
from setuptools import setup
setup(
name='testcov',
packages=['testcov'],
namespace_packages=['testcov'],
)
""")
make_file("bug888/app/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/app/testcov/main.py", """\
try: # pragma: no cover
entry_points = __import__("pkg_resources").iter_entry_points('plugins')
except ImportError: # pragma: no cover
import importlib.metadata
entry_points = importlib.metadata.entry_points(group="plugins")
for entry_point in entry_points:
entry_point.load()()
""")
make_file("bug888/plugin/setup.py", """\
from setuptools import setup
setup(
name='testcov-plugin',
packages=['testcov'],
namespace_packages=['testcov'],
entry_points={'plugins': ['testp = testcov.plugin:testp']},
)
""")
make_file("bug888/plugin/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/plugin/testcov/plugin.py", """\
def testp():
print("Plugin here")
""")
# Install everything.
> run_in_venv(
"python -m pip install " +
"./third_pkg " +
"-e ./another_pkg " +
"-e ./bug888/app -e ./bug888/plugin " +
COVERAGE_INSTALL_ARGS
)
tests/test_venv.py:149:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7'
def run_in_venv(cmd: str) -> str:
r"""Run `cmd` in the virtualenv at `venv`.
The first word of the command will be adjusted to run it from the
venv/bin or venv\Scripts directory.
Returns the text output of the command.
"""
words = cmd.split()
if env.WINDOWS:
words[0] = fr"venv\Scripts\{words[0]}.exe"
else:
words[0] = fr"venv/bin/{words[0]}"
status, output = run_command(" ".join(words))
# Print the output so if it fails, we can tell what happened.
print(output)
> assert status == 0
E assert 127 == 0
tests/test_venv.py:40: AssertionError
_ ERROR at setup of VirtualenvTest.test_third_party_venv_isnt_measured[python -m coverage-False] _
[gw47] linux -- Python 3.8.16 /usr/bin/python3
tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-47/popen-gw47'), _trace=<pluggy._tracing.Tag...fa0>, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-47/popen-gw47'), _retention_count=3, _retention_policy='all')
@pytest.fixture(scope="session", name="venv_world")
def venv_world_fixture(tmp_path_factory: pytest.TempPathFactory) -> Path:
"""Create a virtualenv with a few test packages for VirtualenvTest to use.
Returns the directory containing the "venv" virtualenv.
"""
venv_world = tmp_path_factory.mktemp("venv_world")
with change_dir(venv_world):
# Create a virtualenv.
run_command("python -m venv venv")
# A third-party package that installs a few different packages.
make_file("third_pkg/third/__init__.py", """\
import fourth
def third(x):
return 3 * x
""")
# Use plugin2.py as third.plugin
with open(os.path.join(os.path.dirname(__file__), "plugin2.py")) as f:
make_file("third_pkg/third/plugin.py", f.read())
# A render function for plugin2 to use for dynamic file names.
make_file("third_pkg/third/render.py", """\
def render(filename, linenum):
return "HTML: {}@{}".format(filename, linenum)
""")
# Another package that third can use.
make_file("third_pkg/fourth/__init__.py", """\
def fourth(x):
return 4 * x
""")
# Some namespace packages.
make_file("third_pkg/nspkg/fifth/__init__.py", """\
def fifth(x):
return 5 * x
""")
# The setup.py to install everything.
make_file("third_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="third",
packages=["third", "fourth", "nspkg.fifth"],
)
""")
# Some namespace packages.
make_file("another_pkg/nspkg/sixth/__init__.py", """\
def sixth(x):
return 6 * x
""")
make_file("another_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="another",
packages=["nspkg.sixth"],
)
""")
# Bug888 code.
make_file("bug888/app/setup.py", """\
from setuptools import setup
setup(
name='testcov',
packages=['testcov'],
namespace_packages=['testcov'],
)
""")
make_file("bug888/app/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/app/testcov/main.py", """\
try: # pragma: no cover
entry_points = __import__("pkg_resources").iter_entry_points('plugins')
except ImportError: # pragma: no cover
import importlib.metadata
entry_points = importlib.metadata.entry_points(group="plugins")
for entry_point in entry_points:
entry_point.load()()
""")
make_file("bug888/plugin/setup.py", """\
from setuptools import setup
setup(
name='testcov-plugin',
packages=['testcov'],
namespace_packages=['testcov'],
entry_points={'plugins': ['testp = testcov.plugin:testp']},
)
""")
make_file("bug888/plugin/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/plugin/testcov/plugin.py", """\
def testp():
print("Plugin here")
""")
# Install everything.
> run_in_venv(
"python -m pip install " +
"./third_pkg " +
"-e ./another_pkg " +
"-e ./bug888/app -e ./bug888/plugin " +
COVERAGE_INSTALL_ARGS
)
tests/test_venv.py:149:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7'
def run_in_venv(cmd: str) -> str:
r"""Run `cmd` in the virtualenv at `venv`.
The first word of the command will be adjusted to run it from the
venv/bin or venv\Scripts directory.
Returns the text output of the command.
"""
words = cmd.split()
if env.WINDOWS:
words[0] = fr"venv\Scripts\{words[0]}.exe"
else:
words[0] = fr"venv/bin/{words[0]}"
status, output = run_command(" ".join(words))
# Print the output so if it fails, we can tell what happened.
print(output)
> assert status == 0
E assert 127 == 0
tests/test_venv.py:40: AssertionError
___ ERROR at setup of VirtualenvTest.test_us_in_venv_isnt_measured[coverage] ___
[gw47] linux -- Python 3.8.16 /usr/bin/python3
tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-47/popen-gw47'), _trace=<pluggy._tracing.Tag...fa0>, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-47/popen-gw47'), _retention_count=3, _retention_policy='all')
@pytest.fixture(scope="session", name="venv_world")
def venv_world_fixture(tmp_path_factory: pytest.TempPathFactory) -> Path:
"""Create a virtualenv with a few test packages for VirtualenvTest to use.
Returns the directory containing the "venv" virtualenv.
"""
venv_world = tmp_path_factory.mktemp("venv_world")
with change_dir(venv_world):
# Create a virtualenv.
run_command("python -m venv venv")
# A third-party package that installs a few different packages.
make_file("third_pkg/third/__init__.py", """\
import fourth
def third(x):
return 3 * x
""")
# Use plugin2.py as third.plugin
with open(os.path.join(os.path.dirname(__file__), "plugin2.py")) as f:
make_file("third_pkg/third/plugin.py", f.read())
# A render function for plugin2 to use for dynamic file names.
make_file("third_pkg/third/render.py", """\
def render(filename, linenum):
return "HTML: {}@{}".format(filename, linenum)
""")
# Another package that third can use.
make_file("third_pkg/fourth/__init__.py", """\
def fourth(x):
return 4 * x
""")
# Some namespace packages.
make_file("third_pkg/nspkg/fifth/__init__.py", """\
def fifth(x):
return 5 * x
""")
# The setup.py to install everything.
make_file("third_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="third",
packages=["third", "fourth", "nspkg.fifth"],
)
""")
# Some namespace packages.
make_file("another_pkg/nspkg/sixth/__init__.py", """\
def sixth(x):
return 6 * x
""")
make_file("another_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="another",
packages=["nspkg.sixth"],
)
""")
# Bug888 code.
make_file("bug888/app/setup.py", """\
from setuptools import setup
setup(
name='testcov',
packages=['testcov'],
namespace_packages=['testcov'],
)
""")
make_file("bug888/app/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/app/testcov/main.py", """\
try: # pragma: no cover
entry_points = __import__("pkg_resources").iter_entry_points('plugins')
except ImportError: # pragma: no cover
import importlib.metadata
entry_points = importlib.metadata.entry_points(group="plugins")
for entry_point in entry_points:
entry_point.load()()
""")
make_file("bug888/plugin/setup.py", """\
from setuptools import setup
setup(
name='testcov-plugin',
packages=['testcov'],
namespace_packages=['testcov'],
entry_points={'plugins': ['testp = testcov.plugin:testp']},
)
""")
make_file("bug888/plugin/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/plugin/testcov/plugin.py", """\
def testp():
print("Plugin here")
""")
# Install everything.
> run_in_venv(
"python -m pip install " +
"./third_pkg " +
"-e ./another_pkg " +
"-e ./bug888/app -e ./bug888/plugin " +
COVERAGE_INSTALL_ARGS
)
tests/test_venv.py:149:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7'
def run_in_venv(cmd: str) -> str:
r"""Run `cmd` in the virtualenv at `venv`.
The first word of the command will be adjusted to run it from the
venv/bin or venv\Scripts directory.
Returns the text output of the command.
"""
words = cmd.split()
if env.WINDOWS:
words[0] = fr"venv\Scripts\{words[0]}.exe"
else:
words[0] = fr"venv/bin/{words[0]}"
status, output = run_command(" ".join(words))
# Print the output so if it fails, we can tell what happened.
print(output)
> assert status == 0
E assert 127 == 0
tests/test_venv.py:40: AssertionError
_ ERROR at setup of VirtualenvTest.test_us_in_venv_isnt_measured[python -m coverage] _
[gw47] linux -- Python 3.8.16 /usr/bin/python3
tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-47/popen-gw47'), _trace=<pluggy._tracing.Tag...fa0>, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-47/popen-gw47'), _retention_count=3, _retention_policy='all')
@pytest.fixture(scope="session", name="venv_world")
def venv_world_fixture(tmp_path_factory: pytest.TempPathFactory) -> Path:
"""Create a virtualenv with a few test packages for VirtualenvTest to use.
Returns the directory containing the "venv" virtualenv.
"""
venv_world = tmp_path_factory.mktemp("venv_world")
with change_dir(venv_world):
# Create a virtualenv.
run_command("python -m venv venv")
# A third-party package that installs a few different packages.
make_file("third_pkg/third/__init__.py", """\
import fourth
def third(x):
return 3 * x
""")
# Use plugin2.py as third.plugin
with open(os.path.join(os.path.dirname(__file__), "plugin2.py")) as f:
make_file("third_pkg/third/plugin.py", f.read())
# A render function for plugin2 to use for dynamic file names.
make_file("third_pkg/third/render.py", """\
def render(filename, linenum):
return "HTML: {}@{}".format(filename, linenum)
""")
# Another package that third can use.
make_file("third_pkg/fourth/__init__.py", """\
def fourth(x):
return 4 * x
""")
# Some namespace packages.
make_file("third_pkg/nspkg/fifth/__init__.py", """\
def fifth(x):
return 5 * x
""")
# The setup.py to install everything.
make_file("third_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="third",
packages=["third", "fourth", "nspkg.fifth"],
)
""")
# Some namespace packages.
make_file("another_pkg/nspkg/sixth/__init__.py", """\
def sixth(x):
return 6 * x
""")
make_file("another_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="another",
packages=["nspkg.sixth"],
)
""")
# Bug888 code.
make_file("bug888/app/setup.py", """\
from setuptools import setup
setup(
name='testcov',
packages=['testcov'],
namespace_packages=['testcov'],
)
""")
make_file("bug888/app/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/app/testcov/main.py", """\
try: # pragma: no cover
entry_points = __import__("pkg_resources").iter_entry_points('plugins')
except ImportError: # pragma: no cover
import importlib.metadata
entry_points = importlib.metadata.entry_points(group="plugins")
for entry_point in entry_points:
entry_point.load()()
""")
make_file("bug888/plugin/setup.py", """\
from setuptools import setup
setup(
name='testcov-plugin',
packages=['testcov'],
namespace_packages=['testcov'],
entry_points={'plugins': ['testp = testcov.plugin:testp']},
)
""")
make_file("bug888/plugin/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/plugin/testcov/plugin.py", """\
def testp():
print("Plugin here")
""")
# Install everything.
> run_in_venv(
"python -m pip install " +
"./third_pkg " +
"-e ./another_pkg " +
"-e ./bug888/app -e ./bug888/plugin " +
COVERAGE_INSTALL_ARGS
)
tests/test_venv.py:149:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7'
def run_in_venv(cmd: str) -> str:
r"""Run `cmd` in the virtualenv at `venv`.
The first word of the command will be adjusted to run it from the
venv/bin or venv\Scripts directory.
Returns the text output of the command.
"""
words = cmd.split()
if env.WINDOWS:
words[0] = fr"venv\Scripts\{words[0]}.exe"
else:
words[0] = fr"venv/bin/{words[0]}"
status, output = run_command(" ".join(words))
# Print the output so if it fails, we can tell what happened.
print(output)
> assert status == 0
E assert 127 == 0
tests/test_venv.py:40: AssertionError
______ ERROR at setup of VirtualenvTest.test_venv_isnt_measured[coverage] ______
[gw47] linux -- Python 3.8.16 /usr/bin/python3
tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-47/popen-gw47'), _trace=<pluggy._tracing.Tag...fa0>, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-47/popen-gw47'), _retention_count=3, _retention_policy='all')
@pytest.fixture(scope="session", name="venv_world")
def venv_world_fixture(tmp_path_factory: pytest.TempPathFactory) -> Path:
"""Create a virtualenv with a few test packages for VirtualenvTest to use.
Returns the directory containing the "venv" virtualenv.
"""
venv_world = tmp_path_factory.mktemp("venv_world")
with change_dir(venv_world):
# Create a virtualenv.
run_command("python -m venv venv")
# A third-party package that installs a few different packages.
make_file("third_pkg/third/__init__.py", """\
import fourth
def third(x):
return 3 * x
""")
# Use plugin2.py as third.plugin
with open(os.path.join(os.path.dirname(__file__), "plugin2.py")) as f:
make_file("third_pkg/third/plugin.py", f.read())
# A render function for plugin2 to use for dynamic file names.
make_file("third_pkg/third/render.py", """\
def render(filename, linenum):
return "HTML: {}@{}".format(filename, linenum)
""")
# Another package that third can use.
make_file("third_pkg/fourth/__init__.py", """\
def fourth(x):
return 4 * x
""")
# Some namespace packages.
make_file("third_pkg/nspkg/fifth/__init__.py", """\
def fifth(x):
return 5 * x
""")
# The setup.py to install everything.
make_file("third_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="third",
packages=["third", "fourth", "nspkg.fifth"],
)
""")
# Some namespace packages.
make_file("another_pkg/nspkg/sixth/__init__.py", """\
def sixth(x):
return 6 * x
""")
make_file("another_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="another",
packages=["nspkg.sixth"],
)
""")
# Bug888 code.
make_file("bug888/app/setup.py", """\
from setuptools import setup
setup(
name='testcov',
packages=['testcov'],
namespace_packages=['testcov'],
)
""")
make_file("bug888/app/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/app/testcov/main.py", """\
try: # pragma: no cover
entry_points = __import__("pkg_resources").iter_entry_points('plugins')
except ImportError: # pragma: no cover
import importlib.metadata
entry_points = importlib.metadata.entry_points(group="plugins")
for entry_point in entry_points:
entry_point.load()()
""")
make_file("bug888/plugin/setup.py", """\
from setuptools import setup
setup(
name='testcov-plugin',
packages=['testcov'],
namespace_packages=['testcov'],
entry_points={'plugins': ['testp = testcov.plugin:testp']},
)
""")
make_file("bug888/plugin/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/plugin/testcov/plugin.py", """\
def testp():
print("Plugin here")
""")
# Install everything.
> run_in_venv(
"python -m pip install " +
"./third_pkg " +
"-e ./another_pkg " +
"-e ./bug888/app -e ./bug888/plugin " +
COVERAGE_INSTALL_ARGS
)
tests/test_venv.py:149:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7'
def run_in_venv(cmd: str) -> str:
r"""Run `cmd` in the virtualenv at `venv`.
The first word of the command will be adjusted to run it from the
venv/bin or venv\Scripts directory.
Returns the text output of the command.
"""
words = cmd.split()
if env.WINDOWS:
words[0] = fr"venv\Scripts\{words[0]}.exe"
else:
words[0] = fr"venv/bin/{words[0]}"
status, output = run_command(" ".join(words))
# Print the output so if it fails, we can tell what happened.
print(output)
> assert status == 0
E assert 127 == 0
tests/test_venv.py:40: AssertionError
_ ERROR at setup of VirtualenvTest.test_venv_isnt_measured[python -m coverage] _
[gw47] linux -- Python 3.8.16 /usr/bin/python3
tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-47/popen-gw47'), _trace=<pluggy._tracing.Tag...fa0>, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-47/popen-gw47'), _retention_count=3, _retention_policy='all')
@pytest.fixture(scope="session", name="venv_world")
def venv_world_fixture(tmp_path_factory: pytest.TempPathFactory) -> Path:
"""Create a virtualenv with a few test packages for VirtualenvTest to use.
Returns the directory containing the "venv" virtualenv.
"""
venv_world = tmp_path_factory.mktemp("venv_world")
with change_dir(venv_world):
# Create a virtualenv.
run_command("python -m venv venv")
# A third-party package that installs a few different packages.
make_file("third_pkg/third/__init__.py", """\
import fourth
def third(x):
return 3 * x
""")
# Use plugin2.py as third.plugin
with open(os.path.join(os.path.dirname(__file__), "plugin2.py")) as f:
make_file("third_pkg/third/plugin.py", f.read())
# A render function for plugin2 to use for dynamic file names.
make_file("third_pkg/third/render.py", """\
def render(filename, linenum):
return "HTML: {}@{}".format(filename, linenum)
""")
# Another package that third can use.
make_file("third_pkg/fourth/__init__.py", """\
def fourth(x):
return 4 * x
""")
# Some namespace packages.
make_file("third_pkg/nspkg/fifth/__init__.py", """\
def fifth(x):
return 5 * x
""")
# The setup.py to install everything.
make_file("third_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="third",
packages=["third", "fourth", "nspkg.fifth"],
)
""")
# Some namespace packages.
make_file("another_pkg/nspkg/sixth/__init__.py", """\
def sixth(x):
return 6 * x
""")
make_file("another_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="another",
packages=["nspkg.sixth"],
)
""")
# Bug888 code.
make_file("bug888/app/setup.py", """\
from setuptools import setup
setup(
name='testcov',
packages=['testcov'],
namespace_packages=['testcov'],
)
""")
make_file("bug888/app/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/app/testcov/main.py", """\
try: # pragma: no cover
entry_points = __import__("pkg_resources").iter_entry_points('plugins')
except ImportError: # pragma: no cover
import importlib.metadata
entry_points = importlib.metadata.entry_points(group="plugins")
for entry_point in entry_points:
entry_point.load()()
""")
make_file("bug888/plugin/setup.py", """\
from setuptools import setup
setup(
name='testcov-plugin',
packages=['testcov'],
namespace_packages=['testcov'],
entry_points={'plugins': ['testp = testcov.plugin:testp']},
)
""")
make_file("bug888/plugin/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/plugin/testcov/plugin.py", """\
def testp():
print("Plugin here")
""")
# Install everything.
> run_in_venv(
"python -m pip install " +
"./third_pkg " +
"-e ./another_pkg " +
"-e ./bug888/app -e ./bug888/plugin " +
COVERAGE_INSTALL_ARGS
)
tests/test_venv.py:149:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7'
def run_in_venv(cmd: str) -> str:
r"""Run `cmd` in the virtualenv at `venv`.
The first word of the command will be adjusted to run it from the
venv/bin or venv\Scripts directory.
Returns the text output of the command.
"""
words = cmd.split()
if env.WINDOWS:
words[0] = fr"venv\Scripts\{words[0]}.exe"
else:
words[0] = fr"venv/bin/{words[0]}"
status, output = run_command(" ".join(words))
# Print the output so if it fails, we can tell what happened.
print(output)
> assert status == 0
E assert 127 == 0
tests/test_venv.py:40: AssertionError
___ ERROR at setup of VirtualenvTest.test_venv_with_dynamic_plugin[coverage] ___
[gw47] linux -- Python 3.8.16 /usr/bin/python3
tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-47/popen-gw47'), _trace=<pluggy._tracing.Tag...fa0>, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-47/popen-gw47'), _retention_count=3, _retention_policy='all')
@pytest.fixture(scope="session", name="venv_world")
def venv_world_fixture(tmp_path_factory: pytest.TempPathFactory) -> Path:
"""Create a virtualenv with a few test packages for VirtualenvTest to use.
Returns the directory containing the "venv" virtualenv.
"""
venv_world = tmp_path_factory.mktemp("venv_world")
with change_dir(venv_world):
# Create a virtualenv.
run_command("python -m venv venv")
# A third-party package that installs a few different packages.
make_file("third_pkg/third/__init__.py", """\
import fourth
def third(x):
return 3 * x
""")
# Use plugin2.py as third.plugin
with open(os.path.join(os.path.dirname(__file__), "plugin2.py")) as f:
make_file("third_pkg/third/plugin.py", f.read())
# A render function for plugin2 to use for dynamic file names.
make_file("third_pkg/third/render.py", """\
def render(filename, linenum):
return "HTML: {}@{}".format(filename, linenum)
""")
# Another package that third can use.
make_file("third_pkg/fourth/__init__.py", """\
def fourth(x):
return 4 * x
""")
# Some namespace packages.
make_file("third_pkg/nspkg/fifth/__init__.py", """\
def fifth(x):
return 5 * x
""")
# The setup.py to install everything.
make_file("third_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="third",
packages=["third", "fourth", "nspkg.fifth"],
)
""")
# Some namespace packages.
make_file("another_pkg/nspkg/sixth/__init__.py", """\
def sixth(x):
return 6 * x
""")
make_file("another_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="another",
packages=["nspkg.sixth"],
)
""")
# Bug888 code.
make_file("bug888/app/setup.py", """\
from setuptools import setup
setup(
name='testcov',
packages=['testcov'],
namespace_packages=['testcov'],
)
""")
make_file("bug888/app/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/app/testcov/main.py", """\
try: # pragma: no cover
entry_points = __import__("pkg_resources").iter_entry_points('plugins')
except ImportError: # pragma: no cover
import importlib.metadata
entry_points = importlib.metadata.entry_points(group="plugins")
for entry_point in entry_points:
entry_point.load()()
""")
make_file("bug888/plugin/setup.py", """\
from setuptools import setup
setup(
name='testcov-plugin',
packages=['testcov'],
namespace_packages=['testcov'],
entry_points={'plugins': ['testp = testcov.plugin:testp']},
)
""")
make_file("bug888/plugin/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/plugin/testcov/plugin.py", """\
def testp():
print("Plugin here")
""")
# Install everything.
> run_in_venv(
"python -m pip install " +
"./third_pkg " +
"-e ./another_pkg " +
"-e ./bug888/app -e ./bug888/plugin " +
COVERAGE_INSTALL_ARGS
)
tests/test_venv.py:149:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7'
def run_in_venv(cmd: str) -> str:
r"""Run `cmd` in the virtualenv at `venv`.
The first word of the command will be adjusted to run it from the
venv/bin or venv\Scripts directory.
Returns the text output of the command.
"""
words = cmd.split()
if env.WINDOWS:
words[0] = fr"venv\Scripts\{words[0]}.exe"
else:
words[0] = fr"venv/bin/{words[0]}"
status, output = run_command(" ".join(words))
# Print the output so if it fails, we can tell what happened.
print(output)
> assert status == 0
E assert 127 == 0
tests/test_venv.py:40: AssertionError
_ ERROR at setup of VirtualenvTest.test_venv_with_dynamic_plugin[python -m coverage] _
[gw47] linux -- Python 3.8.16 /usr/bin/python3
tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-47/popen-gw47'), _trace=<pluggy._tracing.Tag...fa0>, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-47/popen-gw47'), _retention_count=3, _retention_policy='all')
@pytest.fixture(scope="session", name="venv_world")
def venv_world_fixture(tmp_path_factory: pytest.TempPathFactory) -> Path:
"""Create a virtualenv with a few test packages for VirtualenvTest to use.
Returns the directory containing the "venv" virtualenv.
"""
venv_world = tmp_path_factory.mktemp("venv_world")
with change_dir(venv_world):
# Create a virtualenv.
run_command("python -m venv venv")
# A third-party package that installs a few different packages.
make_file("third_pkg/third/__init__.py", """\
import fourth
def third(x):
return 3 * x
""")
# Use plugin2.py as third.plugin
with open(os.path.join(os.path.dirname(__file__), "plugin2.py")) as f:
make_file("third_pkg/third/plugin.py", f.read())
# A render function for plugin2 to use for dynamic file names.
make_file("third_pkg/third/render.py", """\
def render(filename, linenum):
return "HTML: {}@{}".format(filename, linenum)
""")
# Another package that third can use.
make_file("third_pkg/fourth/__init__.py", """\
def fourth(x):
return 4 * x
""")
# Some namespace packages.
make_file("third_pkg/nspkg/fifth/__init__.py", """\
def fifth(x):
return 5 * x
""")
# The setup.py to install everything.
make_file("third_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="third",
packages=["third", "fourth", "nspkg.fifth"],
)
""")
# Some namespace packages.
make_file("another_pkg/nspkg/sixth/__init__.py", """\
def sixth(x):
return 6 * x
""")
make_file("another_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="another",
packages=["nspkg.sixth"],
)
""")
# Bug888 code.
make_file("bug888/app/setup.py", """\
from setuptools import setup
setup(
name='testcov',
packages=['testcov'],
namespace_packages=['testcov'],
)
""")
make_file("bug888/app/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/app/testcov/main.py", """\
try: # pragma: no cover
entry_points = __import__("pkg_resources").iter_entry_points('plugins')
except ImportError: # pragma: no cover
import importlib.metadata
entry_points = importlib.metadata.entry_points(group="plugins")
for entry_point in entry_points:
entry_point.load()()
""")
make_file("bug888/plugin/setup.py", """\
from setuptools import setup
setup(
name='testcov-plugin',
packages=['testcov'],
namespace_packages=['testcov'],
entry_points={'plugins': ['testp = testcov.plugin:testp']},
)
""")
make_file("bug888/plugin/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/plugin/testcov/plugin.py", """\
def testp():
print("Plugin here")
""")
# Install everything.
> run_in_venv(
"python -m pip install " +
"./third_pkg " +
"-e ./another_pkg " +
"-e ./bug888/app -e ./bug888/plugin " +
COVERAGE_INSTALL_ARGS
)
tests/test_venv.py:149:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7'
def run_in_venv(cmd: str) -> str:
r"""Run `cmd` in the virtualenv at `venv`.
The first word of the command will be adjusted to run it from the
venv/bin or venv\Scripts directory.
Returns the text output of the command.
"""
words = cmd.split()
if env.WINDOWS:
words[0] = fr"venv\Scripts\{words[0]}.exe"
else:
words[0] = fr"venv/bin/{words[0]}"
status, output = run_command(" ".join(words))
# Print the output so if it fails, we can tell what happened.
print(output)
> assert status == 0
E assert 127 == 0
tests/test_venv.py:40: AssertionError
_ ERROR at setup of VirtualenvTest.test_installed_namespace_packages[coverage] _
[gw47] linux -- Python 3.8.16 /usr/bin/python3
tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-47/popen-gw47'), _trace=<pluggy._tracing.Tag...fa0>, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-47/popen-gw47'), _retention_count=3, _retention_policy='all')
@pytest.fixture(scope="session", name="venv_world")
def venv_world_fixture(tmp_path_factory: pytest.TempPathFactory) -> Path:
"""Create a virtualenv with a few test packages for VirtualenvTest to use.
Returns the directory containing the "venv" virtualenv.
"""
venv_world = tmp_path_factory.mktemp("venv_world")
with change_dir(venv_world):
# Create a virtualenv.
run_command("python -m venv venv")
# A third-party package that installs a few different packages.
make_file("third_pkg/third/__init__.py", """\
import fourth
def third(x):
return 3 * x
""")
# Use plugin2.py as third.plugin
with open(os.path.join(os.path.dirname(__file__), "plugin2.py")) as f:
make_file("third_pkg/third/plugin.py", f.read())
# A render function for plugin2 to use for dynamic file names.
make_file("third_pkg/third/render.py", """\
def render(filename, linenum):
return "HTML: {}@{}".format(filename, linenum)
""")
# Another package that third can use.
make_file("third_pkg/fourth/__init__.py", """\
def fourth(x):
return 4 * x
""")
# Some namespace packages.
make_file("third_pkg/nspkg/fifth/__init__.py", """\
def fifth(x):
return 5 * x
""")
# The setup.py to install everything.
make_file("third_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="third",
packages=["third", "fourth", "nspkg.fifth"],
)
""")
# Some namespace packages.
make_file("another_pkg/nspkg/sixth/__init__.py", """\
def sixth(x):
return 6 * x
""")
make_file("another_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="another",
packages=["nspkg.sixth"],
)
""")
# Bug888 code.
make_file("bug888/app/setup.py", """\
from setuptools import setup
setup(
name='testcov',
packages=['testcov'],
namespace_packages=['testcov'],
)
""")
make_file("bug888/app/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/app/testcov/main.py", """\
try: # pragma: no cover
entry_points = __import__("pkg_resources").iter_entry_points('plugins')
except ImportError: # pragma: no cover
import importlib.metadata
entry_points = importlib.metadata.entry_points(group="plugins")
for entry_point in entry_points:
entry_point.load()()
""")
make_file("bug888/plugin/setup.py", """\
from setuptools import setup
setup(
name='testcov-plugin',
packages=['testcov'],
namespace_packages=['testcov'],
entry_points={'plugins': ['testp = testcov.plugin:testp']},
)
""")
make_file("bug888/plugin/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/plugin/testcov/plugin.py", """\
def testp():
print("Plugin here")
""")
# Install everything.
> run_in_venv(
"python -m pip install " +
"./third_pkg " +
"-e ./another_pkg " +
"-e ./bug888/app -e ./bug888/plugin " +
COVERAGE_INSTALL_ARGS
)
tests/test_venv.py:149:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7'
def run_in_venv(cmd: str) -> str:
r"""Run `cmd` in the virtualenv at `venv`.
The first word of the command will be adjusted to run it from the
venv/bin or venv\Scripts directory.
Returns the text output of the command.
"""
words = cmd.split()
if env.WINDOWS:
words[0] = fr"venv\Scripts\{words[0]}.exe"
else:
words[0] = fr"venv/bin/{words[0]}"
status, output = run_command(" ".join(words))
# Print the output so if it fails, we can tell what happened.
print(output)
> assert status == 0
E assert 127 == 0
tests/test_venv.py:40: AssertionError
_ ERROR at setup of VirtualenvTest.test_installed_namespace_packages[python -m coverage] _
[gw47] linux -- Python 3.8.16 /usr/bin/python3
tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-47/popen-gw47'), _trace=<pluggy._tracing.Tag...fa0>, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-47/popen-gw47'), _retention_count=3, _retention_policy='all')
@pytest.fixture(scope="session", name="venv_world")
def venv_world_fixture(tmp_path_factory: pytest.TempPathFactory) -> Path:
"""Create a virtualenv with a few test packages for VirtualenvTest to use.
Returns the directory containing the "venv" virtualenv.
"""
venv_world = tmp_path_factory.mktemp("venv_world")
with change_dir(venv_world):
# Create a virtualenv.
run_command("python -m venv venv")
# A third-party package that installs a few different packages.
make_file("third_pkg/third/__init__.py", """\
import fourth
def third(x):
return 3 * x
""")
# Use plugin2.py as third.plugin
with open(os.path.join(os.path.dirname(__file__), "plugin2.py")) as f:
make_file("third_pkg/third/plugin.py", f.read())
# A render function for plugin2 to use for dynamic file names.
make_file("third_pkg/third/render.py", """\
def render(filename, linenum):
return "HTML: {}@{}".format(filename, linenum)
""")
# Another package that third can use.
make_file("third_pkg/fourth/__init__.py", """\
def fourth(x):
return 4 * x
""")
# Some namespace packages.
make_file("third_pkg/nspkg/fifth/__init__.py", """\
def fifth(x):
return 5 * x
""")
# The setup.py to install everything.
make_file("third_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="third",
packages=["third", "fourth", "nspkg.fifth"],
)
""")
# Some namespace packages.
make_file("another_pkg/nspkg/sixth/__init__.py", """\
def sixth(x):
return 6 * x
""")
make_file("another_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="another",
packages=["nspkg.sixth"],
)
""")
# Bug888 code.
make_file("bug888/app/setup.py", """\
from setuptools import setup
setup(
name='testcov',
packages=['testcov'],
namespace_packages=['testcov'],
)
""")
make_file("bug888/app/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/app/testcov/main.py", """\
try: # pragma: no cover
entry_points = __import__("pkg_resources").iter_entry_points('plugins')
except ImportError: # pragma: no cover
import importlib.metadata
entry_points = importlib.metadata.entry_points(group="plugins")
for entry_point in entry_points:
entry_point.load()()
""")
make_file("bug888/plugin/setup.py", """\
from setuptools import setup
setup(
name='testcov-plugin',
packages=['testcov'],
namespace_packages=['testcov'],
entry_points={'plugins': ['testp = testcov.plugin:testp']},
)
""")
make_file("bug888/plugin/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/plugin/testcov/plugin.py", """\
def testp():
print("Plugin here")
""")
# Install everything.
> run_in_venv(
"python -m pip install " +
"./third_pkg " +
"-e ./another_pkg " +
"-e ./bug888/app -e ./bug888/plugin " +
COVERAGE_INSTALL_ARGS
)
tests/test_venv.py:149:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7'
def run_in_venv(cmd: str) -> str:
r"""Run `cmd` in the virtualenv at `venv`.
The first word of the command will be adjusted to run it from the
venv/bin or venv\Scripts directory.
Returns the text output of the command.
"""
words = cmd.split()
if env.WINDOWS:
words[0] = fr"venv\Scripts\{words[0]}.exe"
else:
words[0] = fr"venv/bin/{words[0]}"
status, output = run_command(" ".join(words))
# Print the output so if it fails, we can tell what happened.
print(output)
> assert status == 0
E assert 127 == 0
tests/test_venv.py:40: AssertionError
___________ ERROR at setup of VirtualenvTest.test_bug_888[coverage] ____________
[gw47] linux -- Python 3.8.16 /usr/bin/python3
tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-47/popen-gw47'), _trace=<pluggy._tracing.Tag...fa0>, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-47/popen-gw47'), _retention_count=3, _retention_policy='all')
@pytest.fixture(scope="session", name="venv_world")
def venv_world_fixture(tmp_path_factory: pytest.TempPathFactory) -> Path:
"""Create a virtualenv with a few test packages for VirtualenvTest to use.
Returns the directory containing the "venv" virtualenv.
"""
venv_world = tmp_path_factory.mktemp("venv_world")
with change_dir(venv_world):
# Create a virtualenv.
run_command("python -m venv venv")
# A third-party package that installs a few different packages.
make_file("third_pkg/third/__init__.py", """\
import fourth
def third(x):
return 3 * x
""")
# Use plugin2.py as third.plugin
with open(os.path.join(os.path.dirname(__file__), "plugin2.py")) as f:
make_file("third_pkg/third/plugin.py", f.read())
# A render function for plugin2 to use for dynamic file names.
make_file("third_pkg/third/render.py", """\
def render(filename, linenum):
return "HTML: {}@{}".format(filename, linenum)
""")
# Another package that third can use.
make_file("third_pkg/fourth/__init__.py", """\
def fourth(x):
return 4 * x
""")
# Some namespace packages.
make_file("third_pkg/nspkg/fifth/__init__.py", """\
def fifth(x):
return 5 * x
""")
# The setup.py to install everything.
make_file("third_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="third",
packages=["third", "fourth", "nspkg.fifth"],
)
""")
# Some namespace packages.
make_file("another_pkg/nspkg/sixth/__init__.py", """\
def sixth(x):
return 6 * x
""")
make_file("another_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="another",
packages=["nspkg.sixth"],
)
""")
# Bug888 code.
make_file("bug888/app/setup.py", """\
from setuptools import setup
setup(
name='testcov',
packages=['testcov'],
namespace_packages=['testcov'],
)
""")
make_file("bug888/app/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/app/testcov/main.py", """\
try: # pragma: no cover
entry_points = __import__("pkg_resources").iter_entry_points('plugins')
except ImportError: # pragma: no cover
import importlib.metadata
entry_points = importlib.metadata.entry_points(group="plugins")
for entry_point in entry_points:
entry_point.load()()
""")
make_file("bug888/plugin/setup.py", """\
from setuptools import setup
setup(
name='testcov-plugin',
packages=['testcov'],
namespace_packages=['testcov'],
entry_points={'plugins': ['testp = testcov.plugin:testp']},
)
""")
make_file("bug888/plugin/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/plugin/testcov/plugin.py", """\
def testp():
print("Plugin here")
""")
# Install everything.
> run_in_venv(
"python -m pip install " +
"./third_pkg " +
"-e ./another_pkg " +
"-e ./bug888/app -e ./bug888/plugin " +
COVERAGE_INSTALL_ARGS
)
tests/test_venv.py:149:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7'
def run_in_venv(cmd: str) -> str:
r"""Run `cmd` in the virtualenv at `venv`.
The first word of the command will be adjusted to run it from the
venv/bin or venv\Scripts directory.
Returns the text output of the command.
"""
words = cmd.split()
if env.WINDOWS:
words[0] = fr"venv\Scripts\{words[0]}.exe"
else:
words[0] = fr"venv/bin/{words[0]}"
status, output = run_command(" ".join(words))
# Print the output so if it fails, we can tell what happened.
print(output)
> assert status == 0
E assert 127 == 0
tests/test_venv.py:40: AssertionError
______ ERROR at setup of VirtualenvTest.test_bug_888[python -m coverage] _______
[gw47] linux -- Python 3.8.16 /usr/bin/python3
tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-47/popen-gw47'), _trace=<pluggy._tracing.Tag...fa0>, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-47/popen-gw47'), _retention_count=3, _retention_policy='all')
@pytest.fixture(scope="session", name="venv_world")
def venv_world_fixture(tmp_path_factory: pytest.TempPathFactory) -> Path:
"""Create a virtualenv with a few test packages for VirtualenvTest to use.
Returns the directory containing the "venv" virtualenv.
"""
venv_world = tmp_path_factory.mktemp("venv_world")
with change_dir(venv_world):
# Create a virtualenv.
run_command("python -m venv venv")
# A third-party package that installs a few different packages.
make_file("third_pkg/third/__init__.py", """\
import fourth
def third(x):
return 3 * x
""")
# Use plugin2.py as third.plugin
with open(os.path.join(os.path.dirname(__file__), "plugin2.py")) as f:
make_file("third_pkg/third/plugin.py", f.read())
# A render function for plugin2 to use for dynamic file names.
make_file("third_pkg/third/render.py", """\
def render(filename, linenum):
return "HTML: {}@{}".format(filename, linenum)
""")
# Another package that third can use.
make_file("third_pkg/fourth/__init__.py", """\
def fourth(x):
return 4 * x
""")
# Some namespace packages.
make_file("third_pkg/nspkg/fifth/__init__.py", """\
def fifth(x):
return 5 * x
""")
# The setup.py to install everything.
make_file("third_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="third",
packages=["third", "fourth", "nspkg.fifth"],
)
""")
# Some namespace packages.
make_file("another_pkg/nspkg/sixth/__init__.py", """\
def sixth(x):
return 6 * x
""")
make_file("another_pkg/setup.py", """\
import setuptools
setuptools.setup(
name="another",
packages=["nspkg.sixth"],
)
""")
# Bug888 code.
make_file("bug888/app/setup.py", """\
from setuptools import setup
setup(
name='testcov',
packages=['testcov'],
namespace_packages=['testcov'],
)
""")
make_file("bug888/app/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/app/testcov/main.py", """\
try: # pragma: no cover
entry_points = __import__("pkg_resources").iter_entry_points('plugins')
except ImportError: # pragma: no cover
import importlib.metadata
entry_points = importlib.metadata.entry_points(group="plugins")
for entry_point in entry_points:
entry_point.load()()
""")
make_file("bug888/plugin/setup.py", """\
from setuptools import setup
setup(
name='testcov-plugin',
packages=['testcov'],
namespace_packages=['testcov'],
entry_points={'plugins': ['testp = testcov.plugin:testp']},
)
""")
make_file("bug888/plugin/testcov/__init__.py", """\
try: # pragma: no cover
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
""")
make_file("bug888/plugin/testcov/plugin.py", """\
def testp():
print("Plugin here")
""")
# Install everything.
> run_in_venv(
"python -m pip install " +
"./third_pkg " +
"-e ./another_pkg " +
"-e ./bug888/app -e ./bug888/plugin " +
COVERAGE_INSTALL_ARGS
)
tests/test_venv.py:149:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7'
def run_in_venv(cmd: str) -> str:
r"""Run `cmd` in the virtualenv at `venv`.
The first word of the command will be adjusted to run it from the
venv/bin or venv\Scripts directory.
Returns the text output of the command.
"""
words = cmd.split()
if env.WINDOWS:
words[0] = fr"venv\Scripts\{words[0]}.exe"
else:
words[0] = fr"venv/bin/{words[0]}"
status, output = run_command(" ".join(words))
# Print the output so if it fails, we can tell what happened.
print(output)
> assert status == 0
E assert 127 == 0
tests/test_venv.py:40: AssertionError
=================================== FAILURES ===================================
________________________ CmdLineStdoutTest.test_version ________________________
[gw1] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_cmdline.CmdLineStdoutTest object at 0x7eff9e16d760>
def test_version(self) -> None:
self.command_line("--version")
out = self.stdout()
assert "ersion " in out
if env.C_TRACER:
> assert "with C extension" in out
E AssertionError: assert 'with C extension' in 'Coverage.py, version 7.2.7 without C extension\nFull documentation is at https://coverage.readthedocs.io/en/7.2.7\n'
tests/test_cmdline.py:1002: AssertionError
____________________ DebugTraceTest.test_debug_sys_ctracer _____________________
[gw5] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_debug.DebugTraceTest object at 0x7f0ddae85970>
def test_debug_sys_ctracer(self) -> None:
out_text = self.f1_debug_output(["sys"])
tracer_line = re_line(r"CTracer:", out_text).strip()
if env.C_TRACER:
expected = "CTracer: available"
else:
expected = "CTracer: unavailable"
> assert expected == tracer_line
E AssertionError: assert 'CTracer: available' == 'CTracer: unavailable'
E - CTracer: unavailable
E ? --
E + CTracer: available
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/test_debug.py:201: AssertionError
________________________ FileReporterTest.test_zipfile _________________________
[gw34] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_filereporter.FileReporterTest object at 0x7f0025fe62b0>
def test_zipfile(self) -> None:
sys.path.append("tests/zip1.zip")
# Test that we can get files out of zipfiles, and read their source files.
# The zip1 module is installed by an action in igor.py.
> import zip1
E ModuleNotFoundError: No module named 'zip1'
tests/test_filereporter.py:93: ModuleNotFoundError
___________________ GoodFileTracerTest.test_defer_to_python ____________________
[gw44] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_plugins.GoodFileTracerTest object at 0x7fc9f6f99e50>
def test_defer_to_python(self) -> None:
# A plugin that measures, but then wants built-in python reporting.
self.make_file("fairly_odd_plugin.py", """\
# A plugin that claims all the odd lines are executed, and none of
# the even lines, and then punts reporting off to the built-in
# Python reporting.
import coverage.plugin
class Plugin(coverage.CoveragePlugin):
def file_tracer(self, filename):
return OddTracer(filename)
def file_reporter(self, filename):
return "python"
class OddTracer(coverage.plugin.FileTracer):
def __init__(self, filename):
self.filename = filename
def source_filename(self):
return self.filename
def line_number_range(self, frame):
lineno = frame.f_lineno
if lineno % 2:
return (lineno, lineno)
else:
return (-1, -1)
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
self.make_file("unsuspecting.py", """\
a = 1
b = 2
c = 3
d = 4
e = 5
f = 6
""")
cov = coverage.Coverage(include=["unsuspecting.py"])
cov.set_option("run:plugins", ["fairly_odd_plugin"])
self.start_import_stop(cov, "unsuspecting")
repout = io.StringIO()
total = cov.report(file=repout, show_missing=True)
report = repout.getvalue().splitlines()
expected = [
'Name Stmts Miss Cover Missing',
'-----------------------------------------------',
'unsuspecting.py 6 3 50% 2, 4, 6',
'-----------------------------------------------',
'TOTAL 6 3 50%',
]
> assert expected == report
E AssertionError: assert ['Name ... 3 50%'] == ['Name ... 0 100%']
E At index 2 diff: 'unsuspecting.py 6 3 50% 2, 4, 6' != 'unsuspecting.py 6 0 100%'
E Use -v to get more diff
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/test_plugins.py:532: AssertionError
_______________________ PluginTest.test_plugin_sys_info ________________________
[gw36] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_plugins.PluginTest object at 0x7f13f0084a60>
def test_plugin_sys_info(self) -> None:
self.make_file("plugin_sys_info.py", """\
import coverage
class Plugin(coverage.CoveragePlugin):
def sys_info(self):
return [("hello", "world")]
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
debug_out = io.StringIO()
cov = coverage.Coverage(debug=["sys"])
cov._debug_file = debug_out
cov.set_option("run:plugins", ["plugin_sys_info"])
with swallow_warnings(
r"Plugin file tracers \(plugin_sys_info.Plugin\) aren't supported with PyTracer"
):
cov.start()
cov.stop() # pragma: nested
out_lines = [line.strip() for line in debug_out.getvalue().splitlines()]
if env.C_TRACER:
> assert 'plugins.file_tracers: plugin_sys_info.Plugin' in out_lines
E AssertionError: assert 'plugins.file_tracers: plugin_sys_info.Plugin' in ['-- sys -------------------------------------------------------', 'coverage_version: 7.2.7', 'coverage_module: /home/...init__.py', 'tracer: PyTracer', 'CTracer: unavailable', 'plugins.file_tracers: plugin_sys_info.Plugin (disabled)', ...]
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/test_plugins.py:216: AssertionError
_____________ BadFileTracerTest.test_file_tracer_fails_eventually ______________
[gw46] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_plugins.BadFileTracerTest object at 0x7f3766887460>
def test_file_tracer_fails_eventually(self) -> None:
# Django coverage plugin can report on a few files and then fail.
# https://github.com/nedbat/coveragepy/issues/1011
self.make_file("bad_plugin.py", """\
import os.path
import coverage.plugin
class Plugin(coverage.plugin.CoveragePlugin):
def __init__(self):
self.calls = 0
def file_tracer(self, filename):
print(filename)
self.calls += 1
if self.calls <= 2:
return FileTracer(filename)
else:
17/0 # Oh noes!
class FileTracer(coverage.FileTracer):
def __init__(self, filename):
self.filename = filename
def source_filename(self):
return os.path.basename(self.filename).replace(".py", ".foo")
def line_number_range(self, frame):
return -1, -1
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
> self.run_bad_plugin("bad_plugin", "Plugin")
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/test_plugins.py:764:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_plugins.BadFileTracerTest object at 0x7f3766887460>
module_name = 'bad_plugin', plugin_name = 'Plugin', our_error = True
excmsg = None, excmsgs = None
def run_bad_plugin(
self,
module_name: str,
plugin_name: str,
our_error: bool = True,
excmsg: Optional[str] = None,
excmsgs: Optional[List[str]] = None,
) -> None:
"""Run a file, and see that the plugin failed.
`module_name` and `plugin_name` is the module and name of the plugin to
use.
`our_error` is True if the error reported to the user will be an
explicit error in our test code, marked with an '# Oh noes!' comment.
`excmsg`, if provided, is text that must appear in the stderr.
`excmsgs`, if provided, is a list of messages, one of which must
appear in the stderr.
The plugin will be disabled, and we check that a warning is output
explaining why.
"""
with pytest.warns(Warning) as warns:
self.run_plugin(module_name)
stderr = self.stderr()
stderr += "".join(str(w.message) for w in warns)
if our_error:
# The exception we're causing should only appear once.
> assert stderr.count("# Oh noes!") == 1
E assert 0 == 1
E + where 0 = <built-in method count of str object at 0x7f3766604d30>('# Oh noes!')
E + where <built-in method count of str object at 0x7f3766604d30> = "Plugin file tracers (bad_plugin.Plugin) aren't supported with PyTracer".count
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/test_plugins.py:655: AssertionError
__________ BadFileTracerTest.test_line_number_range_returns_non_tuple __________
[gw32] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_plugins.BadFileTracerTest object at 0x7f6c263de550>
def test_line_number_range_returns_non_tuple(self) -> None:
self.make_file("bad_plugin.py", """\
import coverage.plugin
class Plugin(coverage.plugin.CoveragePlugin):
def file_tracer(self, filename):
if filename.endswith("other.py"):
return BadFileTracer()
class BadFileTracer(coverage.plugin.FileTracer):
def source_filename(self):
return "something.foo"
def line_number_range(self, frame):
return 42.23
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
> self.run_bad_plugin(
"bad_plugin", "Plugin", our_error=False, excmsg="line_number_range must return 2-tuple",
)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/test_plugins.py:895:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_plugins.BadFileTracerTest object at 0x7f6c263de550>
module_name = 'bad_plugin', plugin_name = 'Plugin', our_error = False
excmsg = 'line_number_range must return 2-tuple', excmsgs = None
def run_bad_plugin(
self,
module_name: str,
plugin_name: str,
our_error: bool = True,
excmsg: Optional[str] = None,
excmsgs: Optional[List[str]] = None,
) -> None:
"""Run a file, and see that the plugin failed.
`module_name` and `plugin_name` is the module and name of the plugin to
use.
`our_error` is True if the error reported to the user will be an
explicit error in our test code, marked with an '# Oh noes!' comment.
`excmsg`, if provided, is text that must appear in the stderr.
`excmsgs`, if provided, is a list of messages, one of which must
appear in the stderr.
The plugin will be disabled, and we check that a warning is output
explaining why.
"""
with pytest.warns(Warning) as warns:
self.run_plugin(module_name)
stderr = self.stderr()
stderr += "".join(str(w.message) for w in warns)
if our_error:
# The exception we're causing should only appear once.
assert stderr.count("# Oh noes!") == 1
# There should be a warning explaining what's happening, but only one.
# The message can be in two forms:
# Disabling plug-in '...' due to previous exception
# or:
# Disabling plug-in '...' due to an exception:
print([str(w) for w in warns.list])
warnings = [w for w in warns.list if issubclass(w.category, CoverageWarning)]
assert len(warnings) == 1
warnmsg = str(warnings[0].message)
> assert f"Disabling plug-in '{module_name}.{plugin_name}' due to " in warnmsg
E assert "Disabling plug-in 'bad_plugin.Plugin' due to " in "Plugin file tracers (bad_plugin.Plugin) aren't supported with PyTracer"
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/test_plugins.py:666: AssertionError
----------------------------- Captured stdout call -----------------------------
['{message : CoverageWarning("Plugin file tracers (bad_plugin.Plugin) aren\'t supported with PyTracer"), category : \'CoverageWarning\', filename : \'/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/coverage/control.py\', lineno : 555, line : None}']
_______ BadFileTracerTest.test_plugin_has_inherited_filereporter_method ________
[gw23] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_plugins.BadFileTracerTest object at 0x7f854e2c1220>
def test_plugin_has_inherited_filereporter_method(self) -> None:
self.make_file("bad_plugin.py", """\
import coverage
class Plugin(coverage.CoveragePlugin):
def file_tracer(self, filename):
# Just grab everything.
return FileTracer()
class FileTracer(coverage.FileTracer):
def source_filename(self):
return "foo.xxx"
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
cov = self.run_plugin("bad_plugin")
expected_msg = "Plugin 'bad_plugin.Plugin' needs to implement file_reporter()"
with pytest.raises(NotImplementedError, match=expected_msg):
> cov.report()
E Failed: DID NOT RAISE <class 'NotImplementedError'>
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/test_plugins.py:721: Failed
----------------------------- Captured stdout call -----------------------------
Name Stmts Miss Cover
--------------------------------
another.py 2 0 100%
other.py 2 0 100%
simple.py 5 0 100%
--------------------------------
TOTAL 9 0 100%
_________________ BadFileTracerTest.test_source_filename_fails _________________
[gw4] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_plugins.BadFileTracerTest object at 0x7fa105ca5850>
def test_source_filename_fails(self) -> None:
self.make_file("bad_plugin.py", """\
import coverage.plugin
class Plugin(coverage.plugin.CoveragePlugin):
def file_tracer(self, filename):
return BadFileTracer()
class BadFileTracer(coverage.plugin.FileTracer):
def source_filename(self):
42/0 # Oh noes!
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
> self.run_bad_plugin("bad_plugin", "Plugin")
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/test_plugins.py:810:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_plugins.BadFileTracerTest object at 0x7fa105ca5850>
module_name = 'bad_plugin', plugin_name = 'Plugin', our_error = True
excmsg = None, excmsgs = None
def run_bad_plugin(
self,
module_name: str,
plugin_name: str,
our_error: bool = True,
excmsg: Optional[str] = None,
excmsgs: Optional[List[str]] = None,
) -> None:
"""Run a file, and see that the plugin failed.
`module_name` and `plugin_name` is the module and name of the plugin to
use.
`our_error` is True if the error reported to the user will be an
explicit error in our test code, marked with an '# Oh noes!' comment.
`excmsg`, if provided, is text that must appear in the stderr.
`excmsgs`, if provided, is a list of messages, one of which must
appear in the stderr.
The plugin will be disabled, and we check that a warning is output
explaining why.
"""
with pytest.warns(Warning) as warns:
self.run_plugin(module_name)
stderr = self.stderr()
stderr += "".join(str(w.message) for w in warns)
if our_error:
# The exception we're causing should only appear once.
> assert stderr.count("# Oh noes!") == 1
E assert 0 == 1
E + where 0 = <built-in method count of str object at 0x7fa105863030>('# Oh noes!')
E + where <built-in method count of str object at 0x7fa105863030> = "Plugin file tracers (bad_plugin.Plugin) aren't supported with PyTracer".count
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/test_plugins.py:655: AssertionError
___________________ GoodFileTracerTest.test_find_unexecuted ____________________
[gw44] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_plugins.GoodFileTracerTest object at 0x7fc9f6f99d00>
def test_find_unexecuted(self) -> None:
self.make_file("unexecuted_plugin.py", """\
import os
import coverage.plugin
class Plugin(coverage.CoveragePlugin):
def file_tracer(self, filename):
if filename.endswith("foo.py"):
return MyTracer(filename)
def file_reporter(self, filename):
return MyReporter(filename)
def find_executable_files(self, src_dir):
# Check that src_dir is the right value
files = os.listdir(src_dir)
assert "foo.py" in files
assert "unexecuted_plugin.py" in files
return ["chimera.py"]
class MyTracer(coverage.plugin.FileTracer):
def __init__(self, filename):
self.filename = filename
def source_filename(self):
return self.filename
def line_number_range(self, frame):
return (999, 999)
class MyReporter(coverage.FileReporter):
def lines(self):
return {99, 999, 9999}
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
self.make_file("foo.py", "a = 1")
cov = coverage.Coverage(source=['.'])
cov.set_option("run:plugins", ["unexecuted_plugin"])
self.start_import_stop(cov, "foo")
# The file we executed claims to have run line 999.
_, statements, missing, _ = cov.analysis("foo.py")
> assert statements == [99, 999, 9999]
E assert [1] == [99, 999, 9999]
E At index 0 diff: 1 != 99
E Right contains 2 more items, first extra item: 999
E Use -v to get more diff
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/test_plugins.py:574: AssertionError
_____________ BadFileTracerTest.test_dynamic_source_filename_fails _____________
[gw21] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_plugins.BadFileTracerTest object at 0x7ffafa21aca0>
def test_dynamic_source_filename_fails(self) -> None:
self.make_file("bad_plugin.py", """\
import coverage.plugin
class Plugin(coverage.plugin.CoveragePlugin):
def file_tracer(self, filename):
if filename.endswith("other.py"):
return BadFileTracer()
class BadFileTracer(coverage.plugin.FileTracer):
def has_dynamic_source_filename(self):
return True
def dynamic_source_filename(self, filename, frame):
101/0 # Oh noes!
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
> self.run_bad_plugin("bad_plugin", "Plugin")
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/test_plugins.py:853:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_plugins.BadFileTracerTest object at 0x7ffafa21aca0>
module_name = 'bad_plugin', plugin_name = 'Plugin', our_error = True
excmsg = None, excmsgs = None
def run_bad_plugin(
self,
module_name: str,
plugin_name: str,
our_error: bool = True,
excmsg: Optional[str] = None,
excmsgs: Optional[List[str]] = None,
) -> None:
"""Run a file, and see that the plugin failed.
`module_name` and `plugin_name` is the module and name of the plugin to
use.
`our_error` is True if the error reported to the user will be an
explicit error in our test code, marked with an '# Oh noes!' comment.
`excmsg`, if provided, is text that must appear in the stderr.
`excmsgs`, if provided, is a list of messages, one of which must
appear in the stderr.
The plugin will be disabled, and we check that a warning is output
explaining why.
"""
with pytest.warns(Warning) as warns:
self.run_plugin(module_name)
stderr = self.stderr()
stderr += "".join(str(w.message) for w in warns)
if our_error:
# The exception we're causing should only appear once.
> assert stderr.count("# Oh noes!") == 1
E assert 0 == 1
E + where 0 = <built-in method count of str object at 0x7ffafa1c6030>('# Oh noes!')
E + where <built-in method count of str object at 0x7ffafa1c6030> = "Plugin file tracers (bad_plugin.Plugin) aren't supported with PyTracer".count
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/test_plugins.py:655: AssertionError
_______________ BadFileTracerTest.test_file_tracer_returns_wrong _______________
[gw18] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_plugins.BadFileTracerTest object at 0x7f6e1f0de640>
def test_file_tracer_returns_wrong(self) -> None:
self.make_file("bad_plugin.py", """\
import coverage.plugin
class Plugin(coverage.plugin.CoveragePlugin):
def file_tracer(self, filename):
return 3.14159
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
> self.run_bad_plugin(
"bad_plugin", "Plugin", our_error=False, excmsg="'float' object has no attribute",
)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/test_plugins.py:776:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_plugins.BadFileTracerTest object at 0x7f6e1f0de640>
module_name = 'bad_plugin', plugin_name = 'Plugin', our_error = False
excmsg = "'float' object has no attribute", excmsgs = None
def run_bad_plugin(
self,
module_name: str,
plugin_name: str,
our_error: bool = True,
excmsg: Optional[str] = None,
excmsgs: Optional[List[str]] = None,
) -> None:
"""Run a file, and see that the plugin failed.
`module_name` and `plugin_name` is the module and name of the plugin to
use.
`our_error` is True if the error reported to the user will be an
explicit error in our test code, marked with an '# Oh noes!' comment.
`excmsg`, if provided, is text that must appear in the stderr.
`excmsgs`, if provided, is a list of messages, one of which must
appear in the stderr.
The plugin will be disabled, and we check that a warning is output
explaining why.
"""
with pytest.warns(Warning) as warns:
self.run_plugin(module_name)
stderr = self.stderr()
stderr += "".join(str(w.message) for w in warns)
if our_error:
# The exception we're causing should only appear once.
assert stderr.count("# Oh noes!") == 1
# There should be a warning explaining what's happening, but only one.
# The message can be in two forms:
# Disabling plug-in '...' due to previous exception
# or:
# Disabling plug-in '...' due to an exception:
print([str(w) for w in warns.list])
warnings = [w for w in warns.list if issubclass(w.category, CoverageWarning)]
assert len(warnings) == 1
warnmsg = str(warnings[0].message)
> assert f"Disabling plug-in '{module_name}.{plugin_name}' due to " in warnmsg
E assert "Disabling plug-in 'bad_plugin.Plugin' due to " in "Plugin file tracers (bad_plugin.Plugin) aren't supported with PyTracer"
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/test_plugins.py:666: AssertionError
----------------------------- Captured stdout call -----------------------------
['{message : CoverageWarning("Plugin file tracers (bad_plugin.Plugin) aren\'t supported with PyTracer"), category : \'CoverageWarning\', filename : \'/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/coverage/control.py\', lineno : 555, line : None}']
____ BadFileTracerTest.test_file_tracer_has_inherited_sourcefilename_method ____
[gw31] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_plugins.BadFileTracerTest object at 0x7f609c16c2e0>
def test_file_tracer_has_inherited_sourcefilename_method(self) -> None:
self.make_file("bad_plugin.py", """\
import coverage
class Plugin(coverage.CoveragePlugin):
def file_tracer(self, filename):
# Just grab everything.
return FileTracer()
class FileTracer(coverage.FileTracer):
pass
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
> self.run_bad_plugin(
"bad_plugin", "Plugin", our_error=False,
excmsg="Class 'bad_plugin.FileTracer' needs to implement source_filename()",
)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/test_plugins.py:698:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_plugins.BadFileTracerTest object at 0x7f609c16c2e0>
module_name = 'bad_plugin', plugin_name = 'Plugin', our_error = False
excmsg = "Class 'bad_plugin.FileTracer' needs to implement source_filename()"
excmsgs = None
def run_bad_plugin(
self,
module_name: str,
plugin_name: str,
our_error: bool = True,
excmsg: Optional[str] = None,
excmsgs: Optional[List[str]] = None,
) -> None:
"""Run a file, and see that the plugin failed.
`module_name` and `plugin_name` is the module and name of the plugin to
use.
`our_error` is True if the error reported to the user will be an
explicit error in our test code, marked with an '# Oh noes!' comment.
`excmsg`, if provided, is text that must appear in the stderr.
`excmsgs`, if provided, is a list of messages, one of which must
appear in the stderr.
The plugin will be disabled, and we check that a warning is output
explaining why.
"""
with pytest.warns(Warning) as warns:
self.run_plugin(module_name)
stderr = self.stderr()
stderr += "".join(str(w.message) for w in warns)
if our_error:
# The exception we're causing should only appear once.
assert stderr.count("# Oh noes!") == 1
# There should be a warning explaining what's happening, but only one.
# The message can be in two forms:
# Disabling plug-in '...' due to previous exception
# or:
# Disabling plug-in '...' due to an exception:
print([str(w) for w in warns.list])
warnings = [w for w in warns.list if issubclass(w.category, CoverageWarning)]
assert len(warnings) == 1
warnmsg = str(warnings[0].message)
> assert f"Disabling plug-in '{module_name}.{plugin_name}' due to " in warnmsg
E assert "Disabling plug-in 'bad_plugin.Plugin' due to " in "Plugin file tracers (bad_plugin.Plugin) aren't supported with PyTracer"
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/test_plugins.py:666: AssertionError
----------------------------- Captured stdout call -----------------------------
['{message : CoverageWarning("Plugin file tracers (bad_plugin.Plugin) aren\'t supported with PyTracer"), category : \'CoverageWarning\', filename : \'/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/coverage/control.py\', lineno : 555, line : None}']
____________ BadFileTracerTest.test_line_number_range_raises_error _____________
[gw47] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_plugins.BadFileTracerTest object at 0x7fbb49c60f10>
def test_line_number_range_raises_error(self) -> None:
self.make_file("bad_plugin.py", """\
import coverage.plugin
class Plugin(coverage.plugin.CoveragePlugin):
def file_tracer(self, filename):
if filename.endswith("other.py"):
return BadFileTracer()
class BadFileTracer(coverage.plugin.FileTracer):
def source_filename(self):
return "something.foo"
def line_number_range(self, frame):
raise Exception("borked!")
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
> self.run_bad_plugin(
"bad_plugin", "Plugin", our_error=False, excmsg="borked!",
)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/test_plugins.py:873:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_plugins.BadFileTracerTest object at 0x7fbb49c60f10>
module_name = 'bad_plugin', plugin_name = 'Plugin', our_error = False
excmsg = 'borked!', excmsgs = None
def run_bad_plugin(
self,
module_name: str,
plugin_name: str,
our_error: bool = True,
excmsg: Optional[str] = None,
excmsgs: Optional[List[str]] = None,
) -> None:
"""Run a file, and see that the plugin failed.
`module_name` and `plugin_name` is the module and name of the plugin to
use.
`our_error` is True if the error reported to the user will be an
explicit error in our test code, marked with an '# Oh noes!' comment.
`excmsg`, if provided, is text that must appear in the stderr.
`excmsgs`, if provided, is a list of messages, one of which must
appear in the stderr.
The plugin will be disabled, and we check that a warning is output
explaining why.
"""
with pytest.warns(Warning) as warns:
self.run_plugin(module_name)
stderr = self.stderr()
stderr += "".join(str(w.message) for w in warns)
if our_error:
# The exception we're causing should only appear once.
assert stderr.count("# Oh noes!") == 1
# There should be a warning explaining what's happening, but only one.
# The message can be in two forms:
# Disabling plug-in '...' due to previous exception
# or:
# Disabling plug-in '...' due to an exception:
print([str(w) for w in warns.list])
warnings = [w for w in warns.list if issubclass(w.category, CoverageWarning)]
assert len(warnings) == 1
warnmsg = str(warnings[0].message)
> assert f"Disabling plug-in '{module_name}.{plugin_name}' due to " in warnmsg
E assert "Disabling plug-in 'bad_plugin.Plugin' due to " in "Plugin file tracers (bad_plugin.Plugin) aren't supported with PyTracer"
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/test_plugins.py:666: AssertionError
----------------------------- Captured stdout call -----------------------------
['{message : CoverageWarning("Plugin file tracers (bad_plugin.Plugin) aren\'t supported with PyTracer"), category : \'CoverageWarning\', filename : \'/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/coverage/control.py\', lineno : 555, line : None}']
_______________ GoodFileTracerTest.test_plugin2_with_text_report _______________
[gw30] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_plugins.GoodFileTracerTest object at 0x7ff08829f310>
def test_plugin2_with_text_report(self) -> None:
self.make_render_and_caller()
cov = coverage.Coverage(branch=True, omit=["*quux*"])
cov.set_option("run:plugins", ["tests.plugin2"])
self.start_import_stop(cov, "caller")
repout = io.StringIO()
> total = cov.report(file=repout, include=["*.html"], omit=["uni*.html"], show_missing=True)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/test_plugins.py:423:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/coverage/control.py:1061: in report
return reporter.report(morfs, outfile=file)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/coverage/report.py:181: in report
for fr, analysis in get_analysis_to_report(self.coverage, morfs):
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
coverage = <coverage.control.Coverage object at 0x7ff08033ca00>, morfs = None
def get_analysis_to_report(
coverage: Coverage,
morfs: Optional[Iterable[TMorf]],
) -> Iterator[Tuple[FileReporter, Analysis]]:
"""Get the files to report on.
For each morf in `morfs`, if it should be reported on (based on the omit
and include configuration options), yield a pair, the `FileReporter` and
`Analysis` for the morf.
"""
file_reporters = coverage._get_file_reporters(morfs)
config = coverage.config
if config.report_include:
matcher = GlobMatcher(prep_patterns(config.report_include), "report_include")
file_reporters = [fr for fr in file_reporters if matcher.match(fr.filename)]
if config.report_omit:
matcher = GlobMatcher(prep_patterns(config.report_omit), "report_omit")
file_reporters = [fr for fr in file_reporters if not matcher.match(fr.filename)]
if not file_reporters:
> raise NoDataError("No data to report.")
E coverage.exceptions.NoDataError: No data to report.
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/coverage/report_core.py:94: NoDataError
_____________ BadFileTracerTest.test_source_filename_returns_wrong _____________
[gw20] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_plugins.BadFileTracerTest object at 0x7fc252a8bd30>
def test_source_filename_returns_wrong(self) -> None:
self.make_file("bad_plugin.py", """\
import coverage.plugin
class Plugin(coverage.plugin.CoveragePlugin):
def file_tracer(self, filename):
return BadFileTracer()
class BadFileTracer(coverage.plugin.FileTracer):
def source_filename(self):
return 17.3
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
> self.run_bad_plugin(
"bad_plugin", "Plugin", our_error=False,
excmsgs=[
"expected str, bytes or os.PathLike object, not float",
"'float' object has no attribute",
"object of type 'float' has no len()",
"'float' object is unsubscriptable",
],
)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/test_plugins.py:826:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_plugins.BadFileTracerTest object at 0x7fc252a8bd30>
module_name = 'bad_plugin', plugin_name = 'Plugin', our_error = False
excmsg = None
excmsgs = ['expected str, bytes or os.PathLike object, not float', "'float' object has no attribute", "object of type 'float' has no len()", "'float' object is unsubscriptable"]
def run_bad_plugin(
self,
module_name: str,
plugin_name: str,
our_error: bool = True,
excmsg: Optional[str] = None,
excmsgs: Optional[List[str]] = None,
) -> None:
"""Run a file, and see that the plugin failed.
`module_name` and `plugin_name` is the module and name of the plugin to
use.
`our_error` is True if the error reported to the user will be an
explicit error in our test code, marked with an '# Oh noes!' comment.
`excmsg`, if provided, is text that must appear in the stderr.
`excmsgs`, if provided, is a list of messages, one of which must
appear in the stderr.
The plugin will be disabled, and we check that a warning is output
explaining why.
"""
with pytest.warns(Warning) as warns:
self.run_plugin(module_name)
stderr = self.stderr()
stderr += "".join(str(w.message) for w in warns)
if our_error:
# The exception we're causing should only appear once.
assert stderr.count("# Oh noes!") == 1
# There should be a warning explaining what's happening, but only one.
# The message can be in two forms:
# Disabling plug-in '...' due to previous exception
# or:
# Disabling plug-in '...' due to an exception:
print([str(w) for w in warns.list])
warnings = [w for w in warns.list if issubclass(w.category, CoverageWarning)]
assert len(warnings) == 1
warnmsg = str(warnings[0].message)
> assert f"Disabling plug-in '{module_name}.{plugin_name}' due to " in warnmsg
E assert "Disabling plug-in 'bad_plugin.Plugin' due to " in "Plugin file tracers (bad_plugin.Plugin) aren't supported with PyTracer"
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/test_plugins.py:666: AssertionError
----------------------------- Captured stdout call -----------------------------
['{message : CoverageWarning("Plugin file tracers (bad_plugin.Plugin) aren\'t supported with PyTracer"), category : \'CoverageWarning\', filename : \'/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/coverage/control.py\', lineno : 555, line : None}']
___________ BadFileTracerTest.test_line_number_range_returns_triple ____________
[gw19] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_plugins.BadFileTracerTest object at 0x7f3b8dac6910>
def test_line_number_range_returns_triple(self) -> None:
self.make_file("bad_plugin.py", """\
import coverage.plugin
class Plugin(coverage.plugin.CoveragePlugin):
def file_tracer(self, filename):
if filename.endswith("other.py"):
return BadFileTracer()
class BadFileTracer(coverage.plugin.FileTracer):
def source_filename(self):
return "something.foo"
def line_number_range(self, frame):
return (1, 2, 3)
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
> self.run_bad_plugin(
"bad_plugin", "Plugin", our_error=False, excmsg="line_number_range must return 2-tuple",
)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/test_plugins.py:917:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_plugins.BadFileTracerTest object at 0x7f3b8dac6910>
module_name = 'bad_plugin', plugin_name = 'Plugin', our_error = False
excmsg = 'line_number_range must return 2-tuple', excmsgs = None
def run_bad_plugin(
self,
module_name: str,
plugin_name: str,
our_error: bool = True,
excmsg: Optional[str] = None,
excmsgs: Optional[List[str]] = None,
) -> None:
"""Run a file, and see that the plugin failed.
`module_name` and `plugin_name` is the module and name of the plugin to
use.
`our_error` is True if the error reported to the user will be an
explicit error in our test code, marked with an '# Oh noes!' comment.
`excmsg`, if provided, is text that must appear in the stderr.
`excmsgs`, if provided, is a list of messages, one of which must
appear in the stderr.
The plugin will be disabled, and we check that a warning is output
explaining why.
"""
with pytest.warns(Warning) as warns:
self.run_plugin(module_name)
stderr = self.stderr()
stderr += "".join(str(w.message) for w in warns)
if our_error:
# The exception we're causing should only appear once.
assert stderr.count("# Oh noes!") == 1
# There should be a warning explaining what's happening, but only one.
# The message can be in two forms:
# Disabling plug-in '...' due to previous exception
# or:
# Disabling plug-in '...' due to an exception:
print([str(w) for w in warns.list])
warnings = [w for w in warns.list if issubclass(w.category, CoverageWarning)]
assert len(warnings) == 1
warnmsg = str(warnings[0].message)
> assert f"Disabling plug-in '{module_name}.{plugin_name}' due to " in warnmsg
E assert "Disabling plug-in 'bad_plugin.Plugin' due to " in "Plugin file tracers (bad_plugin.Plugin) aren't supported with PyTracer"
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/test_plugins.py:666: AssertionError
----------------------------- Captured stdout call -----------------------------
['{message : CoverageWarning("Plugin file tracers (bad_plugin.Plugin) aren\'t supported with PyTracer"), category : \'CoverageWarning\', filename : \'/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/coverage/control.py\', lineno : 555, line : None}']
___________________ BadFileTracerTest.test_file_tracer_fails ___________________
[gw35] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_plugins.BadFileTracerTest object at 0x7f970556d340>
def test_file_tracer_fails(self) -> None:
self.make_file("bad_plugin.py", """\
import coverage.plugin
class Plugin(coverage.plugin.CoveragePlugin):
def file_tracer(self, filename):
17/0 # Oh noes!
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
> self.run_bad_plugin("bad_plugin", "Plugin")
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/test_plugins.py:733:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_plugins.BadFileTracerTest object at 0x7f970556d340>
module_name = 'bad_plugin', plugin_name = 'Plugin', our_error = True
excmsg = None, excmsgs = None
def run_bad_plugin(
self,
module_name: str,
plugin_name: str,
our_error: bool = True,
excmsg: Optional[str] = None,
excmsgs: Optional[List[str]] = None,
) -> None:
"""Run a file, and see that the plugin failed.
`module_name` and `plugin_name` is the module and name of the plugin to
use.
`our_error` is True if the error reported to the user will be an
explicit error in our test code, marked with an '# Oh noes!' comment.
`excmsg`, if provided, is text that must appear in the stderr.
`excmsgs`, if provided, is a list of messages, one of which must
appear in the stderr.
The plugin will be disabled, and we check that a warning is output
explaining why.
"""
with pytest.warns(Warning) as warns:
self.run_plugin(module_name)
stderr = self.stderr()
stderr += "".join(str(w.message) for w in warns)
if our_error:
# The exception we're causing should only appear once.
> assert stderr.count("# Oh noes!") == 1
E assert 0 == 1
E + where 0 = <built-in method count of str object at 0x7f970532dc30>('# Oh noes!')
E + where <built-in method count of str object at 0x7f970532dc30> = "Plugin file tracers (bad_plugin.Plugin) aren't supported with PyTracer".count
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/test_plugins.py:655: AssertionError
_________ BadFileTracerTest.test_file_tracer_has_no_file_tracer_method _________
[gw1] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_plugins.BadFileTracerTest object at 0x7eff9dae15e0>
def test_file_tracer_has_no_file_tracer_method(self) -> None:
self.make_file("bad_plugin.py", """\
class Plugin(object):
pass
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
> self.run_bad_plugin("bad_plugin", "Plugin", our_error=False)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/test_plugins.py:682:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_plugins.BadFileTracerTest object at 0x7eff9dae15e0>
module_name = 'bad_plugin', plugin_name = 'Plugin', our_error = False
excmsg = None, excmsgs = None
def run_bad_plugin(
self,
module_name: str,
plugin_name: str,
our_error: bool = True,
excmsg: Optional[str] = None,
excmsgs: Optional[List[str]] = None,
) -> None:
"""Run a file, and see that the plugin failed.
`module_name` and `plugin_name` is the module and name of the plugin to
use.
`our_error` is True if the error reported to the user will be an
explicit error in our test code, marked with an '# Oh noes!' comment.
`excmsg`, if provided, is text that must appear in the stderr.
`excmsgs`, if provided, is a list of messages, one of which must
appear in the stderr.
The plugin will be disabled, and we check that a warning is output
explaining why.
"""
with pytest.warns(Warning) as warns:
self.run_plugin(module_name)
stderr = self.stderr()
stderr += "".join(str(w.message) for w in warns)
if our_error:
# The exception we're causing should only appear once.
assert stderr.count("# Oh noes!") == 1
# There should be a warning explaining what's happening, but only one.
# The message can be in two forms:
# Disabling plug-in '...' due to previous exception
# or:
# Disabling plug-in '...' due to an exception:
print([str(w) for w in warns.list])
warnings = [w for w in warns.list if issubclass(w.category, CoverageWarning)]
assert len(warnings) == 1
warnmsg = str(warnings[0].message)
> assert f"Disabling plug-in '{module_name}.{plugin_name}' due to " in warnmsg
E assert "Disabling plug-in 'bad_plugin.Plugin' due to " in "Plugin file tracers (bad_plugin.Plugin) aren't supported with PyTracer"
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/test_plugins.py:666: AssertionError
----------------------------- Captured stdout call -----------------------------
['{message : CoverageWarning("Plugin file tracers (bad_plugin.Plugin) aren\'t supported with PyTracer"), category : \'CoverageWarning\', filename : \'/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/coverage/control.py\', lineno : 555, line : None}']
_______________ GoodFileTracerTest.test_plugin2_with_xml_report ________________
[gw5] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_plugins.GoodFileTracerTest object at 0x7f0dda66eca0>
def test_plugin2_with_xml_report(self) -> None:
self.make_render_and_caller()
cov = coverage.Coverage(branch=True, omit=["*quux*"])
cov.set_option("run:plugins", ["tests.plugin2"])
self.start_import_stop(cov, "caller")
> total = cov.xml_report(include=["*.html"], omit=["uni*.html"])
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/test_plugins.py:459:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/coverage/control.py:1192: in xml_report
return render_report(self.config.xml_output, XmlReporter(self), morfs, self._message)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/coverage/report_core.py:59: in render_report
ret = reporter.report(morfs, outfile=outfile)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/coverage/xmlreport.py:105: in report
for fr, analysis in get_analysis_to_report(self.coverage, morfs):
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
coverage = <coverage.control.Coverage object at 0x7f0dda3f3ac0>, morfs = None
def get_analysis_to_report(
coverage: Coverage,
morfs: Optional[Iterable[TMorf]],
) -> Iterator[Tuple[FileReporter, Analysis]]:
"""Get the files to report on.
For each morf in `morfs`, if it should be reported on (based on the omit
and include configuration options), yield a pair, the `FileReporter` and
`Analysis` for the morf.
"""
file_reporters = coverage._get_file_reporters(morfs)
config = coverage.config
if config.report_include:
matcher = GlobMatcher(prep_patterns(config.report_include), "report_include")
file_reporters = [fr for fr in file_reporters if matcher.match(fr.filename)]
if config.report_omit:
matcher = GlobMatcher(prep_patterns(config.report_omit), "report_omit")
file_reporters = [fr for fr in file_reporters if not matcher.match(fr.filename)]
if not file_reporters:
> raise NoDataError("No data to report.")
E coverage.exceptions.NoDataError: No data to report.
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/coverage/report_core.py:94: NoDataError
___________ BadFileTracerTest.test_has_dynamic_source_filename_fails ___________
[gw36] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_plugins.BadFileTracerTest object at 0x7f13f009a910>
def test_has_dynamic_source_filename_fails(self) -> None:
self.make_file("bad_plugin.py", """\
import coverage.plugin
class Plugin(coverage.plugin.CoveragePlugin):
def file_tracer(self, filename):
return BadFileTracer()
class BadFileTracer(coverage.plugin.FileTracer):
def has_dynamic_source_filename(self):
23/0 # Oh noes!
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
> self.run_bad_plugin("bad_plugin", "Plugin")
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/test_plugins.py:794:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_plugins.BadFileTracerTest object at 0x7f13f009a910>
module_name = 'bad_plugin', plugin_name = 'Plugin', our_error = True
excmsg = None, excmsgs = None
def run_bad_plugin(
self,
module_name: str,
plugin_name: str,
our_error: bool = True,
excmsg: Optional[str] = None,
excmsgs: Optional[List[str]] = None,
) -> None:
"""Run a file, and see that the plugin failed.
`module_name` and `plugin_name` is the module and name of the plugin to
use.
`our_error` is True if the error reported to the user will be an
explicit error in our test code, marked with an '# Oh noes!' comment.
`excmsg`, if provided, is text that must appear in the stderr.
`excmsgs`, if provided, is a list of messages, one of which must
appear in the stderr.
The plugin will be disabled, and we check that a warning is output
explaining why.
"""
with pytest.warns(Warning) as warns:
self.run_plugin(module_name)
stderr = self.stderr()
stderr += "".join(str(w.message) for w in warns)
if our_error:
# The exception we're causing should only appear once.
> assert stderr.count("# Oh noes!") == 1
E assert 0 == 1
E + where 0 = <built-in method count of str object at 0x7f13ebec3430>('# Oh noes!')
E + where <built-in method count of str object at 0x7f13ebec3430> = "Plugin file tracers (bad_plugin.Plugin) aren't supported with PyTracer".count
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/test_plugins.py:655: AssertionError
_______________ GoodFileTracerTest.test_plugin2_with_html_report _______________
[gw22] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_plugins.GoodFileTracerTest object at 0x7f87b2da8940>
def test_plugin2_with_html_report(self) -> None:
self.make_render_and_caller()
cov = coverage.Coverage(branch=True, omit=["*quux*"])
cov.set_option("run:plugins", ["tests.plugin2"])
self.start_import_stop(cov, "caller")
> total = cov.html_report(include=["*.html"], omit=["uni*.html"])
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/test_plugins.py:444:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/coverage/control.py:1157: in html_report
ret = reporter.report(morfs)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/coverage/html.py:296: in report
for fr, analysis in get_analysis_to_report(self.coverage, morfs):
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
coverage = <coverage.control.Coverage object at 0x7f87b2a729a0>, morfs = None
def get_analysis_to_report(
coverage: Coverage,
morfs: Optional[Iterable[TMorf]],
) -> Iterator[Tuple[FileReporter, Analysis]]:
"""Get the files to report on.
For each morf in `morfs`, if it should be reported on (based on the omit
and include configuration options), yield a pair, the `FileReporter` and
`Analysis` for the morf.
"""
file_reporters = coverage._get_file_reporters(morfs)
config = coverage.config
if config.report_include:
matcher = GlobMatcher(prep_patterns(config.report_include), "report_include")
file_reporters = [fr for fr in file_reporters if matcher.match(fr.filename)]
if config.report_omit:
matcher = GlobMatcher(prep_patterns(config.report_omit), "report_omit")
file_reporters = [fr for fr in file_reporters if not matcher.match(fr.filename)]
if not file_reporters:
> raise NoDataError("No data to report.")
E coverage.exceptions.NoDataError: No data to report.
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/coverage/report_core.py:94: NoDataError
_______ BadFileTracerTest.test_line_number_range_returns_pair_of_strings _______
[gw5] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_plugins.BadFileTracerTest object at 0x7f0dda47bbe0>
def test_line_number_range_returns_pair_of_strings(self) -> None:
self.make_file("bad_plugin.py", """\
import coverage.plugin
class Plugin(coverage.plugin.CoveragePlugin):
def file_tracer(self, filename):
if filename.endswith("other.py"):
return BadFileTracer()
class BadFileTracer(coverage.plugin.FileTracer):
def source_filename(self):
return "something.foo"
def line_number_range(self, frame):
return ("5", "7")
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
> self.run_bad_plugin(
"bad_plugin", "Plugin", our_error=False,
excmsgs=[
"an integer is required",
"cannot be interpreted as an integer",
],
)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/test_plugins.py:939:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_plugins.BadFileTracerTest object at 0x7f0dda47bbe0>
module_name = 'bad_plugin', plugin_name = 'Plugin', our_error = False
excmsg = None
excmsgs = ['an integer is required', 'cannot be interpreted as an integer']
def run_bad_plugin(
self,
module_name: str,
plugin_name: str,
our_error: bool = True,
excmsg: Optional[str] = None,
excmsgs: Optional[List[str]] = None,
) -> None:
"""Run a file, and see that the plugin failed.
`module_name` and `plugin_name` is the module and name of the plugin to
use.
`our_error` is True if the error reported to the user will be an
explicit error in our test code, marked with an '# Oh noes!' comment.
`excmsg`, if provided, is text that must appear in the stderr.
`excmsgs`, if provided, is a list of messages, one of which must
appear in the stderr.
The plugin will be disabled, and we check that a warning is output
explaining why.
"""
with pytest.warns(Warning) as warns:
self.run_plugin(module_name)
stderr = self.stderr()
stderr += "".join(str(w.message) for w in warns)
if our_error:
# The exception we're causing should only appear once.
assert stderr.count("# Oh noes!") == 1
# There should be a warning explaining what's happening, but only one.
# The message can be in two forms:
# Disabling plug-in '...' due to previous exception
# or:
# Disabling plug-in '...' due to an exception:
print([str(w) for w in warns.list])
warnings = [w for w in warns.list if issubclass(w.category, CoverageWarning)]
assert len(warnings) == 1
warnmsg = str(warnings[0].message)
> assert f"Disabling plug-in '{module_name}.{plugin_name}' due to " in warnmsg
E assert "Disabling plug-in 'bad_plugin.Plugin' due to " in "Plugin file tracers (bad_plugin.Plugin) aren't supported with PyTracer"
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/test_plugins.py:666: AssertionError
----------------------------- Captured stdout call -----------------------------
['{message : CoverageWarning("Plugin file tracers (bad_plugin.Plugin) aren\'t supported with PyTracer"), category : \'CoverageWarning\', filename : \'/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/coverage/control.py\', lineno : 555, line : None}']
_______________________ GoodFileTracerTest.test_plugin1 ________________________
[gw12] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_plugins.GoodFileTracerTest object at 0x7f13f02cf1c0>
def test_plugin1(self) -> None:
self.make_file("simple.py", """\
import try_xyz
a = 1
b = 2
""")
self.make_file("try_xyz.py", """\
c = 3
d = 4
""")
cov = coverage.Coverage()
CheckUniqueFilenames.hook(cov, '_should_trace')
CheckUniqueFilenames.hook(cov, '_check_include_omit_etc')
cov.set_option("run:plugins", ["tests.plugin1"])
# Import the Python file, executing it.
self.start_import_stop(cov, "simple")
_, statements, missing, _ = cov.analysis("simple.py")
assert statements == [1, 2, 3]
assert missing == []
zzfile = os.path.abspath(os.path.join("/src", "try_ABC.zz"))
> _, statements, _, _ = cov.analysis(zzfile)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/test_plugins.py:322:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/coverage/control.py:874: in analysis
f, s, _, m, mf = self.analysis2(morf)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/coverage/control.py:897: in analysis2
analysis = self._analyze(morf)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/coverage/control.py:922: in _analyze
return Analysis(data, self.config.precision, fr, self._file_mapper)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/coverage/results.py:35: in __init__
self.statements = self.file_reporter.lines()
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/coverage/python.py:193: in lines
return self.parser.statements
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/coverage/python.py:184: in parser
self._parser = PythonParser(
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/coverage/parser.py:56: in __init__
self.text = get_python_source(self.filename)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
filename = '/src/try_ABC.zz'
def get_python_source(filename: str) -> str:
"""Return the source code, as unicode."""
base, ext = os.path.splitext(filename)
if ext == ".py" and env.WINDOWS:
exts = [".py", ".pyw"]
else:
exts = [ext]
source_bytes: Optional[bytes]
for ext in exts:
try_filename = base + ext
if os.path.exists(try_filename):
# A regular text file: open it.
source_bytes = read_python_source(try_filename)
break
# Maybe it's in a zip file?
source_bytes = get_zip_bytes(try_filename)
if source_bytes is not None:
break
else:
# Couldn't find source.
> raise NoSource(f"No source for code: '{filename}'.")
E coverage.exceptions.NoSource: No source for code: '/src/try_ABC.zz'.
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/coverage/python.py:63: NoSource
__ ProcessStartupWithSourceTest.test_pth_and_source_work_together[main-pkg-] ___
[gw10] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_process.ProcessStartupWithSourceTest object at 0x7f99a86f07f0>
dashm = '', package = 'pkg', source = 'main'
@pytest.mark.parametrize("dashm", ["-m", ""])
@pytest.mark.parametrize("package", ["pkg", ""])
@pytest.mark.parametrize("source", ["main", "sub"])
def test_pth_and_source_work_together(self, dashm: str, package: str, source: str) -> None:
"""Run the test for a particular combination of factors.
The arguments are all strings:
* `dashm`: Either "" (run the program as a file) or "-m" (run the
program as a module).
* `package`: Either "" (put the source at the top level) or a
package name to use to hold the source.
* `source`: Either "main" or "sub", which file to use as the
``--source`` argument.
"""
def fullname(modname: str) -> str:
"""What is the full module name for `modname` for this test?"""
if package and dashm:
return '.'.join((package, modname))
else:
return modname
def path(basename: str) -> str:
"""Where should `basename` be created for this test?"""
return os.path.join(package, basename)
# Main will run sub.py.
self.make_file(path("main.py"), """\
import %s
a = 2
b = 3
""" % fullname('sub'))
if package:
self.make_file(path("__init__.py"), "")
# sub.py will write a few lines.
self.make_file(path("sub.py"), """\
f = open("out.txt", "w")
f.write("Hello, world!")
f.close()
""")
self.make_file("coverage.ini", """\
[run]
source = %s
""" % fullname(source))
self.set_environ("COVERAGE_PROCESS_START", "coverage.ini")
if dashm:
cmd = "python -m %s" % fullname('main')
else:
cmd = "python %s" % path('main.py')
self.run_command(cmd)
with open("out.txt") as f:
assert f.read() == "Hello, world!"
# Read the data from .coverage
> self.assert_exists(".coverage")
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/test_process.py:1284:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_process.ProcessStartupWithSourceTest object at 0x7f99a86f07f0>
fname = '.coverage'
def assert_exists(self, fname: str) -> None:
"""Assert that `fname` is a file that exists."""
> assert os.path.exists(fname), f"File {fname!r} should exist"
E AssertionError: File '.coverage' should exist
E assert False
E + where False = <function exists at 0x7f99b8d39ca0>('.coverage')
E + where <function exists at 0x7f99b8d39ca0> = <module 'posixpath' from '/usr/lib64/python3.8/posixpath.py'>.exists
E + where <module 'posixpath' from '/usr/lib64/python3.8/posixpath.py'> = os.path
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/coveragetest.py:340: AssertionError
----------------------------- Captured stdout call -----------------------------
___________________ ProcessTest.test_tests_dir_is_importable ___________________
[gw14] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_process.ProcessTest object at 0x7fae5fd2e760>
def test_tests_dir_is_importable(self) -> None:
# Checks that we can import modules from the tests directory at all!
self.make_file("mycode.py", """\
import covmod1
import covmodzip1
a = 1
print('done')
""")
self.assert_doesnt_exist(".coverage")
out = self.run_command("coverage run mycode.py")
self.assert_exists(".coverage")
> assert out == 'done\n'
E assert "Traceback (m...covmodzip1'\n" == 'done\n'
E - done
E + Traceback (most recent call last):
E + File "mycode.py", line 2, in <module>
E + import covmodzip1
E + ModuleNotFoundError: No module named 'covmodzip1'
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/test_process.py:55: AssertionError
----------------------------- Captured stdout call -----------------------------
Traceback (most recent call last):
File "mycode.py", line 2, in <module>
import covmodzip1
ModuleNotFoundError: No module named 'covmodzip1'
_________________ GoodFileTracerTest.test_plugin2_with_branch __________________
[gw45] linux -- Python 3.8.16 /usr/bin/python3
self = <coverage.parser.ByteParser object at 0x7fc53cb328e0>
text = 'line 0\nline 1\nline 2\nline 3\nline 4\nline 5\nline 6\n', code = None
filename = '/tmp/pytest-of-tkloczko/pytest-47/popen-gw45/t14/foo_7.html'
def __init__(
self,
text: str,
code: Optional[CodeType] = None,
filename: Optional[str] = None,
) -> None:
self.text = text
if code is not None:
self.code = code
else:
assert filename is not None
try:
> self.code = compile(text, filename, "exec", dont_inherit=True)
E File "/tmp/pytest-of-tkloczko/pytest-47/popen-gw45/t14/foo_7.html", line 1
E line 0
E ^
E SyntaxError: invalid syntax
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/coverage/parser.py:388: SyntaxError
The above exception was the direct cause of the following exception:
self = <tests.test_plugins.GoodFileTracerTest object at 0x7fc53e3d90a0>
def test_plugin2_with_branch(self) -> None:
self.make_render_and_caller()
cov = coverage.Coverage(branch=True, omit=["*quux*"])
CheckUniqueFilenames.hook(cov, '_should_trace')
CheckUniqueFilenames.hook(cov, '_check_include_omit_etc')
cov.set_option("run:plugins", ["tests.plugin2"])
self.start_import_stop(cov, "caller")
# The way plugin2 works, a file named foo_7.html will be claimed to
# have 7 lines in it. If render() was called with line number 4,
# then the plugin will claim that lines 4 and 5 were executed.
> analysis = cov._analyze("foo_7.html")
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/test_plugins.py:406:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/coverage/control.py:922: in _analyze
return Analysis(data, self.config.precision, fr, self._file_mapper)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/coverage/results.py:35: in __init__
self.statements = self.file_reporter.lines()
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/coverage/python.py:193: in lines
return self.parser.statements
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/coverage/python.py:188: in parser
self._parser.parse_source()
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/coverage/parser.py:253: in parse_source
self._raw_parse()
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/coverage/parser.py:211: in _raw_parse
byte_parser = ByteParser(self.text, filename=self.filename)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <coverage.parser.ByteParser object at 0x7fc53cb328e0>
text = 'line 0\nline 1\nline 2\nline 3\nline 4\nline 5\nline 6\n', code = None
filename = '/tmp/pytest-of-tkloczko/pytest-47/popen-gw45/t14/foo_7.html'
def __init__(
self,
text: str,
code: Optional[CodeType] = None,
filename: Optional[str] = None,
) -> None:
self.text = text
if code is not None:
self.code = code
else:
assert filename is not None
try:
self.code = compile(text, filename, "exec", dont_inherit=True)
except SyntaxError as synerr:
> raise NotPython(
"Couldn't parse '%s' as Python source: '%s' at line %d" % (
filename, synerr.msg, synerr.lineno or 0
)
) from synerr
E coverage.exceptions.NotPython: Couldn't parse '/tmp/pytest-of-tkloczko/pytest-47/popen-gw45/t14/foo_7.html' as Python source: 'invalid syntax' at line 1
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/coverage/parser.py:390: NotPython
___ ProcessStartupWithSourceTest.test_pth_and_source_work_together[sub---m] ____
[gw39] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_process.ProcessStartupWithSourceTest object at 0x7f710bf110a0>
dashm = '-m', package = '', source = 'sub'
@pytest.mark.parametrize("dashm", ["-m", ""])
@pytest.mark.parametrize("package", ["pkg", ""])
@pytest.mark.parametrize("source", ["main", "sub"])
def test_pth_and_source_work_together(self, dashm: str, package: str, source: str) -> None:
"""Run the test for a particular combination of factors.
The arguments are all strings:
* `dashm`: Either "" (run the program as a file) or "-m" (run the
program as a module).
* `package`: Either "" (put the source at the top level) or a
package name to use to hold the source.
* `source`: Either "main" or "sub", which file to use as the
``--source`` argument.
"""
def fullname(modname: str) -> str:
"""What is the full module name for `modname` for this test?"""
if package and dashm:
return '.'.join((package, modname))
else:
return modname
def path(basename: str) -> str:
"""Where should `basename` be created for this test?"""
return os.path.join(package, basename)
# Main will run sub.py.
self.make_file(path("main.py"), """\
import %s
a = 2
b = 3
""" % fullname('sub'))
if package:
self.make_file(path("__init__.py"), "")
# sub.py will write a few lines.
self.make_file(path("sub.py"), """\
f = open("out.txt", "w")
f.write("Hello, world!")
f.close()
""")
self.make_file("coverage.ini", """\
[run]
source = %s
""" % fullname(source))
self.set_environ("COVERAGE_PROCESS_START", "coverage.ini")
if dashm:
cmd = "python -m %s" % fullname('main')
else:
cmd = "python %s" % path('main.py')
self.run_command(cmd)
with open("out.txt") as f:
assert f.read() == "Hello, world!"
# Read the data from .coverage
> self.assert_exists(".coverage")
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/test_process.py:1284:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_process.ProcessStartupWithSourceTest object at 0x7f710bf110a0>
fname = '.coverage'
def assert_exists(self, fname: str) -> None:
"""Assert that `fname` is a file that exists."""
> assert os.path.exists(fname), f"File {fname!r} should exist"
E AssertionError: File '.coverage' should exist
E assert False
E + where False = <function exists at 0x7f7120579ca0>('.coverage')
E + where <function exists at 0x7f7120579ca0> = <module 'posixpath' from '/usr/lib64/python3.8/posixpath.py'>.exists
E + where <module 'posixpath' from '/usr/lib64/python3.8/posixpath.py'> = os.path
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/coveragetest.py:340: AssertionError
----------------------------- Captured stdout call -----------------------------
__ ProcessStartupWithSourceTest.test_pth_and_source_work_together[sub-pkg--m] __
[gw6] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_process.ProcessStartupWithSourceTest object at 0x7f0606509580>
dashm = '-m', package = 'pkg', source = 'sub'
@pytest.mark.parametrize("dashm", ["-m", ""])
@pytest.mark.parametrize("package", ["pkg", ""])
@pytest.mark.parametrize("source", ["main", "sub"])
def test_pth_and_source_work_together(self, dashm: str, package: str, source: str) -> None:
"""Run the test for a particular combination of factors.
The arguments are all strings:
* `dashm`: Either "" (run the program as a file) or "-m" (run the
program as a module).
* `package`: Either "" (put the source at the top level) or a
package name to use to hold the source.
* `source`: Either "main" or "sub", which file to use as the
``--source`` argument.
"""
def fullname(modname: str) -> str:
"""What is the full module name for `modname` for this test?"""
if package and dashm:
return '.'.join((package, modname))
else:
return modname
def path(basename: str) -> str:
"""Where should `basename` be created for this test?"""
return os.path.join(package, basename)
# Main will run sub.py.
self.make_file(path("main.py"), """\
import %s
a = 2
b = 3
""" % fullname('sub'))
if package:
self.make_file(path("__init__.py"), "")
# sub.py will write a few lines.
self.make_file(path("sub.py"), """\
f = open("out.txt", "w")
f.write("Hello, world!")
f.close()
""")
self.make_file("coverage.ini", """\
[run]
source = %s
""" % fullname(source))
self.set_environ("COVERAGE_PROCESS_START", "coverage.ini")
if dashm:
cmd = "python -m %s" % fullname('main')
else:
cmd = "python %s" % path('main.py')
self.run_command(cmd)
with open("out.txt") as f:
assert f.read() == "Hello, world!"
# Read the data from .coverage
> self.assert_exists(".coverage")
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/test_process.py:1284:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_process.ProcessStartupWithSourceTest object at 0x7f0606509580>
fname = '.coverage'
def assert_exists(self, fname: str) -> None:
"""Assert that `fname` is a file that exists."""
> assert os.path.exists(fname), f"File {fname!r} should exist"
E AssertionError: File '.coverage' should exist
E assert False
E + where False = <function exists at 0x7f061ab79ca0>('.coverage')
E + where <function exists at 0x7f061ab79ca0> = <module 'posixpath' from '/usr/lib64/python3.8/posixpath.py'>.exists
E + where <module 'posixpath' from '/usr/lib64/python3.8/posixpath.py'> = os.path
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/coveragetest.py:340: AssertionError
----------------------------- Captured stdout call -----------------------------
_______________________ GoodFileTracerTest.test_plugin2 ________________________
[gw13] linux -- Python 3.8.16 /usr/bin/python3
self = <coverage.parser.ByteParser object at 0x7f36ff660460>
text = 'line 0\nline 1\nline 2\nline 3\nline 4\nline 5\nline 6\n', code = None
filename = '/tmp/pytest-of-tkloczko/pytest-47/popen-gw13/t11/foo_7.html'
def __init__(
self,
text: str,
code: Optional[CodeType] = None,
filename: Optional[str] = None,
) -> None:
self.text = text
if code is not None:
self.code = code
else:
assert filename is not None
try:
> self.code = compile(text, filename, "exec", dont_inherit=True)
E File "/tmp/pytest-of-tkloczko/pytest-47/popen-gw13/t11/foo_7.html", line 1
E line 0
E ^
E SyntaxError: invalid syntax
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/coverage/parser.py:388: SyntaxError
The above exception was the direct cause of the following exception:
self = <tests.test_plugins.GoodFileTracerTest object at 0x7f36ff7bd190>
def test_plugin2(self) -> None:
self.make_render_and_caller()
cov = coverage.Coverage(omit=["*quux*"])
CheckUniqueFilenames.hook(cov, '_should_trace')
CheckUniqueFilenames.hook(cov, '_check_include_omit_etc')
cov.set_option("run:plugins", ["tests.plugin2"])
self.start_import_stop(cov, "caller")
# The way plugin2 works, a file named foo_7.html will be claimed to
# have 7 lines in it. If render() was called with line number 4,
# then the plugin will claim that lines 4 and 5 were executed.
> _, statements, missing, _ = cov.analysis("foo_7.html")
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/test_plugins.py:381:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/coverage/control.py:874: in analysis
f, s, _, m, mf = self.analysis2(morf)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/coverage/control.py:897: in analysis2
analysis = self._analyze(morf)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/coverage/control.py:922: in _analyze
return Analysis(data, self.config.precision, fr, self._file_mapper)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/coverage/results.py:35: in __init__
self.statements = self.file_reporter.lines()
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/coverage/python.py:193: in lines
return self.parser.statements
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/coverage/python.py:188: in parser
self._parser.parse_source()
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/coverage/parser.py:253: in parse_source
self._raw_parse()
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/coverage/parser.py:211: in _raw_parse
byte_parser = ByteParser(self.text, filename=self.filename)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <coverage.parser.ByteParser object at 0x7f36ff660460>
text = 'line 0\nline 1\nline 2\nline 3\nline 4\nline 5\nline 6\n', code = None
filename = '/tmp/pytest-of-tkloczko/pytest-47/popen-gw13/t11/foo_7.html'
def __init__(
self,
text: str,
code: Optional[CodeType] = None,
filename: Optional[str] = None,
) -> None:
self.text = text
if code is not None:
self.code = code
else:
assert filename is not None
try:
self.code = compile(text, filename, "exec", dont_inherit=True)
except SyntaxError as synerr:
> raise NotPython(
"Couldn't parse '%s' as Python source: '%s' at line %d" % (
filename, synerr.msg, synerr.lineno or 0
)
) from synerr
E coverage.exceptions.NotPython: Couldn't parse '/tmp/pytest-of-tkloczko/pytest-47/popen-gw13/t11/foo_7.html' as Python source: 'invalid syntax' at line 1
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/coverage/parser.py:390: NotPython
_______________________ SummaryTest.test_report_just_one _______________________
[gw0] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_report.SummaryTest object at 0x7f8914246e80>
def test_report_just_one(self) -> None:
# Try reporting just one module
self.make_mycode()
cov = coverage.Coverage()
> self.start_import_stop(cov, "mycode")
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/test_report.py:70:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/coveragetest.py:93: in start_import_stop
mod = import_local_file(modname, modfile)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/coverage/misc.py:336: in import_local_file
spec.loader.exec_module(mod)
<frozen importlib._bootstrap_external>:843: in exec_module
???
<frozen importlib._bootstrap>:219: in _call_with_frames_removed
???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
import covmod1
> import covmodzip1
E ModuleNotFoundError: No module named 'covmodzip1'
/tmp/pytest-of-tkloczko/pytest-47/popen-gw0/t6/mycode.py:2: ModuleNotFoundError
________________________ ProcessTest.test_fullcoverage _________________________
[gw31] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_process.ProcessTest object at 0x7f6097d4d4c0>
@pytest.mark.expensive
@pytest.mark.skipif(not env.C_TRACER, reason="fullcoverage only works with the C tracer.")
@pytest.mark.skipif(env.METACOV, reason="Can't test fullcoverage when measuring ourselves")
def test_fullcoverage(self) -> None:
# fullcoverage is a trick to get stdlib modules measured from
# the very beginning of the process. Here we import os and
# then check how many lines are measured.
self.make_file("getenv.py", """\
import os
print("FOOEY == %s" % os.getenv("FOOEY"))
""")
fullcov = os.path.join(os.path.dirname(coverage.__file__), "fullcoverage")
self.set_environ("FOOEY", "BOO")
self.set_environ("PYTHONPATH", fullcov)
out = self.run_command("python -X frozen_modules=off -m coverage run -L getenv.py")
> assert out == "FOOEY == BOO\n"
E AssertionError: assert '/usr/bin/pyt...ed coverage\n' == 'FOOEY == BOO\n'
E - FOOEY == BOO
E + /usr/bin/python3: No module named coverage
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/test_process.py:575: AssertionError
----------------------------- Captured stdout call -----------------------------
/usr/bin/python3: No module named coverage
______________ ProcessStartupTest.test_subprocess_with_pth_files _______________
[gw1] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_process.ProcessStartupTest object at 0x7eff9dcae8e0>
def test_subprocess_with_pth_files(self) -> None:
# An existing data file should not be read when a subprocess gets
# measured automatically. Create the data file here with bogus data in
# it.
data = coverage.CoverageData(".mycovdata")
data.add_lines({os.path.abspath('sub.py'): range(100)})
data.write()
self.make_file("coverage.ini", """\
[run]
data_file = .mycovdata
""")
self.set_environ("COVERAGE_PROCESS_START", "coverage.ini")
import main # pylint: disable=unused-import, import-error
with open("out.txt") as f:
assert f.read() == "Hello, world!\n"
# Read the data from .coverage
self.assert_exists(".mycovdata")
data = coverage.CoverageData(".mycovdata")
data.read()
> assert line_counts(data)['sub.py'] == 3
E assert 100 == 3
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/test_process.py:1177: AssertionError
____ ProcessStartupWithSourceTest.test_pth_and_source_work_together[sub--] _____
[gw39] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_process.ProcessStartupWithSourceTest object at 0x7f710bf11160>
dashm = '', package = '', source = 'sub'
@pytest.mark.parametrize("dashm", ["-m", ""])
@pytest.mark.parametrize("package", ["pkg", ""])
@pytest.mark.parametrize("source", ["main", "sub"])
def test_pth_and_source_work_together(self, dashm: str, package: str, source: str) -> None:
"""Run the test for a particular combination of factors.
The arguments are all strings:
* `dashm`: Either "" (run the program as a file) or "-m" (run the
program as a module).
* `package`: Either "" (put the source at the top level) or a
package name to use to hold the source.
* `source`: Either "main" or "sub", which file to use as the
``--source`` argument.
"""
def fullname(modname: str) -> str:
"""What is the full module name for `modname` for this test?"""
if package and dashm:
return '.'.join((package, modname))
else:
return modname
def path(basename: str) -> str:
"""Where should `basename` be created for this test?"""
return os.path.join(package, basename)
# Main will run sub.py.
self.make_file(path("main.py"), """\
import %s
a = 2
b = 3
""" % fullname('sub'))
if package:
self.make_file(path("__init__.py"), "")
# sub.py will write a few lines.
self.make_file(path("sub.py"), """\
f = open("out.txt", "w")
f.write("Hello, world!")
f.close()
""")
self.make_file("coverage.ini", """\
[run]
source = %s
""" % fullname(source))
self.set_environ("COVERAGE_PROCESS_START", "coverage.ini")
if dashm:
cmd = "python -m %s" % fullname('main')
else:
cmd = "python %s" % path('main.py')
self.run_command(cmd)
with open("out.txt") as f:
assert f.read() == "Hello, world!"
# Read the data from .coverage
> self.assert_exists(".coverage")
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/test_process.py:1284:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_process.ProcessStartupWithSourceTest object at 0x7f710bf11160>
fname = '.coverage'
def assert_exists(self, fname: str) -> None:
"""Assert that `fname` is a file that exists."""
> assert os.path.exists(fname), f"File {fname!r} should exist"
E AssertionError: File '.coverage' should exist
E assert False
E + where False = <function exists at 0x7f7120579ca0>('.coverage')
E + where <function exists at 0x7f7120579ca0> = <module 'posixpath' from '/usr/lib64/python3.8/posixpath.py'>.exists
E + where <module 'posixpath' from '/usr/lib64/python3.8/posixpath.py'> = os.path
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/coveragetest.py:340: AssertionError
----------------------------- Captured stdout call -----------------------------
___ ProcessStartupWithSourceTest.test_pth_and_source_work_together[sub-pkg-] ___
[gw6] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_process.ProcessStartupWithSourceTest object at 0x7f0606509640>
dashm = '', package = 'pkg', source = 'sub'
@pytest.mark.parametrize("dashm", ["-m", ""])
@pytest.mark.parametrize("package", ["pkg", ""])
@pytest.mark.parametrize("source", ["main", "sub"])
def test_pth_and_source_work_together(self, dashm: str, package: str, source: str) -> None:
"""Run the test for a particular combination of factors.
The arguments are all strings:
* `dashm`: Either "" (run the program as a file) or "-m" (run the
program as a module).
* `package`: Either "" (put the source at the top level) or a
package name to use to hold the source.
* `source`: Either "main" or "sub", which file to use as the
``--source`` argument.
"""
def fullname(modname: str) -> str:
"""What is the full module name for `modname` for this test?"""
if package and dashm:
return '.'.join((package, modname))
else:
return modname
def path(basename: str) -> str:
"""Where should `basename` be created for this test?"""
return os.path.join(package, basename)
# Main will run sub.py.
self.make_file(path("main.py"), """\
import %s
a = 2
b = 3
""" % fullname('sub'))
if package:
self.make_file(path("__init__.py"), "")
# sub.py will write a few lines.
self.make_file(path("sub.py"), """\
f = open("out.txt", "w")
f.write("Hello, world!")
f.close()
""")
self.make_file("coverage.ini", """\
[run]
source = %s
""" % fullname(source))
self.set_environ("COVERAGE_PROCESS_START", "coverage.ini")
if dashm:
cmd = "python -m %s" % fullname('main')
else:
cmd = "python %s" % path('main.py')
self.run_command(cmd)
with open("out.txt") as f:
assert f.read() == "Hello, world!"
# Read the data from .coverage
> self.assert_exists(".coverage")
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/test_process.py:1284:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_process.ProcessStartupWithSourceTest object at 0x7f0606509640>
fname = '.coverage'
def assert_exists(self, fname: str) -> None:
"""Assert that `fname` is a file that exists."""
> assert os.path.exists(fname), f"File {fname!r} should exist"
E AssertionError: File '.coverage' should exist
E assert False
E + where False = <function exists at 0x7f061ab79ca0>('.coverage')
E + where <function exists at 0x7f061ab79ca0> = <module 'posixpath' from '/usr/lib64/python3.8/posixpath.py'>.exists
E + where <module 'posixpath' from '/usr/lib64/python3.8/posixpath.py'> = os.path
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/coveragetest.py:340: AssertionError
----------------------------- Captured stdout call -----------------------------
____ ProcessStartupWithSourceTest.test_pth_and_source_work_together[main--] ____
[gw10] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_process.ProcessStartupWithSourceTest object at 0x7f99a86f0970>
dashm = '', package = '', source = 'main'
@pytest.mark.parametrize("dashm", ["-m", ""])
@pytest.mark.parametrize("package", ["pkg", ""])
@pytest.mark.parametrize("source", ["main", "sub"])
def test_pth_and_source_work_together(self, dashm: str, package: str, source: str) -> None:
"""Run the test for a particular combination of factors.
The arguments are all strings:
* `dashm`: Either "" (run the program as a file) or "-m" (run the
program as a module).
* `package`: Either "" (put the source at the top level) or a
package name to use to hold the source.
* `source`: Either "main" or "sub", which file to use as the
``--source`` argument.
"""
def fullname(modname: str) -> str:
"""What is the full module name for `modname` for this test?"""
if package and dashm:
return '.'.join((package, modname))
else:
return modname
def path(basename: str) -> str:
"""Where should `basename` be created for this test?"""
return os.path.join(package, basename)
# Main will run sub.py.
self.make_file(path("main.py"), """\
import %s
a = 2
b = 3
""" % fullname('sub'))
if package:
self.make_file(path("__init__.py"), "")
# sub.py will write a few lines.
self.make_file(path("sub.py"), """\
f = open("out.txt", "w")
f.write("Hello, world!")
f.close()
""")
self.make_file("coverage.ini", """\
[run]
source = %s
""" % fullname(source))
self.set_environ("COVERAGE_PROCESS_START", "coverage.ini")
if dashm:
cmd = "python -m %s" % fullname('main')
else:
cmd = "python %s" % path('main.py')
self.run_command(cmd)
with open("out.txt") as f:
assert f.read() == "Hello, world!"
# Read the data from .coverage
> self.assert_exists(".coverage")
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/test_process.py:1284:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_process.ProcessStartupWithSourceTest object at 0x7f99a86f0970>
fname = '.coverage'
def assert_exists(self, fname: str) -> None:
"""Assert that `fname` is a file that exists."""
> assert os.path.exists(fname), f"File {fname!r} should exist"
E AssertionError: File '.coverage' should exist
E assert False
E + where False = <function exists at 0x7f99b8d39ca0>('.coverage')
E + where <function exists at 0x7f99b8d39ca0> = <module 'posixpath' from '/usr/lib64/python3.8/posixpath.py'>.exists
E + where <module 'posixpath' from '/usr/lib64/python3.8/posixpath.py'> = os.path
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/coveragetest.py:340: AssertionError
----------------------------- Captured stdout call -----------------------------
_______ SummaryTest.test_report_include_relative_files_and_wildcard_path _______
[gw0] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_report.SummaryTest object at 0x7f891449da90>
def test_report_include_relative_files_and_wildcard_path(self) -> None:
self.make_mycode()
self.make_file(".coveragerc", """\
[run]
relative_files = true
""")
self.make_file("submodule/mycode.py", "import nested.submodule.mycode")
self.make_file("nested/submodule/mycode.py", "import mycode")
cov = coverage.Coverage()
> self.start_import_stop(cov, "submodule/mycode")
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/test_report.py:182:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/coveragetest.py:93: in start_import_stop
mod = import_local_file(modname, modfile)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/coverage/misc.py:336: in import_local_file
spec.loader.exec_module(mod)
<frozen importlib._bootstrap_external>:843: in exec_module
???
<frozen importlib._bootstrap>:219: in _call_with_frames_removed
???
/tmp/pytest-of-tkloczko/pytest-47/popen-gw0/t7/submodule/mycode.py:1: in <module>
import nested.submodule.mycode
/tmp/pytest-of-tkloczko/pytest-47/popen-gw0/t7/nested/submodule/mycode.py:1: in <module>
import mycode
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
import covmod1
> import covmodzip1
E ModuleNotFoundError: No module named 'covmodzip1'
/tmp/pytest-of-tkloczko/pytest-47/popen-gw0/t7/mycode.py:2: ModuleNotFoundError
_ ProcessStartupWithSourceTest.test_pth_and_source_work_together[main-pkg--m] __
[gw36] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_process.ProcessStartupWithSourceTest object at 0x7f13ebe166d0>
dashm = '-m', package = 'pkg', source = 'main'
@pytest.mark.parametrize("dashm", ["-m", ""])
@pytest.mark.parametrize("package", ["pkg", ""])
@pytest.mark.parametrize("source", ["main", "sub"])
def test_pth_and_source_work_together(self, dashm: str, package: str, source: str) -> None:
"""Run the test for a particular combination of factors.
The arguments are all strings:
* `dashm`: Either "" (run the program as a file) or "-m" (run the
program as a module).
* `package`: Either "" (put the source at the top level) or a
package name to use to hold the source.
* `source`: Either "main" or "sub", which file to use as the
``--source`` argument.
"""
def fullname(modname: str) -> str:
"""What is the full module name for `modname` for this test?"""
if package and dashm:
return '.'.join((package, modname))
else:
return modname
def path(basename: str) -> str:
"""Where should `basename` be created for this test?"""
return os.path.join(package, basename)
# Main will run sub.py.
self.make_file(path("main.py"), """\
import %s
a = 2
b = 3
""" % fullname('sub'))
if package:
self.make_file(path("__init__.py"), "")
# sub.py will write a few lines.
self.make_file(path("sub.py"), """\
f = open("out.txt", "w")
f.write("Hello, world!")
f.close()
""")
self.make_file("coverage.ini", """\
[run]
source = %s
""" % fullname(source))
self.set_environ("COVERAGE_PROCESS_START", "coverage.ini")
if dashm:
cmd = "python -m %s" % fullname('main')
else:
cmd = "python %s" % path('main.py')
self.run_command(cmd)
with open("out.txt") as f:
assert f.read() == "Hello, world!"
# Read the data from .coverage
> self.assert_exists(".coverage")
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/test_process.py:1284:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_process.ProcessStartupWithSourceTest object at 0x7f13ebe166d0>
fname = '.coverage'
def assert_exists(self, fname: str) -> None:
"""Assert that `fname` is a file that exists."""
> assert os.path.exists(fname), f"File {fname!r} should exist"
E AssertionError: File '.coverage' should exist
E assert False
E + where False = <function exists at 0x7f140049aca0>('.coverage')
E + where <function exists at 0x7f140049aca0> = <module 'posixpath' from '/usr/lib64/python3.8/posixpath.py'>.exists
E + where <module 'posixpath' from '/usr/lib64/python3.8/posixpath.py'> = os.path
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/coveragetest.py:340: AssertionError
----------------------------- Captured stdout call -----------------------------
___ ProcessStartupWithSourceTest.test_pth_and_source_work_together[main---m] ___
[gw22] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_process.ProcessStartupWithSourceTest object at 0x7f87b29f3eb0>
dashm = '-m', package = '', source = 'main'
@pytest.mark.parametrize("dashm", ["-m", ""])
@pytest.mark.parametrize("package", ["pkg", ""])
@pytest.mark.parametrize("source", ["main", "sub"])
def test_pth_and_source_work_together(self, dashm: str, package: str, source: str) -> None:
"""Run the test for a particular combination of factors.
The arguments are all strings:
* `dashm`: Either "" (run the program as a file) or "-m" (run the
program as a module).
* `package`: Either "" (put the source at the top level) or a
package name to use to hold the source.
* `source`: Either "main" or "sub", which file to use as the
``--source`` argument.
"""
def fullname(modname: str) -> str:
"""What is the full module name for `modname` for this test?"""
if package and dashm:
return '.'.join((package, modname))
else:
return modname
def path(basename: str) -> str:
"""Where should `basename` be created for this test?"""
return os.path.join(package, basename)
# Main will run sub.py.
self.make_file(path("main.py"), """\
import %s
a = 2
b = 3
""" % fullname('sub'))
if package:
self.make_file(path("__init__.py"), "")
# sub.py will write a few lines.
self.make_file(path("sub.py"), """\
f = open("out.txt", "w")
f.write("Hello, world!")
f.close()
""")
self.make_file("coverage.ini", """\
[run]
source = %s
""" % fullname(source))
self.set_environ("COVERAGE_PROCESS_START", "coverage.ini")
if dashm:
cmd = "python -m %s" % fullname('main')
else:
cmd = "python %s" % path('main.py')
self.run_command(cmd)
with open("out.txt") as f:
assert f.read() == "Hello, world!"
# Read the data from .coverage
> self.assert_exists(".coverage")
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/test_process.py:1284:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_process.ProcessStartupWithSourceTest object at 0x7f87b29f3eb0>
fname = '.coverage'
def assert_exists(self, fname: str) -> None:
"""Assert that `fname` is a file that exists."""
> assert os.path.exists(fname), f"File {fname!r} should exist"
E AssertionError: File '.coverage' should exist
E assert False
E + where False = <function exists at 0x7f87b97f9ca0>('.coverage')
E + where <function exists at 0x7f87b97f9ca0> = <module 'posixpath' from '/usr/lib64/python3.8/posixpath.py'>.exists
E + where <module 'posixpath' from '/usr/lib64/python3.8/posixpath.py'> = os.path
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/coveragetest.py:340: AssertionError
----------------------------- Captured stdout call -----------------------------
_______________________ SummaryTest.test_report_omitting _______________________
[gw10] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_report.SummaryTest object at 0x7f99a88bea00>
def test_report_omitting(self) -> None:
# Try reporting while omitting some modules
self.make_mycode()
cov = coverage.Coverage()
> self.start_import_stop(cov, "mycode")
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/test_report.py:109:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/coveragetest.py:93: in start_import_stop
mod = import_local_file(modname, modfile)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/coverage/misc.py:336: in import_local_file
spec.loader.exec_module(mod)
<frozen importlib._bootstrap_external>:843: in exec_module
???
<frozen importlib._bootstrap>:219: in _call_with_frames_removed
???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
import covmod1
> import covmodzip1
E ModuleNotFoundError: No module named 'covmodzip1'
/tmp/pytest-of-tkloczko/pytest-47/popen-gw10/t8/mycode.py:2: ModuleNotFoundError
___________ SummaryTest.test_report_include_relative_files_and_path ____________
[gw7] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_report.SummaryTest object at 0x7f636165ef10>
def test_report_include_relative_files_and_path(self) -> None:
"""
Test that when relative_files is True and a relative path to a module
is included, coverage is reported for the module.
Ref: https://github.com/nedbat/coveragepy/issues/1604
"""
self.make_mycode()
self.make_file(".coveragerc", """\
[run]
relative_files = true
""")
self.make_file("submodule/mycode.py", "import mycode")
cov = coverage.Coverage()
> self.start_import_stop(cov, "submodule/mycode")
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/test_report.py:160:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/coveragetest.py:93: in start_import_stop
mod = import_local_file(modname, modfile)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/coverage/misc.py:336: in import_local_file
spec.loader.exec_module(mod)
<frozen importlib._bootstrap_external>:843: in exec_module
???
<frozen importlib._bootstrap>:219: in _call_with_frames_removed
???
/tmp/pytest-of-tkloczko/pytest-47/popen-gw7/t20/submodule/mycode.py:1: in <module>
import mycode
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
import covmod1
> import covmodzip1
E ModuleNotFoundError: No module named 'covmodzip1'
/tmp/pytest-of-tkloczko/pytest-47/popen-gw7/t20/mycode.py:2: ModuleNotFoundError
______________________ SummaryTest.test_report_including _______________________
[gw25] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_report.SummaryTest object at 0x7f49a5dbfbb0>
def test_report_including(self) -> None:
# Try reporting while including some modules
self.make_mycode()
cov = coverage.Coverage()
> self.start_import_stop(cov, "mycode")
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/test_report.py:129:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/coveragetest.py:93: in start_import_stop
mod = import_local_file(modname, modfile)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/coverage/misc.py:336: in import_local_file
spec.loader.exec_module(mod)
<frozen importlib._bootstrap_external>:843: in exec_module
???
<frozen importlib._bootstrap>:219: in _call_with_frames_removed
???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
import covmod1
> import covmodzip1
E ModuleNotFoundError: No module named 'covmodzip1'
/tmp/pytest-of-tkloczko/pytest-47/popen-gw25/t14/mycode.py:2: ModuleNotFoundError
________ ProcessStartupTest.test_subprocess_with_pth_files_and_parallel ________
[gw5] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_process.ProcessStartupTest object at 0x7f0dda339880>
def test_subprocess_with_pth_files_and_parallel(self) -> None:
# https://github.com/nedbat/coveragepy/issues/492
self.make_file("coverage.ini", """\
[run]
parallel = true
""")
self.set_environ("COVERAGE_PROCESS_START", "coverage.ini")
self.run_command("coverage run main.py")
with open("out.txt") as f:
assert f.read() == "Hello, world!\n"
self.run_command("coverage combine")
# assert that the combined .coverage data file is correct
self.assert_exists(".coverage")
data = coverage.CoverageData()
data.read()
> assert line_counts(data)['sub.py'] == 3
E KeyError: 'sub.py'
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/test_process.py:1198: KeyError
----------------------------- Captured stdout call -----------------------------
No data to combine
______________ GetZipBytesTest.test_get_encoded_zip_files[utf-8] _______________
[gw5] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_python.GetZipBytesTest object at 0x7f0dda3422e0>
encoding = 'utf-8'
@pytest.mark.parametrize(
"encoding",
["utf-8", "gb2312", "hebrew", "shift_jis", "cp1252"],
)
def test_get_encoded_zip_files(self, encoding: str) -> None:
# See igor.py, do_zipmods, for the text of these files.
zip_file = "tests/zipmods.zip"
sys.path.append(zip_file) # So we can import the files.
filename = zip_file + "/encoded_" + encoding + ".py"
filename = os_sep(filename)
zip_data = get_zip_bytes(filename)
> assert zip_data is not None
E assert None is not None
tests/test_python.py:36: AssertionError
______________ GetZipBytesTest.test_get_encoded_zip_files[gb2312] ______________
[gw5] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_python.GetZipBytesTest object at 0x7f0dda342460>
encoding = 'gb2312'
@pytest.mark.parametrize(
"encoding",
["utf-8", "gb2312", "hebrew", "shift_jis", "cp1252"],
)
def test_get_encoded_zip_files(self, encoding: str) -> None:
# See igor.py, do_zipmods, for the text of these files.
zip_file = "tests/zipmods.zip"
sys.path.append(zip_file) # So we can import the files.
filename = zip_file + "/encoded_" + encoding + ".py"
filename = os_sep(filename)
zip_data = get_zip_bytes(filename)
> assert zip_data is not None
E assert None is not None
tests/test_python.py:36: AssertionError
______________ GetZipBytesTest.test_get_encoded_zip_files[hebrew] ______________
[gw5] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_python.GetZipBytesTest object at 0x7f0dda3424f0>
encoding = 'hebrew'
@pytest.mark.parametrize(
"encoding",
["utf-8", "gb2312", "hebrew", "shift_jis", "cp1252"],
)
def test_get_encoded_zip_files(self, encoding: str) -> None:
# See igor.py, do_zipmods, for the text of these files.
zip_file = "tests/zipmods.zip"
sys.path.append(zip_file) # So we can import the files.
filename = zip_file + "/encoded_" + encoding + ".py"
filename = os_sep(filename)
zip_data = get_zip_bytes(filename)
> assert zip_data is not None
E assert None is not None
tests/test_python.py:36: AssertionError
____________ GetZipBytesTest.test_get_encoded_zip_files[shift_jis] _____________
[gw5] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_python.GetZipBytesTest object at 0x7f0dda342580>
encoding = 'shift_jis'
@pytest.mark.parametrize(
"encoding",
["utf-8", "gb2312", "hebrew", "shift_jis", "cp1252"],
)
def test_get_encoded_zip_files(self, encoding: str) -> None:
# See igor.py, do_zipmods, for the text of these files.
zip_file = "tests/zipmods.zip"
sys.path.append(zip_file) # So we can import the files.
filename = zip_file + "/encoded_" + encoding + ".py"
filename = os_sep(filename)
zip_data = get_zip_bytes(filename)
> assert zip_data is not None
E assert None is not None
tests/test_python.py:36: AssertionError
___________________________ SummaryTest.test_report ____________________________
[gw12] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_report.SummaryTest object at 0x7f13ebf82670>
def test_report(self) -> None:
self.make_mycode()
cov = coverage.Coverage()
> self.start_import_stop(cov, "mycode")
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/test_report.py:48:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/coveragetest.py:93: in start_import_stop
mod = import_local_file(modname, modfile)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/coverage/misc.py:336: in import_local_file
spec.loader.exec_module(mod)
<frozen importlib._bootstrap_external>:843: in exec_module
???
<frozen importlib._bootstrap>:219: in _call_with_frames_removed
???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
import covmod1
> import covmodzip1
E ModuleNotFoundError: No module named 'covmodzip1'
/tmp/pytest-of-tkloczko/pytest-47/popen-gw12/t18/mycode.py:2: ModuleNotFoundError
______________ GetZipBytesTest.test_get_encoded_zip_files[cp1252] ______________
[gw5] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_python.GetZipBytesTest object at 0x7f0dda342610>
encoding = 'cp1252'
@pytest.mark.parametrize(
"encoding",
["utf-8", "gb2312", "hebrew", "shift_jis", "cp1252"],
)
def test_get_encoded_zip_files(self, encoding: str) -> None:
# See igor.py, do_zipmods, for the text of these files.
zip_file = "tests/zipmods.zip"
sys.path.append(zip_file) # So we can import the files.
filename = zip_file + "/encoded_" + encoding + ".py"
filename = os_sep(filename)
zip_data = get_zip_bytes(filename)
> assert zip_data is not None
E assert None is not None
tests/test_python.py:36: AssertionError
_______________________ SummaryTest.test_report_wildcard _______________________
[gw14] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_report.SummaryTest object at 0x7fae5fb66b20>
def test_report_wildcard(self) -> None:
# Try reporting using wildcards to get the modules.
self.make_mycode()
# Wildcard is handled by shell or cmdline.py, so use real commands
self.run_command("coverage run mycode.py")
report = self.report_from_command("coverage report my*.py")
# Name Stmts Miss Cover
# -------------------------------
# mycode.py 4 0 100%
# -------------------------------
# TOTAL 4 0 100%
assert self.line_count(report) == 5
assert "/coverage/" not in report
assert "/tests/modules/covmod1.py " not in report
assert "/tests/zipmods.zip/covmodzip1.py " not in report
assert "mycode.py " in report
> assert self.last_line_squeezed(report) == "TOTAL 4 0 100%"
E AssertionError: assert 'TOTAL 4 2 50%' == 'TOTAL 4 0 100%'
E - TOTAL 4 0 100%
E + TOTAL 4 2 50%
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/test_report.py:103: AssertionError
----------------------------- Captured stdout call -----------------------------
Traceback (most recent call last):
File "mycode.py", line 2, in <module>
import covmodzip1
ModuleNotFoundError: No module named 'covmodzip1'
Name Stmts Miss Cover
-------------------------------
mycode.py 4 2 50%
-------------------------------
TOTAL 4 2 50%
_______________ EnvironmentTest.test_coverage_zip_is_like_python _______________
[gw15] linux -- Python 3.8.16 /usr/bin/python3
self = <tests.test_process.EnvironmentTest object at 0x7f329c6311f0>
def test_coverage_zip_is_like_python(self) -> None:
# Test running coverage from a zip file itself. Some environments
# (windows?) zip up the coverage main to be used as the coverage
# command.
with open(TRY_EXECFILE) as f:
self.make_file("run_me.py", f.read())
expected = self.run_command("python run_me.py")
cov_main = os.path.join(TESTS_DIR, "covmain.zip")
actual = self.run_command(f"python {cov_main} run run_me.py")
> self.assert_tryexecfile_output(expected, actual)
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/test_process.py:805:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_process.EnvironmentTest object at 0x7f329c6311f0>
expected = '{\n "DATA": "xyzzy",\n "FN_VAL": "my_fn(\'fooey\')",\n "__builtins__.dir": [\n "ArithmeticError Asser...site-packages",\n "/usr/lib64/python3.8/site-packages",\n "/usr/lib/python3.8/site-packages"\n ]\n}\n'
actual = "python3: can't open file '/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/covmain.zip': [Errno 2] No such file or directory\n"
def assert_tryexecfile_output(self, expected: str, actual: str) -> None:
"""Assert that the output we got is a successful run of try_execfile.py.
`expected` and `actual` must be the same, modulo a few slight known
platform differences.
"""
# First, is this even credible try_execfile.py output?
> assert '"DATA": "xyzzy"' in actual
E assert '"DATA": "xyzzy"' in "python3: can't open file '/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/covmain.zip': [Errno 2] No such file or directory\n"
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/test_process.py:674: AssertionError
----------------------------- Captured stdout call -----------------------------
{
"DATA": "xyzzy",
"FN_VAL": "my_fn('fooey')",
"__builtins__.dir": [
"ArithmeticError AssertionError AttributeError BaseException BlockingIOError BrokenPipeError BufferError BytesWarning ChildProcessError ConnectionAbortedError ConnectionError ConnectionRefusedError ConnectionResetError",
"DeprecationWarning EOFError Ellipsis EnvironmentError Exception False FileExistsError FileNotFoundError FloatingPointError FutureWarning",
"GeneratorExit IOError ImportError ImportWarning IndentationError IndexError InterruptedError IsADirectoryError",
"KeyError KeyboardInterrupt LookupError MemoryError ModuleNotFoundError NameError None NotADirectoryError NotImplemented NotImplementedError",
"OSError OverflowError PendingDeprecationWarning PermissionError ProcessLookupError RecursionError ReferenceError ResourceWarning RuntimeError RuntimeWarning",
"StopAsyncIteration StopIteration SyntaxError SyntaxWarning SystemError SystemExit TabError TimeoutError True TypeError",
"UnboundLocalError UnicodeDecodeError UnicodeEncodeError UnicodeError UnicodeTranslateError UnicodeWarning UserWarning",
"ValueError Warning ZeroDivisionError __build_class__ __debug__ __doc__ __import__ __loader__ __name__ __package__ __spec__",
"abs all any ascii bin bool breakpoint bytearray bytes",
"callable chr classmethod compile complex copyright credits delattr dict dir divmod",
"enumerate eval exec exit filter float format frozenset getattr globals",
"hasattr hash help hex id input int isinstance issubclass iter",
"len license list locals map max memoryview min next object oct open ord",
"pow print property quit range repr reversed round",
"set setattr slice sorted staticmethod str sum super tuple type vars zip"
],
"__builtins__.has_open": true,
"__doc__": "Test file for run_python_file.\n\nThis file is executed two ways::\n\n $ coverage run try_execfile.py\n\nand::\n\n $ python try_execfile.py\n\nThe output is compared to see that the program execution context is the same\nunder coverage and under Python.\n\nIt is not crucial that the execution be identical, there are some differences\nthat are OK. This program canonicalizes the output to gloss over those\ndifferences and get a clean diff.\n\n",
"__file__": "run_me.py",
"__loader__ exists": true,
"__loader__.fullname": "__main__",
"__main__.DATA": "xyzzy",
"__name__": "__main__",
"__package__": null,
"__spec__ exists": false,
"argv0": "run_me.py",
"argv1-n": [],
"os.getcwd": "/tmp/pytest-of-tkloczko/pytest-47/popen-gw15/t16",
"path": [
"/tmp/pytest-of-tkloczko/pytest-47/popen-gw15/t16",
"/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-7.2.7-2.fc35.x86_64/usr/lib64/python3.8/site-packages",
"/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-7.2.7-2.fc35.x86_64/usr/lib/python3.8/site-packages",
"/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/modules",
"/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/zipmods.zip",
"/usr/lib64/python38.zip",
"/usr/lib64/python3.8",
"/usr/lib64/python3.8/lib-dynload",
"/home/tkloczko/.local/lib/python3.8/site-packages",
"/usr/lib64/python3.8/site-packages",
"/usr/lib/python3.8/site-packages"
]
}
python3: can't open file '/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/tests/covmain.zip': [Errno 2] No such file or directory
____________________ test_xdist_sys_path_nuttiness_is_fixed ____________________
[gw2] linux -- Python 3.8.16 /usr/bin/python3
def test_xdist_sys_path_nuttiness_is_fixed() -> None:
# See conftest.py:fix_xdist_sys_path
assert sys.path[1] != ''
> assert os.environ.get('PYTHONPATH') is None
E AssertionError: assert '/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-7.2.7-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-7.2.7-2.fc35.x86_64/usr/lib/python3.8/site-packages' is None
E + where '/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-7.2.7-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-7.2.7-2.fc35.x86_64/usr/lib/python3.8/site-packages' = <bound method Mapping.get of environ({'PATH': '/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-7.2.7-2.fc35.x86_64/u...T_WORKER_COUNT': '48', 'PYTEST_CURRENT_TEST': 'tests/test_testing.py::test_xdist_sys_path_nuttiness_is_fixed (call)'})>('PYTHONPATH')
E + where <bound method Mapping.get of environ({'PATH': '/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-7.2.7-2.fc35.x86_64/u...T_WORKER_COUNT': '48', 'PYTEST_CURRENT_TEST': 'tests/test_testing.py::test_xdist_sys_path_nuttiness_is_fixed (call)'})> = environ({'PATH': '/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-7.2.7-2.fc35.x86_64/usr/bin:/usr/bin:/usr/local/sb...ST_WORKER_COUNT': '48', 'PYTEST_CURRENT_TEST': 'tests/test_testing.py::test_xdist_sys_path_nuttiness_is_fixed (call)'}).get
E + where environ({'PATH': '/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-7.2.7-2.fc35.x86_64/usr/bin:/usr/bin:/usr/local/sb...ST_WORKER_COUNT': '48', 'PYTEST_CURRENT_TEST': 'tests/test_testing.py::test_xdist_sys_path_nuttiness_is_fixed (call)'}) = os.environ
tests/test_testing.py:33: AssertionError
=============================== warnings summary ===============================
tests/test_plugins.py::GoodFileTracerTest::test_defer_to_python
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/coverage/control.py:555: CoverageWarning: Plugin file tracers (fairly_odd_plugin.Plugin) aren't supported with PyTracer
self._warn(
tests/test_plugins.py::BadFileTracerTest::test_plugin_has_inherited_filereporter_method
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/coverage/control.py:555: CoverageWarning: Plugin file tracers (bad_plugin.Plugin) aren't supported with PyTracer
self._warn(
tests/test_plugins.py::GoodFileTracerTest::test_find_unexecuted
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/coverage/control.py:555: CoverageWarning: Plugin file tracers (unexecuted_plugin.Plugin) aren't supported with PyTracer
self._warn(
tests/test_plugins.py::GoodFileTracerTest::test_plugin2_with_text_report
tests/test_plugins.py::GoodFileTracerTest::test_plugin2_with_xml_report
tests/test_plugins.py::GoodFileTracerTest::test_plugin2_with_html_report
tests/test_plugins.py::GoodFileTracerTest::test_plugin2_with_branch
tests/test_plugins.py::GoodFileTracerTest::test_plugin2
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/coverage/control.py:555: CoverageWarning: Plugin file tracers (tests.plugin2.Plugin) aren't supported with PyTracer
self._warn(
tests/test_plugins.py::GoodFileTracerTest::test_plugin1
/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.7/coverage/control.py:555: CoverageWarning: Plugin file tracers (tests.plugin1.Plugin) aren't supported with PyTracer
self._warn(
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
SKIPPED [1] tests/test_arcs.py:1359: Match-case is new in 3.10
SKIPPED [1] tests/test_arcs.py:1327: Match-case is new in 3.10
SKIPPED [1] tests/test_arcs.py:1374: Match-case is new in 3.10
SKIPPED [1] tests/test_arcs.py:1343: Match-case is new in 3.10
SKIPPED [3] tests/test_concurrency.py:229: Can't test: Couldn't trace with concurrency=eventlet, the module isn't installed.
SKIPPED [2] tests/test_concurrency.py:229: Can't test: Couldn't trace with concurrency=gevent, the module isn't installed.
SKIPPED [2] tests/test_concurrency.py:229: Can't test: Couldn't trace with concurrency=greenlet, the module isn't installed.
SKIPPED [2] tests/test_concurrency.py:481: Can't test: Couldn't trace with concurrency=eventlet, the module isn't installed.
SKIPPED [1] tests/test_concurrency.py:347: Can't run test without gevent installed.
SKIPPED [1] tests/test_files.py:579: This test assumes Windows file system
SKIPPED [1] tests/test_files.py:691: Only need to run Windows tests on Windows.
SKIPPED [1] tests/test_oddball.py:210: This is too expensive for now (30s)
SKIPPED [1] tests/test_parser.py:445: Match-case is new in 3.10
SKIPPED [1] tests/test_plugins.py:278: This test is only about PyTracer.
SKIPPED [1] tests/test_phystokens.py:119: Soft keywords are new in Python 3.10
SKIPPED [1] tests/test_python.py:53: not windows
SKIPPED [1] tests/test_report.py:787: .pyw files are only on Windows.
SKIPPED [1] tests/test_xml.py:482: trailing backslash is only for Windows
XFAIL tests/test_arcs.py::LoopArcTest::test_incorrect_if_bug_1175 - <3.10 traced final pass incorrectly
XFAIL tests/test_arcs.py::LoopArcTest::test_incorrect_loop_exit_bug_1175 - <3.10 traced final pass incorrectly
ERROR tests/test_venv.py::VirtualenvTest::test_third_party_venv_isnt_measured[coverage-True]
ERROR tests/test_venv.py::VirtualenvTest::test_third_party_venv_isnt_measured[coverage-False]
ERROR tests/test_venv.py::VirtualenvTest::test_third_party_venv_isnt_measured[python -m coverage-True]
ERROR tests/test_venv.py::VirtualenvTest::test_third_party_venv_isnt_measured[python -m coverage-False]
ERROR tests/test_venv.py::VirtualenvTest::test_us_in_venv_isnt_measured[coverage]
ERROR tests/test_venv.py::VirtualenvTest::test_us_in_venv_isnt_measured[python -m coverage]
ERROR tests/test_venv.py::VirtualenvTest::test_venv_isnt_measured[coverage]
ERROR tests/test_venv.py::VirtualenvTest::test_venv_isnt_measured[python -m coverage]
ERROR tests/test_venv.py::VirtualenvTest::test_venv_with_dynamic_plugin[coverage]
ERROR tests/test_venv.py::VirtualenvTest::test_venv_with_dynamic_plugin[python -m coverage]
ERROR tests/test_venv.py::VirtualenvTest::test_installed_namespace_packages[coverage]
ERROR tests/test_venv.py::VirtualenvTest::test_installed_namespace_packages[python -m coverage]
ERROR tests/test_venv.py::VirtualenvTest::test_bug_888[coverage] - assert 127...
ERROR tests/test_venv.py::VirtualenvTest::test_bug_888[python -m coverage] - ...
FAILED tests/test_cmdline.py::CmdLineStdoutTest::test_version - AssertionErro...
FAILED tests/test_debug.py::DebugTraceTest::test_debug_sys_ctracer - Assertio...
FAILED tests/test_filereporter.py::FileReporterTest::test_zipfile - ModuleNot...
FAILED tests/test_plugins.py::GoodFileTracerTest::test_defer_to_python - Asse...
FAILED tests/test_plugins.py::PluginTest::test_plugin_sys_info - AssertionErr...
FAILED tests/test_plugins.py::BadFileTracerTest::test_file_tracer_fails_eventually
FAILED tests/test_plugins.py::BadFileTracerTest::test_line_number_range_returns_non_tuple
FAILED tests/test_plugins.py::BadFileTracerTest::test_plugin_has_inherited_filereporter_method
FAILED tests/test_plugins.py::BadFileTracerTest::test_source_filename_fails
FAILED tests/test_plugins.py::GoodFileTracerTest::test_find_unexecuted - asse...
FAILED tests/test_plugins.py::BadFileTracerTest::test_dynamic_source_filename_fails
FAILED tests/test_plugins.py::BadFileTracerTest::test_file_tracer_returns_wrong
FAILED tests/test_plugins.py::BadFileTracerTest::test_file_tracer_has_inherited_sourcefilename_method
FAILED tests/test_plugins.py::BadFileTracerTest::test_line_number_range_raises_error
FAILED tests/test_plugins.py::GoodFileTracerTest::test_plugin2_with_text_report
FAILED tests/test_plugins.py::BadFileTracerTest::test_source_filename_returns_wrong
FAILED tests/test_plugins.py::BadFileTracerTest::test_line_number_range_returns_triple
FAILED tests/test_plugins.py::BadFileTracerTest::test_file_tracer_fails - ass...
FAILED tests/test_plugins.py::BadFileTracerTest::test_file_tracer_has_no_file_tracer_method
FAILED tests/test_plugins.py::GoodFileTracerTest::test_plugin2_with_xml_report
FAILED tests/test_plugins.py::BadFileTracerTest::test_has_dynamic_source_filename_fails
FAILED tests/test_plugins.py::GoodFileTracerTest::test_plugin2_with_html_report
FAILED tests/test_plugins.py::BadFileTracerTest::test_line_number_range_returns_pair_of_strings
FAILED tests/test_plugins.py::GoodFileTracerTest::test_plugin1 - coverage.exc...
FAILED tests/test_process.py::ProcessStartupWithSourceTest::test_pth_and_source_work_together[main-pkg-]
FAILED tests/test_process.py::ProcessTest::test_tests_dir_is_importable - ass...
FAILED tests/test_plugins.py::GoodFileTracerTest::test_plugin2_with_branch - ...
FAILED tests/test_process.py::ProcessStartupWithSourceTest::test_pth_and_source_work_together[sub---m]
FAILED tests/test_process.py::ProcessStartupWithSourceTest::test_pth_and_source_work_together[sub-pkg--m]
FAILED tests/test_plugins.py::GoodFileTracerTest::test_plugin2 - coverage.exc...
FAILED tests/test_report.py::SummaryTest::test_report_just_one - ModuleNotFou...
FAILED tests/test_process.py::ProcessTest::test_fullcoverage - AssertionError...
FAILED tests/test_process.py::ProcessStartupTest::test_subprocess_with_pth_files
FAILED tests/test_process.py::ProcessStartupWithSourceTest::test_pth_and_source_work_together[sub--]
FAILED tests/test_process.py::ProcessStartupWithSourceTest::test_pth_and_source_work_together[sub-pkg-]
FAILED tests/test_process.py::ProcessStartupWithSourceTest::test_pth_and_source_work_together[main--]
FAILED tests/test_report.py::SummaryTest::test_report_include_relative_files_and_wildcard_path
FAILED tests/test_process.py::ProcessStartupWithSourceTest::test_pth_and_source_work_together[main-pkg--m]
FAILED tests/test_process.py::ProcessStartupWithSourceTest::test_pth_and_source_work_together[main---m]
FAILED tests/test_report.py::SummaryTest::test_report_omitting - ModuleNotFou...
FAILED tests/test_report.py::SummaryTest::test_report_include_relative_files_and_path
FAILED tests/test_report.py::SummaryTest::test_report_including - ModuleNotFo...
FAILED tests/test_process.py::ProcessStartupTest::test_subprocess_with_pth_files_and_parallel
FAILED tests/test_python.py::GetZipBytesTest::test_get_encoded_zip_files[utf-8]
FAILED tests/test_python.py::GetZipBytesTest::test_get_encoded_zip_files[gb2312]
FAILED tests/test_python.py::GetZipBytesTest::test_get_encoded_zip_files[hebrew]
FAILED tests/test_python.py::GetZipBytesTest::test_get_encoded_zip_files[shift_jis]
FAILED tests/test_report.py::SummaryTest::test_report - ModuleNotFoundError: ...
FAILED tests/test_python.py::GetZipBytesTest::test_get_encoded_zip_files[cp1252]
FAILED tests/test_report.py::SummaryTest::test_report_wildcard - AssertionErr...
FAILED tests/test_process.py::EnvironmentTest::test_coverage_zip_is_like_python
FAILED tests/test_testing.py::test_xdist_sys_path_nuttiness_is_fixed - Assert...
52 failed, 1256 passed, 23 skipped, 2 xfailed, 9 warnings, 14 errors in 15.03s |
Please stop commenting on closed issues. |
I'm trying to package your module as an rpm package. So I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.
python3 -sBm build -w --no-isolation
build
with--no-isolation
I'm using during all processes only locally installed modulesHere is pytest output:
List of module sinstalled in build env
The text was updated successfully, but these errors were encountered: