nedbat / coveragepy

The code coverage tool for Python
https://coverage.readthedocs.io
Apache License 2.0
3.01k stars 433 forks source link

6.3.3: pytest is failing with INTERNALERROR #1373

Closed kloczek closed 1 year ago

kloczek commented 2 years ago

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.

Here is pytest output:

+ 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
+ /usr/bin/pytest -ra
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.3.3/tests/conftest.py", line 89, in pytest_sessionstart
INTERNALERROR>     assert pth_dir
INTERNALERROR> AssertionError: assert None

List of module sinstalled in build env

Package                       Version
----------------------------- -----------------
alabaster                     0.7.12
attrs                         21.4.0
Babel                         2.10.1
Brlapi                        0.8.3
build                         0.7.0
charset-normalizer            2.0.12
codespell                     2.1.0
cycler                        0.11.0
distlib                       0.3.4
distro                        1.7.0
docutils                      0.17.1
execnet                       1.9.0
extras                        1.0.0
filelock                      3.6.0
fixtures                      4.0.0
flaky                         3.7.0
fonttools                     4.33.3
gpg                           1.17.1-unknown
idna                          3.3
imagesize                     1.3.0
importlib-metadata            4.11.3
importlib-resources           5.7.0
iniconfig                     1.1.1
Jinja2                        3.1.1
kiwisolver                    1.3.2
libcomps                      0.1.18
louis                         3.21.0
MarkupSafe                    2.1.1
matplotlib                    3.5.1
numpy                         1.22.3
olefile                       0.46
packaging                     21.3
pbr                           5.8.1
pep517                        0.12.0
Pillow                        9.1.0
pip                           22.0.4
platformdirs                  2.5.2
pluggy                        1.0.0
py                            1.11.0
pyenchant                     3.2.2
Pygments                      2.12.0
PyGObject                     3.42.1
pyparsing                     3.0.9
pytest                        7.1.2
pytest-forked                 1.4.0
pytest-xdist                  2.5.0
python-dateutil               2.8.2
pytz                          2022.1
requests                      2.27.1
rpm                           4.17.0
setuptools                    62.2.0
six                           1.16.0
snowballstemmer               2.2.0
Sphinx                        4.5.0
sphinx-rst-builder            0.0.3
sphinx-rtd-theme              1.0.0
sphinx-tabs                   3.3.1
sphinxcontrib-applehelp       1.0.2.dev20220410
sphinxcontrib-devhelp         1.0.2.dev20220410
sphinxcontrib-htmlhelp        2.0.0
sphinxcontrib-jsmath          1.0.1.dev20220410
sphinxcontrib-qthelp          1.0.3.dev20220410
sphinxcontrib-restbuilder     0.3
sphinxcontrib-serializinghtml 1.1.5
sphinxcontrib-spelling        7.3.2
testtools                     2.5.0
toml                          0.10.2
tomli                         2.0.1
typing_extensions             4.2.0
unittest-mixins               1.6
urllib3                       1.26.9
virtualenv                    20.13.4
wheel                         0.37.1
zipp                          3.8.0
nedbat commented 2 years ago

It looks like coverage can't find a place to write a .pth file. Are none of the directories in sys.path writable?

kloczek commented 2 years ago

Just found new 6.4 version and tested that using strace

```console + 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? 🤔 Extracted all Permission denied strace lines:

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 🤔

kloczek commented 2 years ago

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]$
kloczek commented 2 years ago

Any update? Just tested 6.4.1 and pytest is failing the same way.

nedbat commented 2 years ago

"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.

kloczek commented 2 years ago

"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?

OK .. but which one directories? 😋 sys.path is altersd by env variable

+ 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

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.

Issue is that in this case pytest is failing on collecting units 😃 AFAIK skipping is only possible after finishing that stage.

nedbat commented 2 years ago

OK .. but which one directories? 😋 sys.path is altersd by env variable

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.

kloczek commented 2 years ago

Just tesated 6.4.2. Looks like it is better now becaus pytest is able to collect unit ad start testing. However it shows fails and errors.

```console + 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=, _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=, _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=, _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=, _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=, _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=, _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=, _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=, _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=, _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=, _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=, _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=, _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 = 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 "] [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 = , 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 = , 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 = , 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 ` 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 = > kwargs = {'branch': None, 'concurrency': None, 'context': None, 'cover_pylib': None, ...}, config = 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 = , filename = 'pyproject.toml' warn = >, 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 = , 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 = , 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 = , 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 = , 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 ` 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 = > kwargs = {'branch': None, 'concurrency': None, 'context': None, 'cover_pylib': None, ...}, config = 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 = , filename = 'pyproject.toml' warn = >, 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 = , 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 = , 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 = , 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 = , 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 ` 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 = > kwargs = {'branch': None, 'concurrency': None, 'context': None, 'cover_pylib': None, ...}, config = 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 = , filename = 'pyproject.toml' warn = >, 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 = , 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 = , 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 = , 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 = , 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 ` 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 = > kwargs = {'branch': None, 'concurrency': None, 'context': None, 'cover_pylib': None, ...}, config = 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 = , filename = 'pyproject.toml' warn = >, 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 = , 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 = , 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 = 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 = , 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 = , 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 = , 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 ` 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 = > kwargs = {'branch': None, 'concurrency': None, 'context': None, 'cover_pylib': None, ...}, config = 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 = , filename = 'pyproject.toml' warn = >, 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 = , 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 = , 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 = 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 = 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 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 import covmodzip1 ModuleNotFoundError: No module named 'covmodzip1' _____________________________________________________________ ConfigTest.test_environment_vars_in_toml_config ______________________________________________________________ [gw33] linux -- Python 3.8.13 /usr/bin/python3 self = 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 = , 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 = , 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 = , 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 ` 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 = > kwargs = {'branch': None, 'concurrency': None, 'context': None, 'cover_pylib': None, ...}, config = 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 = , filename = 'pyproject.toml' warn = >, 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 = , 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 = , 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 = , 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 = 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 = , 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 = , 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 = , 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 = , 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 = 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) :843: in exec_module ??? :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 = 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) :843: in exec_module ??? :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 = , 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 = 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 = 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 = @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 "", line 1, in ... 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 "", line 1, in 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 = , 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 = , 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 ` 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 = > kwargs = {'branch': None, 'concurrency': None, 'context': None, 'cover_pylib': None, ...}, config = 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 = , filename = 'pyproject.toml' warn = >, 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 = , 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 = , 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' = ('PYTHONPATH') 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)'}).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 = 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 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 = 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) :843: in exec_module ??? :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 = 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) :843: in exec_module ??? :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 ```
kloczek commented 2 years ago

Just FTR: tested 6.4.3 and result still is the same.

kloczek commented 2 years ago

OK .. but which one directories? 😋 sys.path is altersd by env variable

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.

Can you drop patch with such instrumentation?

nedbat commented 2 years ago

I added some quick verbose debugging in branch nedbat/debug-1373. Install it like this:

pip install git+https://github.com/nedbat/coveragepy@nedbat/debug-1373

then /tmp/coverage_pth_files.txt has details.

kloczek commented 1 year ago

Here is result or 7.0.1 + https://github.com/nedbat/coveragepy/commit/54ea97a3afb27a166a01021c3d2e1fecb8d83551

```console [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 ```
kloczek commented 1 year ago

Hmm .. so looks like test suite is trying to write files in python sitelib drecory 🤔

nedbat commented 1 year ago

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:

1) You give me very very explicit specific directions about how to do what you are doing, so I can understand it better. 2) I update the coverage.py test suite to skip tests if a pth place couldn't be found. I'm not sure how many that would be, and how much confidence we would lose.

I would prefer #1.

kloczek commented 1 year ago

May I ask why test suite is trying to write something in system sitelib directory? 🤔

nedbat commented 1 year ago

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:

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--m] - 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::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[sub-pkg-] - AssertionError: File '.coverage' should exist
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 - assert 100 == 3
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[main--] - AssertionError: File '.coverage' should exist
FAILED tests/test_process.py::ProcessStartupTest::test_subprocess_with_pth_files_and_parallel - KeyError: 'sub.py'

May I ask why you don't have a writable directory in sys.path?

kloczek commented 1 year ago

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

+ 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
+ /usr/bin/pytest -ra

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>.

nedbat commented 1 year ago

@kloczek I really appreciate that you are persisting with this. Please keep i mind that I know nothing about how rpm packages are made.

Please have a look one more time on first two lines of the log...

What in those lines would tell me that the directories aren't writable?

In $PYTHONPATH is passed directory with write access however that directory should not be used to write anything else...

If it is writable, then what is making the test setup fail? It seems the directory is not writable.

kloczek commented 1 year ago

Trust me this issue has nothing to do with rpm .. don't worry about that I'm packaging 'coveragepy`😄

If it is writable, then what is making the test setup fail? It seems the directory is not writable.

Please have look one more time on the output of the pytest with instrumentation patch which you've prepared. In the output it is clarly wisible that test suite is not trying to write anything in /home/tkloczko/rpmbuild/BUILDROOT/python-coverage-6.3.3-2.fc35.x86_64/usr/lib64/python3.8/site-packages

nedbat commented 1 year ago

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?

kloczek commented 1 year ago

Tested that and looks like first time ever pytest started without internal error however I see now a lot of failing units Here is list of installed modules in build env

```console + 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=, _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=, _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=, _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=, _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=, _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=, _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=, _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=, _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=, _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=, _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=, _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=, _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 = 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 = 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 = 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 = 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 = 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 = 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 /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 = 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 = , 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 = 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 = 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 = , 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 = ('# Oh noes!') E + where = "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 = 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 = , 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 = 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 = , 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 = 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 = , 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 = 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 = , 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 = ('# Oh noes!') E + where = "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 = 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 = , 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 = ('# Oh noes!') E + where = "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 = 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 = , 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 = ('# Oh noes!') E + where = "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 = 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 = , 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 = 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 = , 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 = 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 = , 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 = 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 = , 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 = 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 = , 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 = 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 = , 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 = , 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 = 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 = , 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 = 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 = , 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 = ('# Oh noes!') E + where = "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 = 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 = , 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 = 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 = , 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 = 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 = , 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 = 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 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 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 = , 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 = , 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 = , 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 = , 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 = @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 = , 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 = , 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 = ('.coverage') E + where = .exists E + where = 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 = , 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 = , 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 = , 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 = ('.coverage') E + where = .exists E + where = 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 = , 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 = , 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 = ('.coverage') E + where = .exists E + where = 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 = , 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 = , 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 = ('.coverage') E + where = .exists E + where = 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 = 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) :843: in exec_module ??? :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 = 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 = , 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 = , 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 = ('.coverage') E + where = .exists E + where = 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 = , 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 = , 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 = ('.coverage') E + where = .exists E + where = 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 = , 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 = , 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 = ('.coverage') E + where = .exists E + where = 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 = 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 = 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 = , 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 = , 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 = ('.coverage') E + where = .exists E + where = 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 = 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' = ('PYTHONPATH') 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)'}).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 = 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) :843: in exec_module ??? :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 = 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 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 = 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) :843: in exec_module ??? :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 = 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) :843: in exec_module ??? :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 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 : [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 : [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 : [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 : [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 : [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 : [Errno 39] Directory not empty: '/tmp/pytest-of-tkloczko/garbage-16a01919-b319-49f9-871c-afade6895c4c' warnings.warn( ```
kloczek commented 1 year ago

Things like "python -m pip install " shout be replced by "pip install ". I have no python executable and rinning python -m foo should not be used because python in such cases adds current irectory to sys.path which alwaysis nothing more than asking for troubles .. Only this will bring few units to the working stata 😋

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? 🤔 Adnd second is: it is really necessary to write some files to the sitelib? Fidling outside /tmp or source tree looks a bit odd .. 🤔

kloczek commented 1 year ago

I'm going add in my packaging procedure tempporary those failing units to --deselect list to have some working baseline.

nedbat commented 1 year ago

I can't reproduce what you are seeing. Can you give me exact steps to reproduce your scenario?

kloczek commented 1 year ago

Excact steps are listed in descriptio openig this ticket. Just in case .. build and testing is performed fron non-root account.

kloczek commented 1 year ago

Just tested 7.2.1. Here is pytest output:

```console + PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-7.2.1-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-7.2.1-2.fc35.x86_64/usr/lib/python3.8/site-packages + /usr/bin/pytest -ra -m 'not network' bringing up nodes... ............................................................................................................................................................s...s..x..........s.x.... [ 13%] ....................s.............................................F..........................................................................................s....................... [ 27%] sss...s.s.........s..s........................s..s................................................................................................................................... [ 40%] ..........................F........................................F................................................................................................................. [ 54%] ..................................................................s.........................s......................................................................................... [ 68%] ................................s...............s.....s............s......F..F.FFFF.FFFF.FFFFFFF.FFFF.F.......Fs.F.F..F..F.....F.F...F......................F.............F....F...F. [ 81%] ......F.......F...........F............................................F..F........................F...F...............................................F............E..E..E.......F.. [ 95%] ........E..E..E......E.....E....E...E...E.E.s...F.F.FF..... [100%] ========================================================================================== ERRORS =========================================================================================== ______________________________________________________ ERROR at setup of VirtualenvTest.test_third_party_venv_isnt_measured[coverage] _______________________________________________________ [gw39] linux -- Python 3.8.16 /usr/bin/python3 tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-13/popen-gw39'), _trace=, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-13/popen-gw39')) @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", """\ 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:145: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1' 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[python -m coverage] __________________________________________________ [gw39] linux -- Python 3.8.16 /usr/bin/python3 tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-13/popen-gw39'), _trace=, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-13/popen-gw39')) @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", """\ 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:145: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1' 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] __________________________________________________________ [gw39] linux -- Python 3.8.16 /usr/bin/python3 tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-13/popen-gw39'), _trace=, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-13/popen-gw39')) @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", """\ 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:145: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1' 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] _____________________________________________________ [gw39] linux -- Python 3.8.16 /usr/bin/python3 tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-13/popen-gw39'), _trace=, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-13/popen-gw39')) @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", """\ 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:145: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1' 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] _____________________________________________________________ [gw39] linux -- Python 3.8.16 /usr/bin/python3 tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-13/popen-gw39'), _trace=, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-13/popen-gw39')) @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", """\ 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:145: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1' 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] ________________________________________________________ [gw39] linux -- Python 3.8.16 /usr/bin/python3 tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-13/popen-gw39'), _trace=, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-13/popen-gw39')) @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", """\ 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:145: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1' 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] __________________________________________________________ [gw39] linux -- Python 3.8.16 /usr/bin/python3 tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-13/popen-gw39'), _trace=, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-13/popen-gw39')) @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", """\ 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:145: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1' 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] _____________________________________________________ [gw39] linux -- Python 3.8.16 /usr/bin/python3 tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-13/popen-gw39'), _trace=, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-13/popen-gw39')) @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", """\ 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:145: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1' 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] ________________________________________________________ [gw39] linux -- Python 3.8.16 /usr/bin/python3 tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-13/popen-gw39'), _trace=, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-13/popen-gw39')) @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", """\ 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:145: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1' 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] ___________________________________________________ [gw39] linux -- Python 3.8.16 /usr/bin/python3 tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-13/popen-gw39'), _trace=, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-13/popen-gw39')) @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", """\ 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:145: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1' 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] __________________________________________________________________ [gw39] linux -- Python 3.8.16 /usr/bin/python3 tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-13/popen-gw39'), _trace=, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-13/popen-gw39')) @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", """\ 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:145: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1' 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] _____________________________________________________________ [gw39] linux -- Python 3.8.16 /usr/bin/python3 tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-13/popen-gw39'), _trace=, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-13/popen-gw39')) @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", """\ 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:145: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1' 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 _______________________________________________________________________________ [gw30] linux -- Python 3.8.16 /usr/bin/python3 self = 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.1 without C extension\nFull documentation is at https://coverage.readthedocs.io/en/7.2.1\n' tests/test_cmdline.py:1002: AssertionError ___________________________________________________________________________ DebugTraceTest.test_debug_sys_ctracer ___________________________________________________________________________ [gw22] linux -- Python 3.8.16 /usr/bin/python3 self = 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.1/tests/test_debug.py:200: AssertionError _______________________________________________________________________________ FileReporterTest.test_zipfile _______________________________________________________________________________ [gw27] linux -- Python 3.8.16 /usr/bin/python3 self = 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 ______________________________________________________________________________ PluginTest.test_plugin_sys_info ______________________________________________________________________________ [gw33] linux -- Python 3.8.16 /usr/bin/python3 self = 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.1', 'coverage_module: /home/...init__.py', 'tracer: PyTracer', 'CTracer: unavailable', 'plugins.file_tracers: plugin_sys_info.Plugin (disabled)', ...] /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/tests/test_plugins.py:216: AssertionError __________________________________________________________________________ GoodFileTracerTest.test_find_unexecuted __________________________________________________________________________ [gw27] linux -- Python 3.8.16 /usr/bin/python3 self = 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.1/tests/test_plugins.py:574: AssertionError ______________________________________________________________ BadFileTracerTest.test_plugin_has_inherited_filereporter_method ______________________________________________________________ [gw35] linux -- Python 3.8.16 /usr/bin/python3 self = 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 /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/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_file_tracer_fails __________________________________________________________________________ [gw18] linux -- Python 3.8.16 /usr/bin/python3 self = 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.1/tests/test_plugins.py:733: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , 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 = ('# Oh noes!') E + where = "Plugin file tracers (bad_plugin.Plugin) aren't supported with PyTracer".count /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/tests/test_plugins.py:655: AssertionError ____________________________________________________________________ BadFileTracerTest.test_file_tracer_fails_eventually ____________________________________________________________________ [gw44] linux -- Python 3.8.16 /usr/bin/python3 self = 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.1/tests/test_plugins.py:764: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , 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 = ('# Oh noes!') E + where = "Plugin file tracers (bad_plugin.Plugin) aren't supported with PyTracer".count /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/tests/test_plugins.py:655: AssertionError _________________________________________________________________ BadFileTracerTest.test_has_dynamic_source_filename_fails __________________________________________________________________ [gw23] linux -- Python 3.8.16 /usr/bin/python3 self = 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.1/tests/test_plugins.py:794: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , 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 = ('# Oh noes!') E + where = "Plugin file tracers (bad_plugin.Plugin) aren't supported with PyTracer".count /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/tests/test_plugins.py:655: AssertionError __________________________________________________________________ BadFileTracerTest.test_line_number_range_returns_triple __________________________________________________________________ [gw34] linux -- Python 3.8.16 /usr/bin/python3 self = 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.1/tests/test_plugins.py:917: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , 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.1/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.1/coverage/control.py\', lineno : 553, line : None}'] _____________________________________________________________________ BadFileTracerTest.test_file_tracer_returns_wrong ______________________________________________________________________ [gw15] linux -- Python 3.8.16 /usr/bin/python3 self = 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.1/tests/test_plugins.py:776: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , 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.1/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.1/coverage/control.py\', lineno : 553, line : None}'] ___________________________________________________________________ BadFileTracerTest.test_source_filename_returns_wrong ____________________________________________________________________ [gw26] linux -- Python 3.8.16 /usr/bin/python3 self = 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.1/tests/test_plugins.py:826: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , 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.1/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.1/coverage/control.py\', lineno : 553, line : None}'] _______________________________________________________________________ BadFileTracerTest.test_source_filename_fails ________________________________________________________________________ [gw38] linux -- Python 3.8.16 /usr/bin/python3 self = 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.1/tests/test_plugins.py:810: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , 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 = ('# Oh noes!') E + where = "Plugin file tracers (bad_plugin.Plugin) aren't supported with PyTracer".count /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/tests/test_plugins.py:655: AssertionError ________________________________________________________________ BadFileTracerTest.test_line_number_range_returns_non_tuple _________________________________________________________________ [gw14] linux -- Python 3.8.16 /usr/bin/python3 self = 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.1/tests/test_plugins.py:895: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , 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.1/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.1/coverage/control.py\', lineno : 553, line : None}'] ___________________________________________________________________ BadFileTracerTest.test_line_number_range_raises_error ___________________________________________________________________ [gw45] linux -- Python 3.8.16 /usr/bin/python3 self = 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.1/tests/test_plugins.py:873: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , 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.1/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.1/coverage/control.py\', lineno : 553, line : None}'] _______________________________________________________________ BadFileTracerTest.test_file_tracer_has_no_file_tracer_method ________________________________________________________________ [gw16] linux -- Python 3.8.16 /usr/bin/python3 self = 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.1/tests/test_plugins.py:682: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , 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.1/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.1/coverage/control.py\', lineno : 553, line : None}'] ___________________________________________________________________ BadFileTracerTest.test_dynamic_source_filename_fails ____________________________________________________________________ [gw19] linux -- Python 3.8.16 /usr/bin/python3 self = 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.1/tests/test_plugins.py:853: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , 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 = ('# Oh noes!') E + where = "Plugin file tracers (bad_plugin.Plugin) aren't supported with PyTracer".count /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/tests/test_plugins.py:655: AssertionError _____________________________________________________________________ GoodFileTracerTest.test_plugin2_with_text_report ______________________________________________________________________ [gw0] linux -- Python 3.8.16 /usr/bin/python3 self = 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.1/tests/test_plugins.py:423: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/control.py:1059: in report return reporter.report(morfs, outfile=file) /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/summary.py:181: in report for fr, analysis in get_analysis_to_report(self.coverage, morfs): _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ coverage = , 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.1/coverage/report.py:94: NoDataError ______________________________________________________________________ GoodFileTracerTest.test_plugin2_with_xml_report ______________________________________________________________________ [gw21] linux -- Python 3.8.16 /usr/bin/python3 self = 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.1/tests/test_plugins.py:459: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/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.1/coverage/report.py:59: in render_report ret = reporter.report(morfs, outfile=outfile) /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/xmlreport.py:103: in report for fr, analysis in get_analysis_to_report(self.coverage, morfs): _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ coverage = , 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.1/coverage/report.py:94: NoDataError _____________________________________________________________ BadFileTracerTest.test_line_number_range_returns_pair_of_strings ______________________________________________________________ [gw43] linux -- Python 3.8.16 /usr/bin/python3 self = 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.1/tests/test_plugins.py:939: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , 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.1/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.1/coverage/control.py\', lineno : 553, line : None}'] _____________________________________________________________________ GoodFileTracerTest.test_plugin2_with_html_report ______________________________________________________________________ [gw37] linux -- Python 3.8.16 /usr/bin/python3 self = 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.1/tests/test_plugins.py:444: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/control.py:1155: in html_report ret = reporter.report(morfs) /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/html.py:277: in report for fr, analysis in get_analysis_to_report(self.coverage, morfs): _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ coverage = , 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.1/coverage/report.py:94: NoDataError __________________________________________________________ BadFileTracerTest.test_file_tracer_has_inherited_sourcefilename_method ___________________________________________________________ [gw24] linux -- Python 3.8.16 /usr/bin/python3 self = 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.1/tests/test_plugins.py:698: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , 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.1/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.1/coverage/control.py\', lineno : 553, line : None}'] __________________________________________________________________________ GoodFileTracerTest.test_defer_to_python __________________________________________________________________________ [gw17] linux -- Python 3.8.16 /usr/bin/python3 self = 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.1/tests/test_plugins.py:532: AssertionError ______________________________________________________________________________ GoodFileTracerTest.test_plugin1 ______________________________________________________________________________ [gw32] linux -- Python 3.8.16 /usr/bin/python3 self = 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.1/tests/test_plugins.py:322: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/control.py:872: in analysis f, s, _, m, mf = self.analysis2(morf) /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/control.py:895: in analysis2 analysis = self._analyze(morf) /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/control.py:920: in _analyze return Analysis(data, self.config.precision, fr, self._file_mapper) /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/results.py:35: in __init__ self.statements = self.file_reporter.lines() /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/python.py:193: in lines return self.parser.statements /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/python.py:184: in parser self._parser = PythonParser( /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/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.1/coverage/python.py:63: NoSource ________________________________________________________________________ GoodFileTracerTest.test_plugin2_with_branch ________________________________________________________________________ [gw12] linux -- Python 3.8.16 /usr/bin/python3 self = , text = 'line 0\nline 1\nline 2\nline 3\nline 4\nline 5\nline 6\n', code = None filename = '/tmp/pytest-of-tkloczko/pytest-13/popen-gw12/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-13/popen-gw12/t11/foo_7.html", line 1 E line 0 E ^ E SyntaxError: invalid syntax /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/parser.py:388: SyntaxError The above exception was the direct cause of the following exception: self = 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.1/tests/test_plugins.py:406: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/control.py:920: in _analyze return Analysis(data, self.config.precision, fr, self._file_mapper) /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/results.py:35: in __init__ self.statements = self.file_reporter.lines() /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/python.py:193: in lines return self.parser.statements /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/python.py:188: in parser self._parser.parse_source() /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/parser.py:253: in parse_source self._raw_parse() /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/parser.py:211: in _raw_parse byte_parser = ByteParser(self.text, filename=self.filename) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , text = 'line 0\nline 1\nline 2\nline 3\nline 4\nline 5\nline 6\n', code = None filename = '/tmp/pytest-of-tkloczko/pytest-13/popen-gw12/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-13/popen-gw12/t11/foo_7.html' as Python source: 'invalid syntax' at line 1 /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/parser.py:390: NotPython ______________________________________________________________________________ GoodFileTracerTest.test_plugin2 ______________________________________________________________________________ [gw1] linux -- Python 3.8.16 /usr/bin/python3 self = , text = 'line 0\nline 1\nline 2\nline 3\nline 4\nline 5\nline 6\n', code = None filename = '/tmp/pytest-of-tkloczko/pytest-13/popen-gw1/t16/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-13/popen-gw1/t16/foo_7.html", line 1 E line 0 E ^ E SyntaxError: invalid syntax /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/parser.py:388: SyntaxError The above exception was the direct cause of the following exception: self = 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.1/tests/test_plugins.py:381: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/control.py:872: in analysis f, s, _, m, mf = self.analysis2(morf) /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/control.py:895: in analysis2 analysis = self._analyze(morf) /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/control.py:920: in _analyze return Analysis(data, self.config.precision, fr, self._file_mapper) /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/results.py:35: in __init__ self.statements = self.file_reporter.lines() /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/python.py:193: in lines return self.parser.statements /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/python.py:188: in parser self._parser.parse_source() /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/parser.py:253: in parse_source self._raw_parse() /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/parser.py:211: in _raw_parse byte_parser = ByteParser(self.text, filename=self.filename) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , text = 'line 0\nline 1\nline 2\nline 3\nline 4\nline 5\nline 6\n', code = None filename = '/tmp/pytest-of-tkloczko/pytest-13/popen-gw1/t16/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-13/popen-gw1/t16/foo_7.html' as Python source: 'invalid syntax' at line 1 /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/parser.py:390: NotPython _____________________________________________________________________ GetZipBytesTest.test_get_encoded_zip_files[utf-8] _____________________________________________________________________ [gw5] linux -- Python 3.8.16 /usr/bin/python3 self = , 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 = , 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 = , 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 = , 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 ____________________________________________________________________ GetZipBytesTest.test_get_encoded_zip_files[cp1252] _____________________________________________________________________ [gw5] linux -- Python 3.8.16 /usr/bin/python3 self = , 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 _________________________________________________________ ProcessStartupWithSourceTest.test_pth_and_source_work_together[sub-pkg-] __________________________________________________________ [gw13] linux -- Python 3.8.16 /usr/bin/python3 self = , 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.1/tests/test_process.py:1277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , 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 = ('.coverage') E + where = .exists E + where = os.path /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/tests/coveragetest.py:340: AssertionError ----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------ _________________________________________________________________________ ProcessTest.test_tests_dir_is_importable __________________________________________________________________________ [gw35] linux -- Python 3.8.16 /usr/bin/python3 self = 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 E + import covmodzip1 E + ModuleNotFoundError: No module named 'covmodzip1' /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/tests/test_process.py:54: AssertionError ----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------ Traceback (most recent call last): File "mycode.py", line 2, in import covmodzip1 ModuleNotFoundError: No module named 'covmodzip1' _______________________________________________________________________________ ProcessTest.test_fullcoverage _______________________________________________________________________________ [gw38] linux -- Python 3.8.16 /usr/bin/python3 self = @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.1/tests/test_process.py:574: AssertionError ----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------ /usr/bin/python3: No module named coverage ________________________________________________________ ProcessStartupWithSourceTest.test_pth_and_source_work_together[main-pkg--m] ________________________________________________________ [gw43] linux -- Python 3.8.16 /usr/bin/python3 self = , 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.1/tests/test_process.py:1277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , 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 = ('.coverage') E + where = .exists E + where = os.path /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/tests/coveragetest.py:340: AssertionError ----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------ ___________________________________________________________ ProcessStartupWithSourceTest.test_pth_and_source_work_together[sub--] ___________________________________________________________ [gw13] linux -- Python 3.8.16 /usr/bin/python3 self = , 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.1/tests/test_process.py:1277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , 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 = ('.coverage') E + where = .exists E + where = os.path /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/tests/coveragetest.py:340: AssertionError ----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------ _____________________________________________________________________ ProcessStartupTest.test_subprocess_with_pth_files _____________________________________________________________________ [gw15] linux -- Python 3.8.16 /usr/bin/python3 self = 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.1/tests/test_process.py:1170: AssertionError _____________________________________________________________________ EnvironmentTest.test_coverage_zip_is_like_python ______________________________________________________________________ [gw46] linux -- Python 3.8.16 /usr/bin/python3 self = 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.1/tests/test_process.py:804: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = 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.2.1/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.1/tests/covmain.zip': [Errno 2] No such file or directory\n" /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/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-13/popen-gw46/t21", "path": [ "/tmp/pytest-of-tkloczko/pytest-13/popen-gw46/t21", "/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-7.2.1-2.fc35.x86_64/usr/lib64/python3.8/site-packages", "/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-7.2.1-2.fc35.x86_64/usr/lib/python3.8/site-packages", "/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/tests/modules", "/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.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.2.1/tests/covmain.zip': [Errno 2] No such file or directory _____________________________________________________________________________ SummaryTest.test_report_just_one ______________________________________________________________________________ [gw36] linux -- Python 3.8.16 /usr/bin/python3 self = 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.1/tests/test_summary.py:70: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/tests/coveragetest.py:93: in start_import_stop mod = import_local_file(modname, modfile) /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/misc.py:336: in import_local_file spec.loader.exec_module(mod) :843: in exec_module ??? :219: in _call_with_frames_removed ??? _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ import covmod1 > import covmodzip1 E ModuleNotFoundError: No module named 'covmodzip1' /tmp/pytest-of-tkloczko/pytest-13/popen-gw36/t9/mycode.py:2: ModuleNotFoundError _________________________________________________________ ProcessStartupWithSourceTest.test_pth_and_source_work_together[main---m] __________________________________________________________ [gw24] linux -- Python 3.8.16 /usr/bin/python3 self = , 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.1/tests/test_process.py:1277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , 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 = ('.coverage') E + where = .exists E + where = os.path /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/tests/coveragetest.py:340: AssertionError ----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------ ________________________________________________________ ProcessStartupWithSourceTest.test_pth_and_source_work_together[sub-pkg--m] _________________________________________________________ [gw32] linux -- Python 3.8.16 /usr/bin/python3 self = , 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.1/tests/test_process.py:1277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , 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 = ('.coverage') E + where = .exists E + where = os.path /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/tests/coveragetest.py:340: AssertionError ----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------ _____________________________________________________________________________ SummaryTest.test_report_including _____________________________________________________________________________ [gw24] linux -- Python 3.8.16 /usr/bin/python3 self = 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.1/tests/test_summary.py:129: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/tests/coveragetest.py:93: in start_import_stop mod = import_local_file(modname, modfile) /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/misc.py:336: in import_local_file spec.loader.exec_module(mod) :843: in exec_module ??? :219: in _call_with_frames_removed ??? _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ import covmod1 > import covmodzip1 E ModuleNotFoundError: No module named 'covmodzip1' /tmp/pytest-of-tkloczko/pytest-13/popen-gw24/t19/mycode.py:2: ModuleNotFoundError ______________________________________________________________ ProcessStartupTest.test_subprocess_with_pth_files_and_parallel _______________________________________________________________ [gw17] linux -- Python 3.8.16 /usr/bin/python3 self = 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.1/tests/test_process.py:1191: KeyError ----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------ No data to combine __________________________________________________________________________ test_xdist_sys_path_nuttiness_is_fixed ___________________________________________________________________________ [gw39] 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.1-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-7.2.1-2.fc35.x86_64/usr/lib/python3.8/site-packages' is None E + where '/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-7.2.1-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-7.2.1-2.fc35.x86_64/usr/lib/python3.8/site-packages' = ('PYTHONPATH') E + where = environ({'PATH': '/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-7.2.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.2.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:33: AssertionError _________________________________________________________ ProcessStartupWithSourceTest.test_pth_and_source_work_together[main-pkg-] _________________________________________________________ [gw37] linux -- Python 3.8.16 /usr/bin/python3 self = , 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.1/tests/test_process.py:1277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , 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 = ('.coverage') E + where = .exists E + where = os.path /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/tests/coveragetest.py:340: AssertionError ----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------ __________________________________________________________ ProcessStartupWithSourceTest.test_pth_and_source_work_together[main--] ___________________________________________________________ [gw17] linux -- Python 3.8.16 /usr/bin/python3 self = , 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.1/tests/test_process.py:1277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , 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 = ('.coverage') E + where = .exists E + where = os.path /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/tests/coveragetest.py:340: AssertionError ----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------ __________________________________________________________________________________ SummaryTest.test_report __________________________________________________________________________________ [gw5] linux -- Python 3.8.16 /usr/bin/python3 self = def test_report(self) -> None: self.make_mycode() cov = coverage.Coverage() > self.start_import_stop(cov, "mycode") /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/tests/test_summary.py:48: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/tests/coveragetest.py:93: in start_import_stop mod = import_local_file(modname, modfile) /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/misc.py:336: in import_local_file spec.loader.exec_module(mod) :843: in exec_module ??? :219: in _call_with_frames_removed ??? _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ import covmod1 > import covmodzip1 E ModuleNotFoundError: No module named 'covmodzip1' /tmp/pytest-of-tkloczko/pytest-13/popen-gw5/t7/mycode.py:2: ModuleNotFoundError _____________________________________________________________________________ SummaryTest.test_report_omitting ______________________________________________________________________________ [gw5] linux -- Python 3.8.16 /usr/bin/python3 self = 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.1/tests/test_summary.py:109: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/tests/coveragetest.py:93: in start_import_stop mod = import_local_file(modname, modfile) /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/misc.py:336: in import_local_file spec.loader.exec_module(mod) :843: in exec_module ??? :219: in _call_with_frames_removed ??? _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ import covmod1 > import covmodzip1 E ModuleNotFoundError: No module named 'covmodzip1' /tmp/pytest-of-tkloczko/pytest-13/popen-gw5/t8/mycode.py:2: ModuleNotFoundError _____________________________________________________________________________ SummaryTest.test_report_wildcard ______________________________________________________________________________ [gw28] linux -- Python 3.8.16 /usr/bin/python3 self = 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.1/tests/test_summary.py:103: AssertionError ----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------ Traceback (most recent call last): File "mycode.py", line 2, in import covmodzip1 ModuleNotFoundError: No module named 'covmodzip1' Name Stmts Miss Cover ------------------------------- mycode.py 4 2 50% ------------------------------- TOTAL 4 2 50% __________________________________________________________ ProcessStartupWithSourceTest.test_pth_and_source_work_together[sub---m] __________________________________________________________ [gw12] linux -- Python 3.8.16 /usr/bin/python3 self = , 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.1/tests/test_process.py:1277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , 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 = ('.coverage') E + where = .exists E + where = os.path /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/tests/coveragetest.py:340: AssertionError ----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------ ===================================================================================== warnings summary ====================================================================================== tests/test_plugins.py::GoodFileTracerTest::test_find_unexecuted /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/control.py:553: CoverageWarning: Plugin file tracers (unexecuted_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.1/coverage/control.py:553: CoverageWarning: Plugin file tracers (bad_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.1/coverage/control.py:553: CoverageWarning: Plugin file tracers (tests.plugin2.Plugin) aren't supported with PyTracer self._warn( tests/test_plugins.py::GoodFileTracerTest::test_defer_to_python /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/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_plugin1 /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/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:1363: Match-case is new in 3.10 SKIPPED [1] tests/test_arcs.py:1316: Match-case is new in 3.10 SKIPPED [1] tests/test_arcs.py:1332: 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_concurrency.py:347: Can't run test without gevent installed. SKIPPED [2] tests/test_concurrency.py:229: Can't test: Couldn't trace with concurrency=gevent, the module isn't installed. 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: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_parser.py:435: 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:278: This test is only about PyTracer. SKIPPED [1] tests/test_python.py:53: not windows SKIPPED [1] tests/test_summary.py:734: .pyw files are only on 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] - 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.2.1 without C extension\nFull documentation is at https://coverage.readthedocs.io/en/7.2.1\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::PluginTest::test_plugin_sys_info - AssertionError: assert 'plugins.file_tracers: plugin_sys_info.Plugin' in ['-- sys -------------------------------------------------------', 'coverage_version: 7.2.1', 'coverage_module:... FAILED tests/test_plugins.py::GoodFileTracerTest::test_find_unexecuted - assert [1] == [99, 999, 9999] FAILED tests/test_plugins.py::BadFileTracerTest::test_plugin_has_inherited_filereporter_method - Failed: DID NOT RAISE FAILED tests/test_plugins.py::BadFileTracerTest::test_file_tracer_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_has_dynamic_source_filename_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_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_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::BadFileTracerTest::test_source_filename_fails - assert 0 == 1 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_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_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_plugins.py::BadFileTracerTest::test_dynamic_source_filename_fails - assert 0 == 1 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_xml_report - coverage.exceptions.NoDataError: No data to report. 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_html_report - coverage.exceptions.NoDataError: No data to report. 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_defer_to_python - AssertionError: assert ['Name ... 3 50%'] == ['Name ... 0 100%'] 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-13/popen-gw12/t11/foo_7.html' as Python source: 'invalid syntax' at line 1 FAILED tests/test_plugins.py::GoodFileTracerTest::test_plugin2 - coverage.exceptions.NotPython: Couldn't parse '/tmp/pytest-of-tkloczko/pytest-13/popen-gw1/t16/foo_7.html' as Python source: 'invalid syntax' at line 1 FAILED tests/test_python.py::GetZipBytesTest::test_get_encoded_zip_files[utf-8] - assert None is not None FAILED tests/test_python.py::GetZipBytesTest::test_get_encoded_zip_files[gb2312] - assert None is not None FAILED tests/test_python.py::GetZipBytesTest::test_get_encoded_zip_files[hebrew] - assert None is not None FAILED tests/test_python.py::GetZipBytesTest::test_get_encoded_zip_files[shift_jis] - assert None is not None FAILED tests/test_python.py::GetZipBytesTest::test_get_encoded_zip_files[cp1252] - assert None is not None FAILED tests/test_process.py::ProcessStartupWithSourceTest::test_pth_and_source_work_together[sub-pkg-] - AssertionError: File '.coverage' should exist FAILED tests/test_process.py::ProcessTest::test_tests_dir_is_importable - assert "Traceback (m...covmodzip1'\n" == 'done\n' 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-pkg--m] - 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::ProcessStartupTest::test_subprocess_with_pth_files - assert 100 == 3 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.2.1/tests/covmain.zip': [Errno 2] No such file or directory\n" FAILED tests/test_summary.py::SummaryTest::test_report_just_one - ModuleNotFoundError: No module named 'covmodzip1' 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--m] - AssertionError: File '.coverage' should exist FAILED tests/test_summary.py::SummaryTest::test_report_including - ModuleNotFoundError: No module named 'covmodzip1' 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.2.1-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-7.2.1-... 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[main--] - AssertionError: File '.coverage' should exist FAILED tests/test_summary.py::SummaryTest::test_report - ModuleNotFoundError: No module named 'covmodzip1' 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_process.py::ProcessStartupWithSourceTest::test_pth_and_source_work_together[sub---m] - AssertionError: File '.coverage' should exist 50 failed, 1241 passed, 22 skipped, 2 xfailed, 9 warnings, 12 errors in 15.72s ```
kloczek commented 1 year ago

Looks like python -m foo still is in use.

kloczek commented 1 year ago

Here is propose of the patch whci replaces use python by use sys.executable or <module_wrapper_script> instead python -m module if such script exist.

--- a/tests/test_process.py
+++ b/tests/test_process.py
@@ -653,7 +653,7 @@
         # module, like it used to:
         #   $ python -m coverage
         #   Code coverage for Python.  Use '__main__.py help' for help.
-        out = self.run_command("python -m coverage")
+        out = self.run_command("coverage")
         assert "Use 'coverage help' for help" in out

@@ -676,7 +676,7 @@
     def test_coverage_run_is_like_python(self) -> None:
         with open(TRY_EXECFILE) as f:
             self.make_file("run_me.py", f.read())
-        expected = self.run_command("python run_me.py")
+        expected = self.run_command(sys.executable, "run_me.py")
         actual = self.run_command("coverage run run_me.py")
         self.assert_tryexecfile_output(expected, actual)

@@ -689,7 +689,7 @@

     def test_coverage_run_dashm_is_like_python_dashm(self) -> None:
         # These -m commands assume the coverage tree is on the path.
-        expected = self.run_command("python -m process_test.try_execfile")
+        expected = self.run_command(sys.executable, "-m process_test.try_execfile")
         actual = self.run_command("coverage run -m process_test.try_execfile")
         self.assert_tryexecfile_output(expected, actual)

@@ -705,7 +705,7 @@
         with open(TRY_EXECFILE) as f:
             self.make_file("with_main/__main__.py", f.read())

-        expected = self.run_command("python -m with_main")
+        expected = self.run_command(sys.executable, "-m with_main")
         actual = self.run_command("coverage run -m with_main")
         self.assert_tryexecfile_output(expected, actual)

@@ -714,7 +714,7 @@
             self.make_file("with_main/__main__.py", f.read())
         self.make_file("with_main/__init__.py", "")

-        expected = self.run_command("python -m with_main")
+        expected = self.run_command(sys.executable, "-m with_main")
         actual = self.run_command("coverage run -m with_main")
         self.assert_tryexecfile_output(expected, actual)

@@ -725,7 +725,7 @@
         --source machinery to know and respect the original name.
         """
         # These -m commands assume the coverage tree is on the path.
-        expected = self.run_command("python -m process_test.try_execfile")
+        expected = self.run_command(sys.executable "-m process_test.try_execfile")
         actual = self.run_command(
             "coverage run --source process_test.try_execfile -m process_test.try_execfile"
         )
@@ -745,7 +745,7 @@
             disable_warnings = module-not-measured
             """)
         # These -m commands assume the coverage tree is on the path.
-        expected = self.run_command("python -m process_test.try_execfile")
+        expected = self.run_command(sys.executable "-m process_test.try_execfile")
         actual = self.run_command(
             "coverage run --source process_test -m process_test.try_execfile"
         )
@@ -780,7 +780,7 @@
         with open(TRY_EXECFILE) as f:
             self.make_file("sub/run_me.py", f.read())

-        expected = self.run_command("python -m sub.run_me")
+        expected = self.run_command(sys.executable, "-m sub.run_me")
         actual = self.run_command("coverage run -m sub.run_me")
         self.assert_tryexecfile_output(expected, actual)

@@ -788,7 +788,7 @@
         # https://github.com/nedbat/coveragepy/issues/207
         self.make_file("package/__init__.py", "print('init')")
         self.make_file("package/__main__.py", "print('main')")
-        expected = self.run_command("python -m package")
+        expected = self.run_command(sys.executable, "-m package")
         actual = self.run_command("coverage run -m package")
         assert expected == actual

@@ -830,10 +830,10 @@
             print(thing.SOMETHING)
             """)
         # If this test fails, it will be with "can't import thing".
-        out = self.run_command("python run_coverage.py run how_is_it.py")
+        out = self.run_command(sys.executable, "run_coverage.py run how_is_it.py")
         assert "hello-xyzzy" in out

-        out = self.run_command("python -m run_coverage run how_is_it.py")
+        out = self.run_command(sys.executable, "-m run_coverage run how_is_it.py")
         assert "hello-xyzzy" in out

     @pytest.mark.skipif(env.WINDOWS, reason="Windows can't make symlinks")
@@ -1003,7 +1003,7 @@
     def assert_pydoc_ok(self, name: str, thing: Any) -> None:
         """Check that pydoc of `name` finds the docstring from `thing`."""
         # Run pydoc.
-        out = self.run_command("python -m pydoc " + name)
+        out = self.run_command("pydoc " + name)
         # It should say "Help on..", and not have a traceback
         assert out.startswith("Help on ")
         assert "Traceback" not in out

pytest output with above patch

```console + PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-7.2.1-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-7.2.1-2.fc35.x86_64/usr/lib/python3.8/site-packages + /usr/bin/pytest -ra -m 'not network' bringing up nodes... ............................................................................................................................................s......s.s.s.......................x..x..... [ 14%] ..............................................................F..........................................................................................................s..s..sss...s.. [ 29%] .s.s........s.................s...................................................................................................................................................... [ 43%] ...................................F...................................F................................................................................................................ [ 57%] ......................................................s......................s......................................................................................................... [ 72%] ..............s...............F...s............s.....s..............F..F.......FF...sF...FF...F.F.FFFFF..FFFF....F.......F.F.F..............F..F.....F............F.s......F..F......F [ 87%] .F..............F...............F......F................................E.........E...E.E....E...E................EE...........E...E....EE...........F......... [100%] ========================================================================================== ERRORS =========================================================================================== __________________________________________________________________________ ERROR collecting tests/test_process.py ___________________________________________________________________________ /usr/lib/python3.8/site-packages/_pytest/python.py:623: in _importtestmodule mod = import_path(self.path, mode=importmode, root=self.config.rootpath) /usr/lib/python3.8/site-packages/_pytest/pathlib.py:533: in import_path importlib.import_module(module_name) /usr/lib64/python3.8/importlib/__init__.py:127: in import_module return _bootstrap._gcd_import(name[level:], package, level) :1014: in _gcd_import ??? :991: in _find_and_load ??? :975: in _find_and_load_unlocked ??? :671: in _load_unlocked ??? /usr/lib/python3.8/site-packages/_pytest/assertion/rewrite.py:159: in exec_module source_stat, co = _rewrite_test(fn, self.config) /usr/lib/python3.8/site-packages/_pytest/assertion/rewrite.py:342: in _rewrite_test tree = ast.parse(source, filename=strfn) /usr/lib64/python3.8/ast.py:47: in parse return compile(source, filename, mode, flags, E File "/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/tests/test_process.py", line 728 E expected = self.run_command(sys.executable "-m process_test.try_execfile") E ^ E SyntaxError: invalid syntax ______________________________________________________ ERROR at setup of VirtualenvTest.test_third_party_venv_isnt_measured[coverage] _______________________________________________________ [gw10] linux -- Python 3.8.16 /usr/bin/python3 tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-14/popen-gw10'), _trace=, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-14/popen-gw10')) @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", """\ 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:145: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1' 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[python -m coverage] __________________________________________________ [gw10] linux -- Python 3.8.16 /usr/bin/python3 tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-14/popen-gw10'), _trace=, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-14/popen-gw10')) @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", """\ 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:145: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1' 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] __________________________________________________________ [gw10] linux -- Python 3.8.16 /usr/bin/python3 tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-14/popen-gw10'), _trace=, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-14/popen-gw10')) @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", """\ 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:145: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1' 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] _____________________________________________________ [gw10] linux -- Python 3.8.16 /usr/bin/python3 tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-14/popen-gw10'), _trace=, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-14/popen-gw10')) @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", """\ 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:145: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1' 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] _____________________________________________________________ [gw10] linux -- Python 3.8.16 /usr/bin/python3 tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-14/popen-gw10'), _trace=, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-14/popen-gw10')) @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", """\ 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:145: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1' 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] ________________________________________________________ [gw10] linux -- Python 3.8.16 /usr/bin/python3 tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-14/popen-gw10'), _trace=, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-14/popen-gw10')) @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", """\ 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:145: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1' 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] __________________________________________________________ [gw10] linux -- Python 3.8.16 /usr/bin/python3 tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-14/popen-gw10'), _trace=, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-14/popen-gw10')) @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", """\ 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:145: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1' 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] _____________________________________________________ [gw10] linux -- Python 3.8.16 /usr/bin/python3 tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-14/popen-gw10'), _trace=, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-14/popen-gw10')) @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", """\ 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:145: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1' 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] ________________________________________________________ [gw10] linux -- Python 3.8.16 /usr/bin/python3 tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-14/popen-gw10'), _trace=, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-14/popen-gw10')) @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", """\ 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:145: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1' 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] ___________________________________________________ [gw10] linux -- Python 3.8.16 /usr/bin/python3 tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-14/popen-gw10'), _trace=, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-14/popen-gw10')) @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", """\ 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:145: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1' 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] __________________________________________________________________ [gw10] linux -- Python 3.8.16 /usr/bin/python3 tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-14/popen-gw10'), _trace=, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-14/popen-gw10')) @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", """\ 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:145: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1' 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] _____________________________________________________________ [gw10] linux -- Python 3.8.16 /usr/bin/python3 tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-14/popen-gw10'), _trace=, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-14/popen-gw10')) @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", """\ 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:145: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1' 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 _______________________________________________________________________________ [gw28] linux -- Python 3.8.16 /usr/bin/python3 self = 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.1 without C extension\nFull documentation is at https://coverage.readthedocs.io/en/7.2.1\n' tests/test_cmdline.py:1002: AssertionError ___________________________________________________________________________ DebugTraceTest.test_debug_sys_ctracer ___________________________________________________________________________ [gw28] linux -- Python 3.8.16 /usr/bin/python3 self = 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.1/tests/test_debug.py:200: AssertionError _______________________________________________________________________________ FileReporterTest.test_zipfile _______________________________________________________________________________ [gw30] linux -- Python 3.8.16 /usr/bin/python3 self = 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 _____________________________________________________________________ HtmlDeltaTest.test_html_delta_from_source_change ______________________________________________________________________ [gw15] linux -- Python 3.8.16 /usr/bin/python3 self = def test_html_delta_from_source_change(self) -> None: # HTML generation can create only the files that have changed. # In this case, helper1 changes because its source is different. self.create_initial_files() > self.run_coverage() /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/tests/test_html.py:198: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/tests/test_html.py:176: in run_coverage return super().run_coverage(covargs=covargs, htmlargs=htmlargs) /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/tests/test_html.py:65: in run_coverage ret = cov.html_report(**(htmlargs or {})) /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/control.py:1155: in html_report ret = reporter.report(morfs) /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/html.py:277: in report for fr, analysis in get_analysis_to_report(self.coverage, morfs): /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/report.py:98: in get_analysis_to_report analysis = coverage._analyze(fr) /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/control.py:920: in _analyze return Analysis(data, self.config.precision, fr, self._file_mapper) /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/results.py:35: in __init__ self.statements = self.file_reporter.lines() /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/python.py:193: in lines return self.parser.statements /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/python.py:184: in parser self._parser = PythonParser( /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/parser.py:56: in __init__ self.text = get_python_source(self.filename) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ filename = '/tmp/pytest-of-tkloczko/pytest-14/popen-gw15/t12/coverage_test_3629677351075007.py' 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: '/tmp/pytest-of-tkloczko/pytest-14/popen-gw15/t12/coverage_test_3629677351075007.py'. /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/python.py:63: NoSource ----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------ x is 12 ______________________________________________________________________________ PluginTest.test_plugin_sys_info ______________________________________________________________________________ [gw14] linux -- Python 3.8.16 /usr/bin/python3 self = 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.1', 'coverage_module: /home/...init__.py', 'tracer: PyTracer', 'CTracer: unavailable', 'plugins.file_tracers: plugin_sys_info.Plugin (disabled)', ...] /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/tests/test_plugins.py:216: AssertionError __________________________________________________________________________ GoodFileTracerTest.test_defer_to_python __________________________________________________________________________ [gw35] linux -- Python 3.8.16 /usr/bin/python3 self = 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.1/tests/test_plugins.py:532: AssertionError ______________________________________________________________________ GoodFileTracerTest.test_plugin2_with_xml_report ______________________________________________________________________ [gw24] linux -- Python 3.8.16 /usr/bin/python3 self = 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.1/tests/test_plugins.py:459: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/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.1/coverage/report.py:59: in render_report ret = reporter.report(morfs, outfile=outfile) /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/xmlreport.py:103: in report for fr, analysis in get_analysis_to_report(self.coverage, morfs): _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ coverage = , 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.1/coverage/report.py:94: NoDataError __________________________________________________________________________ GoodFileTracerTest.test_find_unexecuted __________________________________________________________________________ [gw21] linux -- Python 3.8.16 /usr/bin/python3 self = 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.1/tests/test_plugins.py:574: AssertionError _____________________________________________________________________ BadFileTracerTest.test_file_tracer_returns_wrong ______________________________________________________________________ [gw12] linux -- Python 3.8.16 /usr/bin/python3 self = 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.1/tests/test_plugins.py:776: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , 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.1/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.1/coverage/control.py\', lineno : 553, line : None}'] __________________________________________________________ BadFileTracerTest.test_file_tracer_has_inherited_sourcefilename_method ___________________________________________________________ [gw4] linux -- Python 3.8.16 /usr/bin/python3 self = 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.1/tests/test_plugins.py:698: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , 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.1/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.1/coverage/control.py\', lineno : 553, line : None}'] _________________________________________________________________________ BadFileTracerTest.test_file_tracer_fails __________________________________________________________________________ [gw28] linux -- Python 3.8.16 /usr/bin/python3 self = 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.1/tests/test_plugins.py:733: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , 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 = ('# Oh noes!') E + where = "Plugin file tracers (bad_plugin.Plugin) aren't supported with PyTracer".count /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/tests/test_plugins.py:655: AssertionError ____________________________________________________________________ BadFileTracerTest.test_file_tracer_fails_eventually ____________________________________________________________________ [gw7] linux -- Python 3.8.16 /usr/bin/python3 self = 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.1/tests/test_plugins.py:764: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , 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 = ('# Oh noes!') E + where = "Plugin file tracers (bad_plugin.Plugin) aren't supported with PyTracer".count /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/tests/test_plugins.py:655: AssertionError ______________________________________________________________ BadFileTracerTest.test_plugin_has_inherited_filereporter_method ______________________________________________________________ [gw23] linux -- Python 3.8.16 /usr/bin/python3 self = 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 /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/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_file_tracer_has_no_file_tracer_method ________________________________________________________________ [gw38] linux -- Python 3.8.16 /usr/bin/python3 self = 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.1/tests/test_plugins.py:682: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , 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.1/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.1/coverage/control.py\', lineno : 553, line : None}'] _____________________________________________________________________ GoodFileTracerTest.test_plugin2_with_text_report ______________________________________________________________________ [gw2] linux -- Python 3.8.16 /usr/bin/python3 self = 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.1/tests/test_plugins.py:423: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/control.py:1059: in report return reporter.report(morfs, outfile=file) /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/summary.py:181: in report for fr, analysis in get_analysis_to_report(self.coverage, morfs): _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ coverage = , 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.1/coverage/report.py:94: NoDataError __________________________________________________________________ BadFileTracerTest.test_line_number_range_returns_triple __________________________________________________________________ [gw16] linux -- Python 3.8.16 /usr/bin/python3 self = 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.1/tests/test_plugins.py:917: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , 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.1/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.1/coverage/control.py\', lineno : 553, line : None}'] _________________________________________________________________ BadFileTracerTest.test_has_dynamic_source_filename_fails __________________________________________________________________ [gw34] linux -- Python 3.8.16 /usr/bin/python3 self = 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.1/tests/test_plugins.py:794: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , 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 = ('# Oh noes!') E + where = "Plugin file tracers (bad_plugin.Plugin) aren't supported with PyTracer".count /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/tests/test_plugins.py:655: AssertionError ___________________________________________________________________ BadFileTracerTest.test_line_number_range_raises_error ___________________________________________________________________ [gw22] linux -- Python 3.8.16 /usr/bin/python3 self = 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.1/tests/test_plugins.py:873: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , 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.1/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.1/coverage/control.py\', lineno : 553, line : None}'] _____________________________________________________________________ GetZipBytesTest.test_get_encoded_zip_files[utf-8] _____________________________________________________________________ [gw2] linux -- Python 3.8.16 /usr/bin/python3 self = , 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 _____________________________________________________________ BadFileTracerTest.test_line_number_range_returns_pair_of_strings ______________________________________________________________ [gw0] linux -- Python 3.8.16 /usr/bin/python3 self = 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.1/tests/test_plugins.py:939: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , 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.1/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.1/coverage/control.py\', lineno : 553, line : None}'] ________________________________________________________________ BadFileTracerTest.test_line_number_range_returns_non_tuple _________________________________________________________________ [gw40] linux -- Python 3.8.16 /usr/bin/python3 self = 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.1/tests/test_plugins.py:895: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , 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.1/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.1/coverage/control.py\', lineno : 553, line : None}'] ____________________________________________________________________ GetZipBytesTest.test_get_encoded_zip_files[gb2312] _____________________________________________________________________ [gw2] linux -- Python 3.8.16 /usr/bin/python3 self = , 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] _____________________________________________________________________ [gw2] linux -- Python 3.8.16 /usr/bin/python3 self = , 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 _____________________________________________________________________ GoodFileTracerTest.test_plugin2_with_html_report ______________________________________________________________________ [gw39] linux -- Python 3.8.16 /usr/bin/python3 self = 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.1/tests/test_plugins.py:444: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/control.py:1155: in html_report ret = reporter.report(morfs) /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/html.py:277: in report for fr, analysis in get_analysis_to_report(self.coverage, morfs): _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ coverage = , 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.1/coverage/report.py:94: NoDataError ___________________________________________________________________ GetZipBytesTest.test_get_encoded_zip_files[shift_jis] ___________________________________________________________________ [gw2] linux -- Python 3.8.16 /usr/bin/python3 self = , 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 ___________________________________________________________________ BadFileTracerTest.test_source_filename_returns_wrong ____________________________________________________________________ [gw24] linux -- Python 3.8.16 /usr/bin/python3 self = 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.1/tests/test_plugins.py:826: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , 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.1/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.1/coverage/control.py\', lineno : 553, line : None}'] ______________________________________________________________________________ GoodFileTracerTest.test_plugin1 ______________________________________________________________________________ [gw25] linux -- Python 3.8.16 /usr/bin/python3 self = 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.1/tests/test_plugins.py:322: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/control.py:872: in analysis f, s, _, m, mf = self.analysis2(morf) /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/control.py:895: in analysis2 analysis = self._analyze(morf) /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/control.py:920: in _analyze return Analysis(data, self.config.precision, fr, self._file_mapper) /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/results.py:35: in __init__ self.statements = self.file_reporter.lines() /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/python.py:193: in lines return self.parser.statements /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/python.py:184: in parser self._parser = PythonParser( /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/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.1/coverage/python.py:63: NoSource ____________________________________________________________________ GetZipBytesTest.test_get_encoded_zip_files[cp1252] _____________________________________________________________________ [gw2] linux -- Python 3.8.16 /usr/bin/python3 self = , 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 ___________________________________________________________________ BadFileTracerTest.test_dynamic_source_filename_fails ____________________________________________________________________ [gw6] linux -- Python 3.8.16 /usr/bin/python3 self = 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.1/tests/test_plugins.py:853: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , 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 = ('# Oh noes!') E + where = "Plugin file tracers (bad_plugin.Plugin) aren't supported with PyTracer".count /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/tests/test_plugins.py:655: AssertionError ________________________________________________________________________ GoodFileTracerTest.test_plugin2_with_branch ________________________________________________________________________ [gw13] linux -- Python 3.8.16 /usr/bin/python3 self = , 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-gw13/t20/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-14/popen-gw13/t20/foo_7.html", line 1 E line 0 E ^ E SyntaxError: invalid syntax /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/parser.py:388: SyntaxError The above exception was the direct cause of the following exception: self = 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.1/tests/test_plugins.py:406: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/control.py:920: in _analyze return Analysis(data, self.config.precision, fr, self._file_mapper) /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/results.py:35: in __init__ self.statements = self.file_reporter.lines() /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/python.py:193: in lines return self.parser.statements /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/python.py:188: in parser self._parser.parse_source() /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/parser.py:253: in parse_source self._raw_parse() /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/parser.py:211: in _raw_parse byte_parser = ByteParser(self.text, filename=self.filename) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , 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-gw13/t20/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-14/popen-gw13/t20/foo_7.html' as Python source: 'invalid syntax' at line 1 /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/parser.py:390: NotPython _____________________________________________________________________________ SummaryTest.test_report_including _____________________________________________________________________________ [gw1] linux -- Python 3.8.16 /usr/bin/python3 self = 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.1/tests/test_summary.py:129: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/tests/coveragetest.py:93: in start_import_stop mod = import_local_file(modname, modfile) /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/misc.py:336: in import_local_file spec.loader.exec_module(mod) :843: in exec_module ??? :219: in _call_with_frames_removed ??? _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ import covmod1 > import covmodzip1 E ModuleNotFoundError: No module named 'covmodzip1' /tmp/pytest-of-tkloczko/pytest-14/popen-gw1/t19/mycode.py:2: ModuleNotFoundError _______________________________________________________________________ BadFileTracerTest.test_source_filename_fails ________________________________________________________________________ [gw31] linux -- Python 3.8.16 /usr/bin/python3 self = 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.1/tests/test_plugins.py:810: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , 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 = ('# Oh noes!') E + where = "Plugin file tracers (bad_plugin.Plugin) aren't supported with PyTracer".count /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/tests/test_plugins.py:655: AssertionError _____________________________________________________________________________ SummaryTest.test_report_just_one ______________________________________________________________________________ [gw20] linux -- Python 3.8.16 /usr/bin/python3 self = 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.1/tests/test_summary.py:70: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/tests/coveragetest.py:93: in start_import_stop mod = import_local_file(modname, modfile) /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/misc.py:336: in import_local_file spec.loader.exec_module(mod) :843: in exec_module ??? :219: in _call_with_frames_removed ??? _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ import covmod1 > import covmodzip1 E ModuleNotFoundError: No module named 'covmodzip1' /tmp/pytest-of-tkloczko/pytest-14/popen-gw20/t18/mycode.py:2: ModuleNotFoundError _____________________________________________________________________________ SummaryTest.test_report_omitting ______________________________________________________________________________ [gw35] linux -- Python 3.8.16 /usr/bin/python3 self = 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.1/tests/test_summary.py:109: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/tests/coveragetest.py:93: in start_import_stop mod = import_local_file(modname, modfile) /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/misc.py:336: in import_local_file spec.loader.exec_module(mod) :843: in exec_module ??? :219: in _call_with_frames_removed ??? _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ import covmod1 > import covmodzip1 E ModuleNotFoundError: No module named 'covmodzip1' /tmp/pytest-of-tkloczko/pytest-14/popen-gw35/t14/mycode.py:2: ModuleNotFoundError ______________________________________________________________________________ GoodFileTracerTest.test_plugin2 ______________________________________________________________________________ [gw30] linux -- Python 3.8.16 /usr/bin/python3 self = , 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-gw30/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-14/popen-gw30/t14/foo_7.html", line 1 E line 0 E ^ E SyntaxError: invalid syntax /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/parser.py:388: SyntaxError The above exception was the direct cause of the following exception: self = 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.1/tests/test_plugins.py:381: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/control.py:872: in analysis f, s, _, m, mf = self.analysis2(morf) /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/control.py:895: in analysis2 analysis = self._analyze(morf) /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/control.py:920: in _analyze return Analysis(data, self.config.precision, fr, self._file_mapper) /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/results.py:35: in __init__ self.statements = self.file_reporter.lines() /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/python.py:193: in lines return self.parser.statements /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/python.py:188: in parser self._parser.parse_source() /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/parser.py:253: in parse_source self._raw_parse() /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/parser.py:211: in _raw_parse byte_parser = ByteParser(self.text, filename=self.filename) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , 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-gw30/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-14/popen-gw30/t14/foo_7.html' as Python source: 'invalid syntax' at line 1 /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/parser.py:390: NotPython __________________________________________________________________________________ SummaryTest.test_report __________________________________________________________________________________ [gw6] linux -- Python 3.8.16 /usr/bin/python3 self = def test_report(self) -> None: self.make_mycode() cov = coverage.Coverage() > self.start_import_stop(cov, "mycode") /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/tests/test_summary.py:48: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/tests/coveragetest.py:93: in start_import_stop mod = import_local_file(modname, modfile) /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/misc.py:336: in import_local_file spec.loader.exec_module(mod) :843: in exec_module ??? :219: in _call_with_frames_removed ??? _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ import covmod1 > import covmodzip1 E ModuleNotFoundError: No module named 'covmodzip1' /tmp/pytest-of-tkloczko/pytest-14/popen-gw6/t21/mycode.py:2: ModuleNotFoundError __________________________________________________________________________ test_xdist_sys_path_nuttiness_is_fixed ___________________________________________________________________________ [gw39] 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.1-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-7.2.1-2.fc35.x86_64/usr/lib/python3.8/site-packages' is None E + where '/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-7.2.1-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-7.2.1-2.fc35.x86_64/usr/lib/python3.8/site-packages' = ('PYTHONPATH') E + where = environ({'PATH': '/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-7.2.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.2.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:33: AssertionError _____________________________________________________________________________ SummaryTest.test_report_wildcard ______________________________________________________________________________ [gw12] linux -- Python 3.8.16 /usr/bin/python3 self = 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.1/tests/test_summary.py:103: AssertionError ----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------ Traceback (most recent call last): File "mycode.py", line 2, in import covmodzip1 ModuleNotFoundError: No module named 'covmodzip1' Name Stmts Miss Cover ------------------------------- mycode.py 4 2 50% ------------------------------- TOTAL 4 2 50% ===================================================================================== warnings summary ====================================================================================== tests/test_plugins.py::GoodFileTracerTest::test_defer_to_python /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/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_plugin2_with_xml_report 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_branch tests/test_plugins.py::GoodFileTracerTest::test_plugin2 /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/control.py:553: CoverageWarning: Plugin file tracers (tests.plugin2.Plugin) aren't supported with PyTracer self._warn( tests/test_plugins.py::GoodFileTracerTest::test_find_unexecuted /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.1/coverage/control.py:553: CoverageWarning: Plugin file tracers (unexecuted_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.1/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.1/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:1332: Match-case is new in 3.10 SKIPPED [1] tests/test_arcs.py:1316: 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:1363: Match-case is new in 3.10 SKIPPED [2] tests/test_concurrency.py:229: Can't test: Couldn't trace with concurrency=greenlet, the module isn't installed. SKIPPED [3] tests/test_concurrency.py:229: 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 [2] tests/test_concurrency.py:481: 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 [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:435: 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:278: This test is only about PyTracer. SKIPPED [1] tests/test_python.py:53: not windows SKIPPED [1] tests/test_summary.py:734: .pyw files are only on 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_process.py 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.2.1 without C extension\nFull documentation is at https://coverage.readthedocs.io/en/7.2.1\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_html.py::HtmlDeltaTest::test_html_delta_from_source_change - coverage.exceptions.NoSource: No source for code: '/tmp/pytest-of-tkloczko/pytest-14/popen-gw15/t12/coverage_test_3629677351075007.py'. FAILED tests/test_plugins.py::PluginTest::test_plugin_sys_info - AssertionError: assert 'plugins.file_tracers: plugin_sys_info.Plugin' in ['-- sys -------------------------------------------------------', 'coverage_version: 7.2.1', 'coverage_module:... FAILED tests/test_plugins.py::GoodFileTracerTest::test_defer_to_python - AssertionError: assert ['Name ... 3 50%'] == ['Name ... 0 100%'] FAILED tests/test_plugins.py::GoodFileTracerTest::test_plugin2_with_xml_report - coverage.exceptions.NoDataError: No data to report. FAILED tests/test_plugins.py::GoodFileTracerTest::test_find_unexecuted - assert [1] == [99, 999, 9999] 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_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::BadFileTracerTest::test_file_tracer_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_plugin_has_inherited_filereporter_method - Failed: DID NOT RAISE 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_plugins.py::GoodFileTracerTest::test_plugin2_with_text_report - coverage.exceptions.NoDataError: No data to report. 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_has_dynamic_source_filename_fails - assert 0 == 1 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_python.py::GetZipBytesTest::test_get_encoded_zip_files[utf-8] - assert None is not None 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::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_python.py::GetZipBytesTest::test_get_encoded_zip_files[gb2312] - assert None is not None FAILED tests/test_python.py::GetZipBytesTest::test_get_encoded_zip_files[hebrew] - assert None is not None FAILED tests/test_plugins.py::GoodFileTracerTest::test_plugin2_with_html_report - coverage.exceptions.NoDataError: No data to report. FAILED tests/test_python.py::GetZipBytesTest::test_get_encoded_zip_files[shift_jis] - assert None is not None 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_plugin1 - coverage.exceptions.NoSource: No source for code: '/src/try_ABC.zz'. FAILED tests/test_python.py::GetZipBytesTest::test_get_encoded_zip_files[cp1252] - assert None is not None FAILED tests/test_plugins.py::BadFileTracerTest::test_dynamic_source_filename_fails - assert 0 == 1 FAILED tests/test_plugins.py::GoodFileTracerTest::test_plugin2_with_branch - coverage.exceptions.NotPython: Couldn't parse '/tmp/pytest-of-tkloczko/pytest-14/popen-gw13/t20/foo_7.html' as Python source: 'invalid syntax' at line 1 FAILED tests/test_summary.py::SummaryTest::test_report_including - ModuleNotFoundError: No module named 'covmodzip1' FAILED tests/test_plugins.py::BadFileTracerTest::test_source_filename_fails - assert 0 == 1 FAILED tests/test_summary.py::SummaryTest::test_report_just_one - ModuleNotFoundError: No module named 'covmodzip1' FAILED tests/test_summary.py::SummaryTest::test_report_omitting - ModuleNotFoundError: No module named 'covmodzip1' FAILED tests/test_plugins.py::GoodFileTracerTest::test_plugin2 - coverage.exceptions.NotPython: Couldn't parse '/tmp/pytest-of-tkloczko/pytest-14/popen-gw30/t14/foo_7.html' as Python source: 'invalid syntax' at line 1 FAILED tests/test_summary.py::SummaryTest::test_report - ModuleNotFoundError: No module named 'covmodzip1' FAILED tests/test_testing.py::test_xdist_sys_path_nuttiness_is_fixed - AssertionError: assert '/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-7.2.1-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-7.2.1-... FAILED tests/test_summary.py::SummaryTest::test_report_wildcard - AssertionError: assert 'TOTAL 4 2 50%' == 'TOTAL 4 0 100%' 38 failed, 1183 passed, 22 skipped, 2 xfailed, 9 warnings, 13 errors in 15.11s ```
kloczek commented 1 year ago

Sorry patch is wrong. Nevertheless instead using hardcoded python exacutable name it should be used sys.executable.

nedbat commented 1 year ago

Excact steps are listed in descriptio openig this ticket.

I'm sorry, I don't know how to reproduce what you are seeing. Can you provide very specific detailed steps for reproducing the problem. Looking at the bullets at the top of this issue, I don't know what repo/directory you are using. I don't know what "install .whl file in </install/prefix>" means.

kloczek commented 1 year ago

I don't know what "install .whl file in </install/prefix>" means.

for example python -m installer --destdir=/tmp/coveragepy/ dist/coveragepy*.whl and than pass that base directory in $PYTHONPATH. You can use as well for that pip.

BTW jsut tested 7.2.3 and here is updated pytest output

```console + PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-7.2.3-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-7.2.3-2.fc35.x86_64/usr/lib/python3.8/site-packages + /usr/bin/pytest -ra -m 'not network' bringing up nodes... .................................................................................................................................x..............s..s.......s..s...................... [ 13%] x............................................................................F..............................................................................................s.s.....s [ 26%] ..............s.ss.........s.......s.....s.............................................................s............................................................................. [ 40%] .....................................................F.........F...........................................................F......................................................... [ 54%] ..............................................................................s........s............................................................................................. [ 67%] ................s..................................s.....s..........s.......F..FF..FFFF.FF.FFFFFFFFFF..FF.......F.F..F.F..FF.F..F....F.....F...s....F....F....................F...... [ 81%] ....F........................s...F.....F..............F......F.......................................F.F...F........................................................E..E........E..... [ 94%] ..E.......E......E..E....E.E....EFF.E...E..E...E.F......F.F....... [100%] ========================================================================================== ERRORS =========================================================================================== ____________________________________________________ ERROR at setup of VirtualenvTest.test_third_party_venv_isnt_measured[coverage-True] ____________________________________________________ [gw6] linux -- Python 3.8.16 /usr/bin/python3 tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-27/popen-gw6'), _trace=, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-27/popen-gw6')) @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", """\ 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:145: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3' 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] ____________________________________________________ [gw6] linux -- Python 3.8.16 /usr/bin/python3 tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-27/popen-gw6'), _trace=, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-27/popen-gw6')) @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", """\ 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:145: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3' 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] _______________________________________________ [gw6] linux -- Python 3.8.16 /usr/bin/python3 tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-27/popen-gw6'), _trace=, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-27/popen-gw6')) @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", """\ 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:145: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3' 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] _______________________________________________ [gw6] linux -- Python 3.8.16 /usr/bin/python3 tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-27/popen-gw6'), _trace=, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-27/popen-gw6')) @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", """\ 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:145: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3' 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] __________________________________________________________ [gw6] linux -- Python 3.8.16 /usr/bin/python3 tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-27/popen-gw6'), _trace=, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-27/popen-gw6')) @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", """\ 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:145: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3' 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] _____________________________________________________ [gw6] linux -- Python 3.8.16 /usr/bin/python3 tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-27/popen-gw6'), _trace=, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-27/popen-gw6')) @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", """\ 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:145: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3' 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] _____________________________________________________________ [gw6] linux -- Python 3.8.16 /usr/bin/python3 tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-27/popen-gw6'), _trace=, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-27/popen-gw6')) @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", """\ 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:145: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3' 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] ________________________________________________________ [gw6] linux -- Python 3.8.16 /usr/bin/python3 tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-27/popen-gw6'), _trace=, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-27/popen-gw6')) @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", """\ 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:145: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3' 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] __________________________________________________________ [gw6] linux -- Python 3.8.16 /usr/bin/python3 tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-27/popen-gw6'), _trace=, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-27/popen-gw6')) @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", """\ 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:145: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3' 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] _____________________________________________________ [gw6] linux -- Python 3.8.16 /usr/bin/python3 tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-27/popen-gw6'), _trace=, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-27/popen-gw6')) @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", """\ 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:145: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3' 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] ________________________________________________________ [gw6] linux -- Python 3.8.16 /usr/bin/python3 tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-27/popen-gw6'), _trace=, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-27/popen-gw6')) @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", """\ 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:145: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3' 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] ___________________________________________________ [gw6] linux -- Python 3.8.16 /usr/bin/python3 tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-27/popen-gw6'), _trace=, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-27/popen-gw6')) @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", """\ 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:145: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3' 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] __________________________________________________________________ [gw6] linux -- Python 3.8.16 /usr/bin/python3 tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-27/popen-gw6'), _trace=, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-27/popen-gw6')) @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", """\ 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:145: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3' 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] _____________________________________________________________ [gw6] linux -- Python 3.8.16 /usr/bin/python3 tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-27/popen-gw6'), _trace=, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-27/popen-gw6')) @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", """\ 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:145: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ cmd = 'python -m pip install ./third_pkg -e ./another_pkg -e ./bug888/app -e ./bug888/plugin /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3' 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 _______________________________________________________________________________ [gw44] linux -- Python 3.8.16 /usr/bin/python3 self = 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.3 without C extension\nFull documentation is at https://coverage.readthedocs.io/en/7.2.3\n' tests/test_cmdline.py:1002: AssertionError ___________________________________________________________________________ DebugTraceTest.test_debug_sys_ctracer ___________________________________________________________________________ [gw30] linux -- Python 3.8.16 /usr/bin/python3 self = 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.3/tests/test_debug.py:200: AssertionError _______________________________________________________________________________ FileReporterTest.test_zipfile _______________________________________________________________________________ [gw11] linux -- Python 3.8.16 /usr/bin/python3 self = 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 _______________________________________________________________________ [gw39] linux -- Python 3.8.16 /usr/bin/python3 self = 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.3/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 ______________________________________________________________________________ [gw47] linux -- Python 3.8.16 /usr/bin/python3 self = 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.3', 'coverage_module: /home/...init__.py', 'tracer: PyTracer', 'CTracer: unavailable', 'plugins.file_tracers: plugin_sys_info.Plugin (disabled)', ...] /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3/tests/test_plugins.py:216: AssertionError __________________________________________________________________________ GoodFileTracerTest.test_defer_to_python __________________________________________________________________________ [gw32] linux -- Python 3.8.16 /usr/bin/python3 self = 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.3/tests/test_plugins.py:532: AssertionError __________________________________________________________________________ GoodFileTracerTest.test_find_unexecuted __________________________________________________________________________ [gw36] linux -- Python 3.8.16 /usr/bin/python3 self = 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.3/tests/test_plugins.py:574: AssertionError ______________________________________________________________ BadFileTracerTest.test_plugin_has_inherited_filereporter_method ______________________________________________________________ [gw20] linux -- Python 3.8.16 /usr/bin/python3 self = 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 /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3/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_file_tracer_has_inherited_sourcefilename_method ___________________________________________________________ [gw38] linux -- Python 3.8.16 /usr/bin/python3 self = 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.3/tests/test_plugins.py:698: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , 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.3/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.3/coverage/control.py\', lineno : 553, line : None}'] ____________________________________________________________________ BadFileTracerTest.test_file_tracer_fails_eventually ____________________________________________________________________ [gw6] linux -- Python 3.8.16 /usr/bin/python3 self = 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.3/tests/test_plugins.py:764: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , 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 = ('# Oh noes!') E + where = "Plugin file tracers (bad_plugin.Plugin) aren't supported with PyTracer".count /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3/tests/test_plugins.py:655: AssertionError _________________________________________________________________ BadFileTracerTest.test_has_dynamic_source_filename_fails __________________________________________________________________ [gw34] linux -- Python 3.8.16 /usr/bin/python3 self = 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.3/tests/test_plugins.py:794: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , 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 = ('# Oh noes!') E + where = "Plugin file tracers (bad_plugin.Plugin) aren't supported with PyTracer".count /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3/tests/test_plugins.py:655: AssertionError _______________________________________________________________ BadFileTracerTest.test_file_tracer_has_no_file_tracer_method ________________________________________________________________ [gw9] linux -- Python 3.8.16 /usr/bin/python3 self = 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.3/tests/test_plugins.py:682: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , 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.3/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.3/coverage/control.py\', lineno : 553, line : None}'] ___________________________________________________________________ BadFileTracerTest.test_dynamic_source_filename_fails ____________________________________________________________________ [gw44] linux -- Python 3.8.16 /usr/bin/python3 self = 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.3/tests/test_plugins.py:853: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , 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 = ('# Oh noes!') E + where = "Plugin file tracers (bad_plugin.Plugin) aren't supported with PyTracer".count /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3/tests/test_plugins.py:655: AssertionError _____________________________________________________________ BadFileTracerTest.test_line_number_range_returns_pair_of_strings ______________________________________________________________ [gw30] linux -- Python 3.8.16 /usr/bin/python3 self = 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.3/tests/test_plugins.py:939: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , 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.3/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.3/coverage/control.py\', lineno : 553, line : None}'] __________________________________________________________________ BadFileTracerTest.test_line_number_range_returns_triple __________________________________________________________________ [gw41] linux -- Python 3.8.16 /usr/bin/python3 self = 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.3/tests/test_plugins.py:917: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , 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.3/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.3/coverage/control.py\', lineno : 553, line : None}'] _______________________________________________________________________ BadFileTracerTest.test_source_filename_fails ________________________________________________________________________ [gw43] linux -- Python 3.8.16 /usr/bin/python3 self = 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.3/tests/test_plugins.py:810: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , 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 = ('# Oh noes!') E + where = "Plugin file tracers (bad_plugin.Plugin) aren't supported with PyTracer".count /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3/tests/test_plugins.py:655: AssertionError ________________________________________________________________ BadFileTracerTest.test_line_number_range_returns_non_tuple _________________________________________________________________ [gw19] linux -- Python 3.8.16 /usr/bin/python3 self = 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.3/tests/test_plugins.py:895: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , 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.3/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.3/coverage/control.py\', lineno : 553, line : None}'] ___________________________________________________________________ BadFileTracerTest.test_line_number_range_raises_error ___________________________________________________________________ [gw23] linux -- Python 3.8.16 /usr/bin/python3 self = 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.3/tests/test_plugins.py:873: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , 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.3/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.3/coverage/control.py\', lineno : 553, line : None}'] ___________________________________________________________________ BadFileTracerTest.test_source_filename_returns_wrong ____________________________________________________________________ [gw25] linux -- Python 3.8.16 /usr/bin/python3 self = 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.3/tests/test_plugins.py:826: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , 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.3/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.3/coverage/control.py\', lineno : 553, line : None}'] _____________________________________________________________________ GoodFileTracerTest.test_plugin2_with_text_report ______________________________________________________________________ [gw1] linux -- Python 3.8.16 /usr/bin/python3 self = 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.3/tests/test_plugins.py:423: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3/coverage/control.py:1059: in report return reporter.report(morfs, outfile=file) /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3/coverage/summary.py:181: in report for fr, analysis in get_analysis_to_report(self.coverage, morfs): _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ coverage = , 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.3/coverage/report.py:94: NoDataError _____________________________________________________________________ GoodFileTracerTest.test_plugin2_with_html_report ______________________________________________________________________ [gw37] linux -- Python 3.8.16 /usr/bin/python3 self = 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.3/tests/test_plugins.py:444: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3/coverage/control.py:1155: in html_report ret = reporter.report(morfs) /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3/coverage/html.py:296: in report for fr, analysis in get_analysis_to_report(self.coverage, morfs): _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ coverage = , 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.3/coverage/report.py:94: NoDataError ______________________________________________________________________ GoodFileTracerTest.test_plugin2_with_xml_report ______________________________________________________________________ [gw46] linux -- Python 3.8.16 /usr/bin/python3 self = 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.3/tests/test_plugins.py:459: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3/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.3/coverage/report.py:59: in render_report ret = reporter.report(morfs, outfile=outfile) /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3/coverage/xmlreport.py:103: in report for fr, analysis in get_analysis_to_report(self.coverage, morfs): _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ coverage = , 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.3/coverage/report.py:94: NoDataError _____________________________________________________________________ BadFileTracerTest.test_file_tracer_returns_wrong ______________________________________________________________________ [gw18] linux -- Python 3.8.16 /usr/bin/python3 self = 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.3/tests/test_plugins.py:776: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , 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.3/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.3/coverage/control.py\', lineno : 553, line : None}'] ______________________________________________________________________________ GoodFileTracerTest.test_plugin1 ______________________________________________________________________________ [gw2] linux -- Python 3.8.16 /usr/bin/python3 self = 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.3/tests/test_plugins.py:322: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3/coverage/control.py:872: in analysis f, s, _, m, mf = self.analysis2(morf) /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3/coverage/control.py:895: in analysis2 analysis = self._analyze(morf) /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3/coverage/control.py:920: in _analyze return Analysis(data, self.config.precision, fr, self._file_mapper) /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3/coverage/results.py:35: in __init__ self.statements = self.file_reporter.lines() /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3/coverage/python.py:193: in lines return self.parser.statements /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3/coverage/python.py:184: in parser self._parser = PythonParser( /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3/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.3/coverage/python.py:63: NoSource ________________________________________________________________________ GoodFileTracerTest.test_plugin2_with_branch ________________________________________________________________________ [gw11] linux -- Python 3.8.16 /usr/bin/python3 self = , text = 'line 0\nline 1\nline 2\nline 3\nline 4\nline 5\nline 6\n', code = None filename = '/tmp/pytest-of-tkloczko/pytest-27/popen-gw11/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-27/popen-gw11/t18/foo_7.html", line 1 E line 0 E ^ E SyntaxError: invalid syntax /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3/coverage/parser.py:388: SyntaxError The above exception was the direct cause of the following exception: self = 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.3/tests/test_plugins.py:406: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3/coverage/control.py:920: in _analyze return Analysis(data, self.config.precision, fr, self._file_mapper) /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3/coverage/results.py:35: in __init__ self.statements = self.file_reporter.lines() /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3/coverage/python.py:193: in lines return self.parser.statements /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3/coverage/python.py:188: in parser self._parser.parse_source() /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3/coverage/parser.py:253: in parse_source self._raw_parse() /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3/coverage/parser.py:211: in _raw_parse byte_parser = ByteParser(self.text, filename=self.filename) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , text = 'line 0\nline 1\nline 2\nline 3\nline 4\nline 5\nline 6\n', code = None filename = '/tmp/pytest-of-tkloczko/pytest-27/popen-gw11/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-27/popen-gw11/t18/foo_7.html' as Python source: 'invalid syntax' at line 1 /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3/coverage/parser.py:390: NotPython _________________________________________________________________________ BadFileTracerTest.test_file_tracer_fails __________________________________________________________________________ [gw8] linux -- Python 3.8.16 /usr/bin/python3 self = 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.3/tests/test_plugins.py:733: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , 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 = ('# Oh noes!') E + where = "Plugin file tracers (bad_plugin.Plugin) aren't supported with PyTracer".count /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3/tests/test_plugins.py:655: AssertionError _____________________________________________________________________ GetZipBytesTest.test_get_encoded_zip_files[utf-8] _____________________________________________________________________ [gw7] linux -- Python 3.8.16 /usr/bin/python3 self = , 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] _____________________________________________________________________ [gw7] linux -- Python 3.8.16 /usr/bin/python3 self = , 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] _____________________________________________________________________ [gw7] linux -- Python 3.8.16 /usr/bin/python3 self = , 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] ___________________________________________________________________ [gw7] linux -- Python 3.8.16 /usr/bin/python3 self = , 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 _________________________________________________________ ProcessStartupWithSourceTest.test_pth_and_source_work_together[main-pkg-] _________________________________________________________ [gw10] linux -- Python 3.8.16 /usr/bin/python3 self = , 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.3/tests/test_process.py:1277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , 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 = ('.coverage') E + where = .exists E + where = os.path /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3/tests/coveragetest.py:340: AssertionError ----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------ ____________________________________________________________________ GetZipBytesTest.test_get_encoded_zip_files[cp1252] _____________________________________________________________________ [gw7] linux -- Python 3.8.16 /usr/bin/python3 self = , 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 _________________________________________________________ ProcessStartupWithSourceTest.test_pth_and_source_work_together[sub-pkg-] __________________________________________________________ [gw5] linux -- Python 3.8.16 /usr/bin/python3 self = , 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.3/tests/test_process.py:1277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , 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 = ('.coverage') E + where = .exists E + where = os.path /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3/tests/coveragetest.py:340: AssertionError ----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------ ______________________________________________________________________________ GoodFileTracerTest.test_plugin2 ______________________________________________________________________________ [gw28] linux -- Python 3.8.16 /usr/bin/python3 self = , text = 'line 0\nline 1\nline 2\nline 3\nline 4\nline 5\nline 6\n', code = None filename = '/tmp/pytest-of-tkloczko/pytest-27/popen-gw28/t4/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-27/popen-gw28/t4/foo_7.html", line 1 E line 0 E ^ E SyntaxError: invalid syntax /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3/coverage/parser.py:388: SyntaxError The above exception was the direct cause of the following exception: self = 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.3/tests/test_plugins.py:381: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3/coverage/control.py:872: in analysis f, s, _, m, mf = self.analysis2(morf) /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3/coverage/control.py:895: in analysis2 analysis = self._analyze(morf) /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3/coverage/control.py:920: in _analyze return Analysis(data, self.config.precision, fr, self._file_mapper) /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3/coverage/results.py:35: in __init__ self.statements = self.file_reporter.lines() /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3/coverage/python.py:193: in lines return self.parser.statements /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3/coverage/python.py:188: in parser self._parser.parse_source() /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3/coverage/parser.py:253: in parse_source self._raw_parse() /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3/coverage/parser.py:211: in _raw_parse byte_parser = ByteParser(self.text, filename=self.filename) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , text = 'line 0\nline 1\nline 2\nline 3\nline 4\nline 5\nline 6\n', code = None filename = '/tmp/pytest-of-tkloczko/pytest-27/popen-gw28/t4/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-27/popen-gw28/t4/foo_7.html' as Python source: 'invalid syntax' at line 1 /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3/coverage/parser.py:390: NotPython ________________________________________________________ ProcessStartupWithSourceTest.test_pth_and_source_work_together[main-pkg--m] ________________________________________________________ [gw8] linux -- Python 3.8.16 /usr/bin/python3 self = , 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.3/tests/test_process.py:1277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , 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 = ('.coverage') E + where = .exists E + where = os.path /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3/tests/coveragetest.py:340: AssertionError ----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------ __________________________________________________________ ProcessStartupWithSourceTest.test_pth_and_source_work_together[sub---m] __________________________________________________________ [gw16] linux -- Python 3.8.16 /usr/bin/python3 self = , 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.3/tests/test_process.py:1277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , 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 = ('.coverage') E + where = .exists E + where = os.path /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3/tests/coveragetest.py:340: AssertionError ----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------ _______________________________________________________________________________ ProcessTest.test_fullcoverage _______________________________________________________________________________ [gw25] linux -- Python 3.8.16 /usr/bin/python3 self = @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.3/tests/test_process.py:574: AssertionError ----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------ /usr/bin/python3: No module named coverage ________________________________________________________ ProcessStartupWithSourceTest.test_pth_and_source_work_together[sub-pkg--m] _________________________________________________________ [gw10] linux -- Python 3.8.16 /usr/bin/python3 self = , 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.3/tests/test_process.py:1277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , 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 = ('.coverage') E + where = .exists E + where = os.path /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3/tests/coveragetest.py:340: AssertionError ----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------ ___________________________________________________________ ProcessStartupWithSourceTest.test_pth_and_source_work_together[sub--] ___________________________________________________________ [gw5] linux -- Python 3.8.16 /usr/bin/python3 self = , 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.3/tests/test_process.py:1277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , 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 = ('.coverage') E + where = .exists E + where = os.path /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3/tests/coveragetest.py:340: AssertionError ----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------ _________________________________________________________________________ ProcessTest.test_tests_dir_is_importable __________________________________________________________________________ [gw2] linux -- Python 3.8.16 /usr/bin/python3 self = 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 E + import covmodzip1 E + ModuleNotFoundError: No module named 'covmodzip1' /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3/tests/test_process.py:54: AssertionError ----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------ Traceback (most recent call last): File "mycode.py", line 2, in import covmodzip1 ModuleNotFoundError: No module named 'covmodzip1' _____________________________________________________________________________ SummaryTest.test_report_just_one ______________________________________________________________________________ [gw14] linux -- Python 3.8.16 /usr/bin/python3 self = 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.3/tests/test_summary.py:70: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3/tests/coveragetest.py:93: in start_import_stop mod = import_local_file(modname, modfile) /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3/coverage/misc.py:336: in import_local_file spec.loader.exec_module(mod) :843: in exec_module ??? :219: in _call_with_frames_removed ??? _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ import covmod1 > import covmodzip1 E ModuleNotFoundError: No module named 'covmodzip1' /tmp/pytest-of-tkloczko/pytest-27/popen-gw14/t8/mycode.py:2: ModuleNotFoundError _____________________________________________________________________ ProcessStartupTest.test_subprocess_with_pth_files _____________________________________________________________________ [gw46] linux -- Python 3.8.16 /usr/bin/python3 self = 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.3/tests/test_process.py:1170: AssertionError __________________________________________________________ ProcessStartupWithSourceTest.test_pth_and_source_work_together[main--] ___________________________________________________________ [gw11] linux -- Python 3.8.16 /usr/bin/python3 self = , 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.3/tests/test_process.py:1277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , 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 = ('.coverage') E + where = .exists E + where = os.path /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3/tests/coveragetest.py:340: AssertionError ----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------ _________________________________________________________ ProcessStartupWithSourceTest.test_pth_and_source_work_together[main---m] __________________________________________________________ [gw2] linux -- Python 3.8.16 /usr/bin/python3 self = , 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.3/tests/test_process.py:1277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , 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 = ('.coverage') E + where = .exists E + where = os.path /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3/tests/coveragetest.py:340: AssertionError ----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------ __________________________________________________________________________________ SummaryTest.test_report __________________________________________________________________________________ [gw46] linux -- Python 3.8.16 /usr/bin/python3 self = def test_report(self) -> None: self.make_mycode() cov = coverage.Coverage() > self.start_import_stop(cov, "mycode") /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3/tests/test_summary.py:48: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3/tests/coveragetest.py:93: in start_import_stop mod = import_local_file(modname, modfile) /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3/coverage/misc.py:336: in import_local_file spec.loader.exec_module(mod) :843: in exec_module ??? :219: in _call_with_frames_removed ??? _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ import covmod1 > import covmodzip1 E ModuleNotFoundError: No module named 'covmodzip1' /tmp/pytest-of-tkloczko/pytest-27/popen-gw46/t17/mycode.py:2: ModuleNotFoundError __________________________________________________________________________ test_xdist_sys_path_nuttiness_is_fixed ___________________________________________________________________________ [gw44] 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.3-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-7.2.3-2.fc35.x86_64/usr/lib/python3.8/site-packages' is None E + where '/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-7.2.3-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-7.2.3-2.fc35.x86_64/usr/lib/python3.8/site-packages' = ('PYTHONPATH') E + where = environ({'PATH': '/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-7.2.3-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.2.3-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:33: AssertionError _____________________________________________________________________________ SummaryTest.test_report_including _____________________________________________________________________________ [gw12] linux -- Python 3.8.16 /usr/bin/python3 self = 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.3/tests/test_summary.py:129: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3/tests/coveragetest.py:93: in start_import_stop mod = import_local_file(modname, modfile) /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3/coverage/misc.py:336: in import_local_file spec.loader.exec_module(mod) :843: in exec_module ??? :219: in _call_with_frames_removed ??? _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ import covmod1 > import covmodzip1 E ModuleNotFoundError: No module named 'covmodzip1' /tmp/pytest-of-tkloczko/pytest-27/popen-gw12/t22/mycode.py:2: ModuleNotFoundError _____________________________________________________________________________ SummaryTest.test_report_wildcard ______________________________________________________________________________ [gw4] linux -- Python 3.8.16 /usr/bin/python3 self = 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.3/tests/test_summary.py:103: AssertionError ----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------ Traceback (most recent call last): File "mycode.py", line 2, in 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 _______________________________________________________________ [gw18] linux -- Python 3.8.16 /usr/bin/python3 self = 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.3/tests/test_process.py:1191: KeyError ----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------ No data to combine _____________________________________________________________________________ SummaryTest.test_report_omitting ______________________________________________________________________________ [gw7] linux -- Python 3.8.16 /usr/bin/python3 self = 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.3/tests/test_summary.py:109: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3/tests/coveragetest.py:93: in start_import_stop mod = import_local_file(modname, modfile) /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3/coverage/misc.py:336: in import_local_file spec.loader.exec_module(mod) :843: in exec_module ??? :219: in _call_with_frames_removed ??? _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ import covmod1 > import covmodzip1 E ModuleNotFoundError: No module named 'covmodzip1' /tmp/pytest-of-tkloczko/pytest-27/popen-gw7/t6/mycode.py:2: ModuleNotFoundError _____________________________________________________________________ EnvironmentTest.test_coverage_zip_is_like_python ______________________________________________________________________ [gw47] linux -- Python 3.8.16 /usr/bin/python3 self = 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.3/tests/test_process.py:804: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = 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.2.3/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.3/tests/covmain.zip': [Errno 2] No such file or directory\n" /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3/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-27/popen-gw47/t21", "path": [ "/tmp/pytest-of-tkloczko/pytest-27/popen-gw47/t21", "/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-7.2.3-2.fc35.x86_64/usr/lib64/python3.8/site-packages", "/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-7.2.3-2.fc35.x86_64/usr/lib/python3.8/site-packages", "/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3/tests/modules", "/home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3/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.2.3/tests/covmain.zip': [Errno 2] No such file or directory ===================================================================================== warnings summary ====================================================================================== tests/test_plugins.py::GoodFileTracerTest::test_defer_to_python /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3/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.3/coverage/control.py:553: CoverageWarning: Plugin file tracers (unexecuted_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.3/coverage/control.py:553: CoverageWarning: Plugin file tracers (bad_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_with_branch tests/test_plugins.py::GoodFileTracerTest::test_plugin2 /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.3/coverage/control.py:553: 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.3/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:1332: 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:1316: Match-case is new in 3.10 SKIPPED [1] tests/test_arcs.py:1363: Match-case is new in 3.10 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 [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: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:734: .pyw files are only on 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] - assert 127 == 0 ERROR tests/test_venv.py::VirtualenvTest::test_third_party_venv_isnt_measured[coverage-False] - assert 127 == 0 ERROR tests/test_venv.py::VirtualenvTest::test_third_party_venv_isnt_measured[python -m coverage-True] - assert 127 == 0 ERROR tests/test_venv.py::VirtualenvTest::test_third_party_venv_isnt_measured[python -m coverage-False] - 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.2.3 without C extension\nFull documentation is at https://coverage.readthedocs.io/en/7.2.3\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_concurrency.py::SigtermTest::test_sigterm_threading_saves_data - AssertionError: assert 'START\nSIGTERM\n' == 'START\nSIGTERM\nTerminated\n' FAILED tests/test_plugins.py::PluginTest::test_plugin_sys_info - AssertionError: assert 'plugins.file_tracers: plugin_sys_info.Plugin' in ['-- sys -------------------------------------------------------', 'coverage_version: 7.2.3', 'coverage_module:... FAILED tests/test_plugins.py::GoodFileTracerTest::test_defer_to_python - AssertionError: assert ['Name ... 3 50%'] == ['Name ... 0 100%'] FAILED tests/test_plugins.py::GoodFileTracerTest::test_find_unexecuted - assert [1] == [99, 999, 9999] FAILED tests/test_plugins.py::BadFileTracerTest::test_plugin_has_inherited_filereporter_method - Failed: DID NOT RAISE 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::BadFileTracerTest::test_file_tracer_fails_eventually - assert 0 == 1 FAILED tests/test_plugins.py::BadFileTracerTest::test_has_dynamic_source_filename_fails - assert 0 == 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_plugins.py::BadFileTracerTest::test_dynamic_source_filename_fails - assert 0 == 1 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::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_source_filename_fails - assert 0 == 1 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_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_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_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_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::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-27/popen-gw11/t18/foo_7.html' as Python source: 'invalid syntax' at line 1 FAILED tests/test_plugins.py::BadFileTracerTest::test_file_tracer_fails - assert 0 == 1 FAILED tests/test_python.py::GetZipBytesTest::test_get_encoded_zip_files[utf-8] - assert None is not None FAILED tests/test_python.py::GetZipBytesTest::test_get_encoded_zip_files[gb2312] - assert None is not None FAILED tests/test_python.py::GetZipBytesTest::test_get_encoded_zip_files[hebrew] - assert None is not None FAILED tests/test_python.py::GetZipBytesTest::test_get_encoded_zip_files[shift_jis] - assert None is not None FAILED tests/test_process.py::ProcessStartupWithSourceTest::test_pth_and_source_work_together[main-pkg-] - AssertionError: File '.coverage' should exist FAILED tests/test_python.py::GetZipBytesTest::test_get_encoded_zip_files[cp1252] - assert None is not None FAILED tests/test_process.py::ProcessStartupWithSourceTest::test_pth_and_source_work_together[sub-pkg-] - AssertionError: File '.coverage' should exist FAILED tests/test_plugins.py::GoodFileTracerTest::test_plugin2 - coverage.exceptions.NotPython: Couldn't parse '/tmp/pytest-of-tkloczko/pytest-27/popen-gw28/t4/foo_7.html' as Python source: 'invalid syntax' at line 1 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[sub---m] - AssertionError: File '.coverage' should exist 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[sub-pkg--m] - 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::ProcessTest::test_tests_dir_is_importable - assert "Traceback (m...covmodzip1'\n" == 'done\n' FAILED tests/test_summary.py::SummaryTest::test_report_just_one - 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[main--] - 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_summary.py::SummaryTest::test_report - ModuleNotFoundError: No module named 'covmodzip1' FAILED tests/test_testing.py::test_xdist_sys_path_nuttiness_is_fixed - AssertionError: assert '/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-7.2.3-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-coverage-7.2.3-... FAILED tests/test_summary.py::SummaryTest::test_report_including - 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_process.py::ProcessStartupTest::test_subprocess_with_pth_files_and_parallel - KeyError: 'sub.py' FAILED tests/test_summary.py::SummaryTest::test_report_omitting - ModuleNotFoundError: No module named 'covmodzip1' 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.2.3/tests/covmain.zip': [Errno 2] No such file or directory\n" 51 failed, 1245 passed, 22 skipped, 2 xfailed, 9 warnings, 14 errors in 16.22s ```
kloczek commented 1 year ago

Test suite complains about missing covmodzip1 in my buildenv hoawever I don't see that module on pypi 🤔

kloczek commented 1 year ago

Just FTR updated pytest output on testing 7.2.5

```console + 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.....s..s....x.. [ 10%] .......x................s............................................... [ 16%] .................F....................................................... [ 21%] ..................................................s...s...ss...........ss. [ 26%] .........ss.........................................s.s................. [ 32%] ........................................................................ [ 37%] ........................................................................ [ 43%] ...................F...F............................................F... [ 48%] ......................................................................... [ 53%] ........................................................................ [ 59%] s................s...................................................... [ 64%] .....................................................s..........s....... [ 69%] ......................s......s................FFF..FFFFFFFFFFFFF.F...FF... [ 75%] .FF.FF....................F..F...F.....................F............F...s [ 80%] ............FFF.F.F.F.............F.................F.Fs................ [ 86%] ...............F...FFF..................F.FF............................ [ 91%] .......F.........................E.........EE.F...Es...................E [ 97%] .E.E...E.EFFEF.EE...EE............... [100%] ==================================== ERRORS ==================================== _ ERROR at setup of VirtualenvTest.test_third_party_venv_isnt_measured[coverage-True] _ [gw11] linux -- Python 3.8.16 /usr/bin/python3 tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-0/popen-gw11'), _trace=, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-0/popen-gw11'), _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] _ [gw11] linux -- Python 3.8.16 /usr/bin/python3 tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-0/popen-gw11'), _trace=, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-0/popen-gw11'), _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] _ [gw11] linux -- Python 3.8.16 /usr/bin/python3 tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-0/popen-gw11'), _trace=, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-0/popen-gw11'), _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] _ [gw11] linux -- Python 3.8.16 /usr/bin/python3 tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-0/popen-gw11'), _trace=, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-0/popen-gw11'), _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] ___ [gw11] linux -- Python 3.8.16 /usr/bin/python3 tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-0/popen-gw11'), _trace=, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-0/popen-gw11'), _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] _ [gw11] linux -- Python 3.8.16 /usr/bin/python3 tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-0/popen-gw11'), _trace=, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-0/popen-gw11'), _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] ______ [gw11] linux -- Python 3.8.16 /usr/bin/python3 tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-0/popen-gw11'), _trace=, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-0/popen-gw11'), _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] _ [gw11] linux -- Python 3.8.16 /usr/bin/python3 tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-0/popen-gw11'), _trace=, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-0/popen-gw11'), _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] ___ [gw11] linux -- Python 3.8.16 /usr/bin/python3 tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-0/popen-gw11'), _trace=, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-0/popen-gw11'), _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] _ [gw11] linux -- Python 3.8.16 /usr/bin/python3 tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-0/popen-gw11'), _trace=, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-0/popen-gw11'), _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] _ [gw11] linux -- Python 3.8.16 /usr/bin/python3 tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-0/popen-gw11'), _trace=, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-0/popen-gw11'), _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] _ [gw11] linux -- Python 3.8.16 /usr/bin/python3 tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-0/popen-gw11'), _trace=, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-0/popen-gw11'), _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] ____________ [gw11] linux -- Python 3.8.16 /usr/bin/python3 tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-0/popen-gw11'), _trace=, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-0/popen-gw11'), _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] _______ [gw11] linux -- Python 3.8.16 /usr/bin/python3 tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-0/popen-gw11'), _trace=, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-0/popen-gw11'), _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 ________________________ [gw44] linux -- Python 3.8.16 /usr/bin/python3 self = 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 _____________________ [gw26] linux -- Python 3.8.16 /usr/bin/python3 self = 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 _________________________ [gw36] linux -- Python 3.8.16 /usr/bin/python3 self = 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 _________________ [gw6] linux -- Python 3.8.16 /usr/bin/python3 self = 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 ___________________ GoodFileTracerTest.test_find_unexecuted ____________________ [gw26] linux -- Python 3.8.16 /usr/bin/python3 self = 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 _______________________ PluginTest.test_plugin_sys_info ________________________ [gw32] linux -- Python 3.8.16 /usr/bin/python3 self = 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 ____________________ [gw6] linux -- Python 3.8.16 /usr/bin/python3 self = 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_returns_wrong _______________ [gw41] linux -- Python 3.8.16 /usr/bin/python3 self = 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 = 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_file_tracer_fails_eventually ______________ [gw30] linux -- Python 3.8.16 /usr/bin/python3 self = 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 = 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 = ('# Oh noes!') E + where = "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 __________ [gw10] linux -- Python 3.8.16 /usr/bin/python3 self = 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 = 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_line_number_range_returns_triple ____________ [gw24] linux -- Python 3.8.16 /usr/bin/python3 self = 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 = 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 ____ [gw4] linux -- Python 3.8.16 /usr/bin/python3 self = 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 = 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}'] _______________ GoodFileTracerTest.test_plugin2_with_html_report _______________ [gw42] linux -- Python 3.8.16 /usr/bin/python3 self = 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 = , 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_returns_wrong _____________ [gw19] linux -- Python 3.8.16 /usr/bin/python3 self = 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 = 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 ___________________ [gw23] linux -- Python 3.8.16 /usr/bin/python3 self = 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 = 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 = ('# Oh noes!') E + where = "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_has_dynamic_source_filename_fails ___________ [gw8] linux -- Python 3.8.16 /usr/bin/python3 self = 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 = 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 = ('# Oh noes!') E + where = "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_raises_error _____________ [gw15] linux -- Python 3.8.16 /usr/bin/python3 self = 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 = 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}'] _______________ GoodFileTracerTest.test_plugin2_with_text_report _______________ [gw28] linux -- Python 3.8.16 /usr/bin/python3 self = 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 = , 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_xml_report ________________ [gw21] linux -- Python 3.8.16 /usr/bin/python3 self = 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 = , 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_line_number_range_returns_pair_of_strings _______ [gw45] linux -- Python 3.8.16 /usr/bin/python3 self = 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 = 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}'] _________ BadFileTracerTest.test_file_tracer_has_no_file_tracer_method _________ [gw5] linux -- Python 3.8.16 /usr/bin/python3 self = 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 = 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_plugin_has_inherited_filereporter_method ________ [gw33] linux -- Python 3.8.16 /usr/bin/python3 self = 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 /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% _______________________ GoodFileTracerTest.test_plugin1 ________________________ [gw40] linux -- Python 3.8.16 /usr/bin/python3 self = 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 ______________ ProcessStartupTest.test_subprocess_with_pth_files _______________ [gw43] linux -- Python 3.8.16 /usr/bin/python3 self = 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 _________________ GoodFileTracerTest.test_plugin2_with_branch __________________ [gw44] linux -- Python 3.8.16 /usr/bin/python3 self = text = 'line 0\nline 1\nline 2\nline 3\nline 4\nline 5\nline 6\n', code = None filename = '/tmp/pytest-of-tkloczko/pytest-0/popen-gw44/t15/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-0/popen-gw44/t15/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 = 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 = text = 'line 0\nline 1\nline 2\nline 3\nline 4\nline 5\nline 6\n', code = None filename = '/tmp/pytest-of-tkloczko/pytest-0/popen-gw44/t15/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-0/popen-gw44/t15/foo_7.html' as Python source: 'invalid syntax' at line 1 /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/coverage/parser.py:390: NotPython _____________ BadFileTracerTest.test_dynamic_source_filename_fails _____________ [gw40] linux -- Python 3.8.16 /usr/bin/python3 self = 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 = 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 = ('# Oh noes!') E + where = "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_plugin2 ________________________ [gw46] linux -- Python 3.8.16 /usr/bin/python3 self = text = 'line 0\nline 1\nline 2\nline 3\nline 4\nline 5\nline 6\n', code = None filename = '/tmp/pytest-of-tkloczko/pytest-0/popen-gw46/t12/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-0/popen-gw46/t12/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 = 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 = text = 'line 0\nline 1\nline 2\nline 3\nline 4\nline 5\nline 6\n', code = None filename = '/tmp/pytest-of-tkloczko/pytest-0/popen-gw46/t12/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-0/popen-gw46/t12/foo_7.html' as Python source: 'invalid syntax' at line 1 /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/coverage/parser.py:390: NotPython ________________________ ProcessTest.test_fullcoverage _________________________ [gw17] linux -- Python 3.8.16 /usr/bin/python3 self = @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 _________________ BadFileTracerTest.test_source_filename_fails _________________ [gw46] linux -- Python 3.8.16 /usr/bin/python3 self = 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 = 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 = ('# Oh noes!') E + where = "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 _ ProcessStartupWithSourceTest.test_pth_and_source_work_together[main-pkg--m] __ [gw43] linux -- Python 3.8.16 /usr/bin/python3 self = 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 = 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 = ('.coverage') E + where = .exists E + where = 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---m] ___ [gw40] linux -- Python 3.8.16 /usr/bin/python3 self = 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 = 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 = ('.coverage') E + where = .exists E + where = os.path /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/coveragetest.py:340: AssertionError ----------------------------- Captured stdout call ----------------------------- _______________ EnvironmentTest.test_coverage_zip_is_like_python _______________ [gw38] linux -- Python 3.8.16 /usr/bin/python3 self = 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 = 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-0/popen-gw38/t20", "path": [ "/tmp/pytest-of-tkloczko/pytest-0/popen-gw38/t20", "/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 _______________________ SummaryTest.test_report_omitting _______________________ [gw46] linux -- Python 3.8.16 /usr/bin/python3 self = 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) :843: in exec_module ??? :219: in _call_with_frames_removed ??? _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ import covmod1 > import covmodzip1 E ModuleNotFoundError: No module named 'covmodzip1' /tmp/pytest-of-tkloczko/pytest-0/popen-gw46/t15/mycode.py:2: ModuleNotFoundError ______________________ SummaryTest.test_report_including _______________________ [gw40] linux -- Python 3.8.16 /usr/bin/python3 self = 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) :843: in exec_module ??? :219: in _call_with_frames_removed ??? _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ import covmod1 > import covmodzip1 E ModuleNotFoundError: No module named 'covmodzip1' /tmp/pytest-of-tkloczko/pytest-0/popen-gw40/t13/mycode.py:2: ModuleNotFoundError ____ ProcessStartupWithSourceTest.test_pth_and_source_work_together[sub--] _____ [gw43] linux -- Python 3.8.16 /usr/bin/python3 self = 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 = 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 = ('.coverage') E + where = .exists E + where = os.path /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/coveragetest.py:340: AssertionError ----------------------------- Captured stdout call ----------------------------- ___________ SummaryTest.test_report_include_relative_files_and_path ____________ [gw11] linux -- Python 3.8.16 /usr/bin/python3 self = 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) :843: in exec_module ??? :219: in _call_with_frames_removed ??? /tmp/pytest-of-tkloczko/pytest-0/popen-gw11/t8/submodule/mycode.py:1: in import mycode _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ import covmod1 > import covmodzip1 E ModuleNotFoundError: No module named 'covmodzip1' /tmp/pytest-of-tkloczko/pytest-0/popen-gw11/t8/mycode.py:2: ModuleNotFoundError ____ ProcessStartupWithSourceTest.test_pth_and_source_work_together[main--] ____ [gw3] linux -- Python 3.8.16 /usr/bin/python3 self = 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 = 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 = ('.coverage') E + where = .exists E + where = os.path /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/coveragetest.py:340: AssertionError ----------------------------- Captured stdout call ----------------------------- _______ SummaryTest.test_report_include_relative_files_and_wildcard_path _______ [gw14] linux -- Python 3.8.16 /usr/bin/python3 self = 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) :843: in exec_module ??? :219: in _call_with_frames_removed ??? /tmp/pytest-of-tkloczko/pytest-0/popen-gw14/t7/submodule/mycode.py:1: in import nested.submodule.mycode /tmp/pytest-of-tkloczko/pytest-0/popen-gw14/t7/nested/submodule/mycode.py:1: in import mycode _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ import covmod1 > import covmodzip1 E ModuleNotFoundError: No module named 'covmodzip1' /tmp/pytest-of-tkloczko/pytest-0/popen-gw14/t7/mycode.py:2: ModuleNotFoundError ___ ProcessStartupWithSourceTest.test_pth_and_source_work_together[sub-pkg-] ___ [gw38] linux -- Python 3.8.16 /usr/bin/python3 self = 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 = 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 = ('.coverage') E + where = .exists E + where = os.path /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/coveragetest.py:340: AssertionError ----------------------------- Captured stdout call ----------------------------- ___________________________ SummaryTest.test_report ____________________________ [gw37] linux -- Python 3.8.16 /usr/bin/python3 self = 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) :843: in exec_module ??? :219: in _call_with_frames_removed ??? _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ import covmod1 > import covmodzip1 E ModuleNotFoundError: No module named 'covmodzip1' /tmp/pytest-of-tkloczko/pytest-0/popen-gw37/t20/mycode.py:2: ModuleNotFoundError _______________________ SummaryTest.test_report_just_one _______________________ [gw29] linux -- Python 3.8.16 /usr/bin/python3 self = 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) :843: in exec_module ??? :219: in _call_with_frames_removed ??? _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ import covmod1 > import covmodzip1 E ModuleNotFoundError: No module named 'covmodzip1' /tmp/pytest-of-tkloczko/pytest-0/popen-gw29/t12/mycode.py:2: ModuleNotFoundError ______________ GetZipBytesTest.test_get_encoded_zip_files[utf-8] _______________ [gw44] linux -- Python 3.8.16 /usr/bin/python3 self = 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] ______________ [gw44] linux -- Python 3.8.16 /usr/bin/python3 self = 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] ______________ [gw44] linux -- Python 3.8.16 /usr/bin/python3 self = 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] _____________ [gw44] linux -- Python 3.8.16 /usr/bin/python3 self = 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 ______________ GetZipBytesTest.test_get_encoded_zip_files[cp1252] ______________ [gw44] linux -- Python 3.8.16 /usr/bin/python3 self = 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 ___________________ ProcessTest.test_tests_dir_is_importable ___________________ [gw39] linux -- Python 3.8.16 /usr/bin/python3 self = 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 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 import covmodzip1 ModuleNotFoundError: No module named 'covmodzip1' ____________________ 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' = ('PYTHONPATH') 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)'}).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[sub-pkg--m] __ [gw20] linux -- Python 3.8.16 /usr/bin/python3 self = 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 = 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 = ('.coverage') E + where = .exists E + where = os.path /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/coveragetest.py:340: AssertionError ----------------------------- Captured stdout call ----------------------------- ________ ProcessStartupTest.test_subprocess_with_pth_files_and_parallel ________ [gw33] linux -- Python 3.8.16 /usr/bin/python3 self = 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 _______________________ SummaryTest.test_report_wildcard _______________________ [gw3] linux -- Python 3.8.16 /usr/bin/python3 self = 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 import covmodzip1 ModuleNotFoundError: No module named 'covmodzip1' Name Stmts Miss Cover ------------------------------- mycode.py 4 2 50% ------------------------------- TOTAL 4 2 50% ___ ProcessStartupWithSourceTest.test_pth_and_source_work_together[sub---m] ____ [gw47] linux -- Python 3.8.16 /usr/bin/python3 self = 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 = 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 = ('.coverage') E + where = .exists E + where = 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-] ___ [gw33] linux -- Python 3.8.16 /usr/bin/python3 self = 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 = 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 = ('.coverage') E + where = .exists E + where = os.path /home/tkloczko/rpmbuild/BUILD/coveragepy-7.2.5/tests/coveragetest.py:340: AssertionError ----------------------------- Captured stdout call ----------------------------- =============================== warnings summary =============================== 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_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_plugin2_with_html_report 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_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:1332: 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 [3] tests/test_concurrency.py:229: 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 [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_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: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_phystokens.py:119: Soft keywords are new in Python 3.10 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_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-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::GoodFileTracerTest::test_find_unexecuted - asse... 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_returns_wrong 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_line_number_range_returns_triple FAILED tests/test_plugins.py::BadFileTracerTest::test_file_tracer_has_inherited_sourcefilename_method FAILED tests/test_plugins.py::GoodFileTracerTest::test_plugin2_with_html_report FAILED tests/test_plugins.py::BadFileTracerTest::test_source_filename_returns_wrong FAILED tests/test_plugins.py::BadFileTracerTest::test_file_tracer_fails - ass... FAILED tests/test_plugins.py::BadFileTracerTest::test_has_dynamic_source_filename_fails 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::GoodFileTracerTest::test_plugin2_with_xml_report FAILED tests/test_plugins.py::BadFileTracerTest::test_line_number_range_returns_pair_of_strings FAILED tests/test_plugins.py::BadFileTracerTest::test_file_tracer_has_no_file_tracer_method FAILED tests/test_plugins.py::BadFileTracerTest::test_plugin_has_inherited_filereporter_method FAILED tests/test_plugins.py::GoodFileTracerTest::test_plugin1 - coverage.exc... FAILED tests/test_process.py::ProcessStartupTest::test_subprocess_with_pth_files FAILED tests/test_plugins.py::GoodFileTracerTest::test_plugin2_with_branch - ... FAILED tests/test_plugins.py::BadFileTracerTest::test_dynamic_source_filename_fails FAILED tests/test_plugins.py::GoodFileTracerTest::test_plugin2 - coverage.exc... FAILED tests/test_process.py::ProcessTest::test_fullcoverage - AssertionError... FAILED tests/test_plugins.py::BadFileTracerTest::test_source_filename_fails 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_process.py::EnvironmentTest::test_coverage_zip_is_like_python FAILED tests/test_summary.py::SummaryTest::test_report_omitting - ModuleNotFo... FAILED tests/test_summary.py::SummaryTest::test_report_including - ModuleNotF... FAILED tests/test_process.py::ProcessStartupWithSourceTest::test_pth_and_source_work_together[sub--] FAILED tests/test_summary.py::SummaryTest::test_report_include_relative_files_and_path FAILED tests/test_process.py::ProcessStartupWithSourceTest::test_pth_and_source_work_together[main--] FAILED tests/test_summary.py::SummaryTest::test_report_include_relative_files_and_wildcard_path FAILED tests/test_process.py::ProcessStartupWithSourceTest::test_pth_and_source_work_together[sub-pkg-] FAILED tests/test_summary.py::SummaryTest::test_report - ModuleNotFoundError:... FAILED tests/test_summary.py::SummaryTest::test_report_just_one - ModuleNotFo... 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_python.py::GetZipBytesTest::test_get_encoded_zip_files[cp1252] FAILED tests/test_process.py::ProcessTest::test_tests_dir_is_importable - ass... 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[sub-pkg--m] FAILED tests/test_process.py::ProcessStartupTest::test_subprocess_with_pth_files_and_parallel FAILED tests/test_summary.py::SummaryTest::test_report_wildcard - AssertionEr... 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-pkg-] 53 failed, 1249 passed, 23 skipped, 2 xfailed, 9 warnings, 14 errors in 14.87s ```
nedbat commented 1 year ago

@kloczek I see you are still interested enough to re-test this on new versions of coverage.py. What I need are very very very specific instructions about how to reproduce it. What exact repo should I clone? What exact commands should I type to see what you are seeing? What versions of packages do you have installed? In what version of Python?

kloczek commented 1 year ago

Just please try to execute in project source root directory something like below:

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'))") pytest

Instead installer module ypu can use pip comman to unpack generated .whl into /tmp/coveragepy

kloczek commented 1 year ago

First issue which needs to be sorted out is hardcoded python executable name (I have only python3). As I wrote sys.executable should be used always when python executable name is needed.

nedbat commented 1 year ago

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: https://github.com/nedbat/coveragepy/blob/31c216b67ffb21c589fd39b55fe1bbd26d5bf705/tests/coveragetest.py#L428-L434

Do you have specific changes to suggest?

kloczek commented 1 year ago

Look .. that wherenever is necessary to use python executable its name ishoud be not used hardcoded python but what rerurns sys.executable .. not conditionally but allways.

[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 command_name is not used ans is used hardcoded python.

All pip and coverage executions not done over python -m <module>ane should be uses wrapper scripts all because when module is executed over python -m <foo> current directory is added sys.path.

kloczek commented 1 year ago

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")
nedbat commented 1 year ago

If you look at the code I linked you to earlier, it's the run_command_status function, which replaces the first word "python" with sys.executable. The run_command function calls run_command_status. So all of those function calls are already using sys.executable.

kloczek commented 1 year ago

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 run_command_status not used.

nedbat commented 1 year ago

Are you sure changing those uses will fix your problem? run_in_venv runs those commands in a venv we just created.

kloczek commented 1 year ago

So why it fails? 🤔

nedbat commented 1 year ago

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 ``` Cloning into 'coveragepy'... remote: Enumerating objects: 36262, done. remote: Counting objects: 100% (308/308), done. remote: Compressing objects: 100% (111/111), done. remote: Total 36262 (delta 233), reused 243 (delta 197), pack-reused 35954 Receiving objects: 100% (36262/36262), 18.06 MiB | 7.72 MiB/s, done. ```
python3.7 -m venv venv ``` ```
. ./venv/bin/activate ``` ```
cd coveragepy ``` ```
pip install -r requirements/dev.pip ``` Collecting astroid==2.15.4 Using cached astroid-2.15.4-py3-none-any.whl (278 kB) Collecting attrs==23.1.0 Using cached attrs-23.1.0-py3-none-any.whl (61 kB) Collecting bleach==6.0.0 Using cached bleach-6.0.0-py3-none-any.whl (162 kB) Collecting build==0.10.0 Using cached build-0.10.0-py3-none-any.whl (17 kB) Collecting cachetools==5.3.0 Using cached cachetools-5.3.0-py3-none-any.whl (9.3 kB) Collecting certifi==2022.12.7 Using cached certifi-2022.12.7-py3-none-any.whl (155 kB) Collecting chardet==5.1.0 Using cached chardet-5.1.0-py3-none-any.whl (199 kB) Collecting charset-normalizer==3.1.0 Using cached charset_normalizer-3.1.0-cp37-cp37m-macosx_10_9_x86_64.whl (121 kB) Collecting check-manifest==0.49 Using cached check_manifest-0.49-py3-none-any.whl (20 kB) Collecting cogapp==3.3.0 Using cached cogapp-3.3.0-py2.py3-none-any.whl (28 kB) Collecting colorama==0.4.6 Using cached colorama-0.4.6-py2.py3-none-any.whl (25 kB) Collecting dill==0.3.6 Using cached dill-0.3.6-py3-none-any.whl (110 kB) Collecting distlib==0.3.6 Using cached distlib-0.3.6-py2.py3-none-any.whl (468 kB) Collecting docutils==0.19 Using cached docutils-0.19-py3-none-any.whl (570 kB) Collecting exceptiongroup==1.1.1 Using cached exceptiongroup-1.1.1-py3-none-any.whl (14 kB) Collecting execnet==1.9.0 Using cached execnet-1.9.0-py2.py3-none-any.whl (39 kB) Collecting filelock==3.12.0 Using cached filelock-3.12.0-py3-none-any.whl (10 kB) Collecting flaky==3.7.0 Using cached flaky-3.7.0-py2.py3-none-any.whl (22 kB) Collecting greenlet==2.0.2 Using cached greenlet-2.0.2-cp37-cp37m-macosx_10_15_x86_64.whl (240 kB) Collecting hypothesis==6.74.1 Using cached hypothesis-6.74.1-py3-none-any.whl (409 kB) Collecting idna==3.4 Using cached idna-3.4-py3-none-any.whl (61 kB) Collecting importlib-metadata==6.6.0 Using cached importlib_metadata-6.6.0-py3-none-any.whl (22 kB) Collecting importlib-resources==5.12.0 Using cached importlib_resources-5.12.0-py3-none-any.whl (36 kB) Collecting iniconfig==2.0.0 Using cached iniconfig-2.0.0-py3-none-any.whl (5.9 kB) Collecting isort==5.11.5 Using cached isort-5.11.5-py3-none-any.whl (104 kB) Collecting jaraco-classes==3.2.3 Using cached jaraco.classes-3.2.3-py3-none-any.whl (6.0 kB) Collecting jedi==0.18.2 Using cached jedi-0.18.2-py2.py3-none-any.whl (1.6 MB) Collecting keyring==23.13.1 Using cached keyring-23.13.1-py3-none-any.whl (37 kB) Collecting lazy-object-proxy==1.9.0 Using cached lazy_object_proxy-1.9.0-cp37-cp37m-macosx_10_9_x86_64.whl (22 kB) Collecting libsass==0.22.0 Using cached libsass-0.22.0-cp37-abi3-macosx_10_15_x86_64.whl (1.1 MB) Collecting markdown-it-py==2.2.0 Using cached markdown_it_py-2.2.0-py3-none-any.whl (84 kB) Collecting mccabe==0.7.0 Using cached mccabe-0.7.0-py2.py3-none-any.whl (7.3 kB) Collecting mdurl==0.1.2 Using cached mdurl-0.1.2-py3-none-any.whl (10.0 kB) Collecting more-itertools==9.1.0 Using cached more_itertools-9.1.0-py3-none-any.whl (54 kB) Collecting packaging==23.1 Using cached packaging-23.1-py3-none-any.whl (48 kB) Collecting parso==0.8.3 Using cached parso-0.8.3-py2.py3-none-any.whl (100 kB) Collecting pkginfo==1.9.6 Using cached pkginfo-1.9.6-py3-none-any.whl (30 kB) Collecting platformdirs==3.5.0 Using cached platformdirs-3.5.0-py3-none-any.whl (15 kB) Collecting pluggy==1.0.0 Using cached pluggy-1.0.0-py2.py3-none-any.whl (13 kB) Collecting pudb==2022.1.3 Using cached pudb-2022.1.3-py3-none-any.whl Collecting pygments==2.15.1 Using cached Pygments-2.15.1-py3-none-any.whl (1.1 MB) Collecting pylint==2.17.3 Using cached pylint-2.17.3-py3-none-any.whl (536 kB) Collecting pyproject-api==1.5.1 Using cached pyproject_api-1.5.1-py3-none-any.whl (12 kB) Collecting pyproject-hooks==1.0.0 Using cached pyproject_hooks-1.0.0-py3-none-any.whl (9.3 kB) Collecting pytest==7.3.1 Using cached pytest-7.3.1-py3-none-any.whl (320 kB) Collecting pytest-xdist==3.2.1 Using cached pytest_xdist-3.2.1-py3-none-any.whl (41 kB) Collecting readme-renderer==37.3 Using cached readme_renderer-37.3-py3-none-any.whl (14 kB) Collecting requests==2.29.0 Using cached requests-2.29.0-py3-none-any.whl (62 kB) Collecting requests-toolbelt==0.10.1 Using cached requests_toolbelt-0.10.1-py2.py3-none-any.whl (54 kB) Collecting rfc3986==2.0.0 Using cached rfc3986-2.0.0-py2.py3-none-any.whl (31 kB) Collecting rich==13.3.5 Using cached rich-13.3.5-py3-none-any.whl (238 kB) Collecting six==1.16.0 Using cached six-1.16.0-py2.py3-none-any.whl (11 kB) Collecting sortedcontainers==2.4.0 Using cached sortedcontainers-2.4.0-py2.py3-none-any.whl (29 kB) Collecting tomli==2.0.1 Using cached tomli-2.0.1-py3-none-any.whl (12 kB) Collecting tomlkit==0.11.8 Using cached tomlkit-0.11.8-py3-none-any.whl (35 kB) Collecting tox==4.5.1 Using cached tox-4.5.1-py3-none-any.whl (148 kB) Collecting tox-gh==1.0.0 Using cached tox_gh-1.0.0-py3-none-any.whl (5.9 kB) Collecting twine==4.0.2 Using cached twine-4.0.2-py3-none-any.whl (36 kB) Collecting typed-ast==1.5.4 Using cached typed_ast-1.5.4-cp37-cp37m-macosx_10_9_x86_64.whl (221 kB) Collecting typing-extensions==4.5.0 Using cached typing_extensions-4.5.0-py3-none-any.whl (27 kB) Collecting urllib3==1.26.15 Using cached urllib3-1.26.15-py2.py3-none-any.whl (140 kB) Collecting urwid==2.1.2 Using cached urwid-2.1.2-cp37-cp37m-macosx_10_15_x86_64.whl Collecting urwid-readline==0.13 Using cached urwid_readline-0.13-py3-none-any.whl Collecting virtualenv==20.23.0 Using cached virtualenv-20.23.0-py3-none-any.whl (3.3 MB) Collecting webencodings==0.5.1 Using cached webencodings-0.5.1-py2.py3-none-any.whl (11 kB) Collecting wrapt==1.15.0 Using cached wrapt-1.15.0-cp37-cp37m-macosx_10_9_x86_64.whl (35 kB) Collecting zipp==3.15.0 Using cached zipp-3.15.0-py3-none-any.whl (6.8 kB) Collecting pip==23.1.2 Using cached pip-23.1.2-py3-none-any.whl (2.1 MB) Collecting setuptools==65.7.0 Using cached setuptools-65.7.0-py3-none-any.whl (1.2 MB) Installing collected packages: webencodings, urwid, sortedcontainers, distlib, zipp, wrapt, urwid-readline, urllib3, typing-extensions, typed-ast, tomlkit, tomli, six, setuptools, rfc3986, pygments, pkginfo, pip, parso, packaging, more-itertools, mdurl, mccabe, libsass, lazy-object-proxy, isort, iniconfig, idna, greenlet, flaky, filelock, execnet, exceptiongroup, docutils, dill, colorama, cogapp, charset-normalizer, chardet, certifi, cachetools, requests, pyproject-hooks, pyproject-api, platformdirs, markdown-it-py, jedi, jaraco-classes, importlib-resources, importlib-metadata, bleach, astroid, virtualenv, rich, requests-toolbelt, readme-renderer, pylint, pudb, pluggy, keyring, build, attrs, twine, tox, pytest, hypothesis, check-manifest, tox-gh, pytest-xdist Attempting uninstall: setuptools Found existing installation: setuptools 47.1.0 Uninstalling setuptools-47.1.0: Successfully uninstalled setuptools-47.1.0 Attempting uninstall: pip Found existing installation: pip 22.0.4 Uninstalling pip-22.0.4: Successfully uninstalled pip-22.0.4 ```
python3 -m pip install build installer wheel ``` Requirement already satisfied: build in /private/tmp/bug1373/venv/lib/python3.7/site-packages (0.10.0) Requirement already satisfied: installer in /private/tmp/bug1373/venv/lib/python3.7/site-packages (0.7.0) Collecting wheel Using cached wheel-0.40.0-py3-none-any.whl (64 kB) Requirement already satisfied: packaging>=19.0 in /private/tmp/bug1373/venv/lib/python3.7/site-packages (from build) (23.1) Requirement already satisfied: pyproject_hooks in /private/tmp/bug1373/venv/lib/python3.7/site-packages (from build) (1.0.0) Requirement already satisfied: importlib-metadata>=0.22 in /private/tmp/bug1373/venv/lib/python3.7/site-packages (from build) (6.6.0) Requirement already satisfied: tomli>=1.1.0 in /private/tmp/bug1373/venv/lib/python3.7/site-packages (from build) (2.0.1) Requirement already satisfied: zipp>=0.5 in /private/tmp/bug1373/venv/lib/python3.7/site-packages (from importlib-metadata>=0.22->build) (3.15.0) Requirement already satisfied: typing-extensions>=3.6.4 in /private/tmp/bug1373/venv/lib/python3.7/site-packages (from importlib-metadata>=0.22->build) (4.5.0) Installing collected packages: wheel ```
python3 -sBm build -w --no-isolation ``` * Getting build dependencies for wheel... running egg_info writing coverage.egg-info/PKG-INFO writing dependency_links to coverage.egg-info/dependency_links.txt writing entry points to coverage.egg-info/entry_points.txt writing requirements to coverage.egg-info/requires.txt writing top-level names to coverage.egg-info/top_level.txt reading manifest file 'coverage.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' no previously-included directories found matching 'doc/_build' no previously-included directories found matching 'doc/_spell' no previously-included directories found matching 'tests/eggsrc/build' adding license file 'LICENSE.txt' writing manifest file 'coverage.egg-info/SOURCES.txt' * Building wheel... running bdist_wheel running build running build_py creating build creating build/lib.macosx-10.15-x86_64-cpython-37 creating build/lib.macosx-10.15-x86_64-cpython-37/coverage copying coverage/misc.py -> build/lib.macosx-10.15-x86_64-cpython-37/coverage copying coverage/files.py -> build/lib.macosx-10.15-x86_64-cpython-37/coverage copying coverage/phystokens.py -> build/lib.macosx-10.15-x86_64-cpython-37/coverage copying coverage/lcovreport.py -> build/lib.macosx-10.15-x86_64-cpython-37/coverage copying coverage/config.py -> build/lib.macosx-10.15-x86_64-cpython-37/coverage copying coverage/version.py -> build/lib.macosx-10.15-x86_64-cpython-37/coverage copying coverage/env.py -> build/lib.macosx-10.15-x86_64-cpython-37/coverage copying coverage/templite.py -> build/lib.macosx-10.15-x86_64-cpython-37/coverage copying coverage/results.py -> build/lib.macosx-10.15-x86_64-cpython-37/coverage copying coverage/plugin_support.py -> build/lib.macosx-10.15-x86_64-cpython-37/coverage copying coverage/numbits.py -> build/lib.macosx-10.15-x86_64-cpython-37/coverage copying coverage/control.py -> build/lib.macosx-10.15-x86_64-cpython-37/coverage copying coverage/html.py -> build/lib.macosx-10.15-x86_64-cpython-37/coverage copying coverage/cmdline.py -> build/lib.macosx-10.15-x86_64-cpython-37/coverage copying coverage/collector.py -> build/lib.macosx-10.15-x86_64-cpython-37/coverage copying coverage/__init__.py -> build/lib.macosx-10.15-x86_64-cpython-37/coverage copying coverage/pytracer.py -> build/lib.macosx-10.15-x86_64-cpython-37/coverage copying coverage/types.py -> build/lib.macosx-10.15-x86_64-cpython-37/coverage copying coverage/annotate.py -> build/lib.macosx-10.15-x86_64-cpython-37/coverage copying coverage/sqldata.py -> build/lib.macosx-10.15-x86_64-cpython-37/coverage copying coverage/disposition.py -> build/lib.macosx-10.15-x86_64-cpython-37/coverage copying coverage/parser.py -> build/lib.macosx-10.15-x86_64-cpython-37/coverage copying coverage/summary.py -> build/lib.macosx-10.15-x86_64-cpython-37/coverage copying coverage/context.py -> build/lib.macosx-10.15-x86_64-cpython-37/coverage copying coverage/xmlreport.py -> build/lib.macosx-10.15-x86_64-cpython-37/coverage copying coverage/debug.py -> build/lib.macosx-10.15-x86_64-cpython-37/coverage copying coverage/python.py -> build/lib.macosx-10.15-x86_64-cpython-37/coverage copying coverage/plugin.py -> build/lib.macosx-10.15-x86_64-cpython-37/coverage copying coverage/exceptions.py -> build/lib.macosx-10.15-x86_64-cpython-37/coverage copying coverage/inorout.py -> build/lib.macosx-10.15-x86_64-cpython-37/coverage copying coverage/jsonreport.py -> build/lib.macosx-10.15-x86_64-cpython-37/coverage copying coverage/bytecode.py -> build/lib.macosx-10.15-x86_64-cpython-37/coverage copying coverage/tomlconfig.py -> build/lib.macosx-10.15-x86_64-cpython-37/coverage copying coverage/execfile.py -> build/lib.macosx-10.15-x86_64-cpython-37/coverage copying coverage/multiproc.py -> build/lib.macosx-10.15-x86_64-cpython-37/coverage copying coverage/__main__.py -> build/lib.macosx-10.15-x86_64-cpython-37/coverage copying coverage/report.py -> build/lib.macosx-10.15-x86_64-cpython-37/coverage copying coverage/data.py -> build/lib.macosx-10.15-x86_64-cpython-37/coverage creating build/lib.macosx-10.15-x86_64-cpython-37/coverage/htmlfiles copying coverage/htmlfiles/favicon_32.png -> build/lib.macosx-10.15-x86_64-cpython-37/coverage/htmlfiles copying coverage/htmlfiles/coverage_html.js -> build/lib.macosx-10.15-x86_64-cpython-37/coverage/htmlfiles copying coverage/htmlfiles/pyfile.html -> build/lib.macosx-10.15-x86_64-cpython-37/coverage/htmlfiles copying coverage/htmlfiles/index.html -> build/lib.macosx-10.15-x86_64-cpython-37/coverage/htmlfiles copying coverage/htmlfiles/keybd_open.png -> build/lib.macosx-10.15-x86_64-cpython-37/coverage/htmlfiles copying coverage/htmlfiles/style.scss -> build/lib.macosx-10.15-x86_64-cpython-37/coverage/htmlfiles copying coverage/htmlfiles/style.css -> build/lib.macosx-10.15-x86_64-cpython-37/coverage/htmlfiles copying coverage/htmlfiles/keybd_closed.png -> build/lib.macosx-10.15-x86_64-cpython-37/coverage/htmlfiles creating build/lib.macosx-10.15-x86_64-cpython-37/coverage/fullcoverage copying coverage/fullcoverage/encodings.py -> build/lib.macosx-10.15-x86_64-cpython-37/coverage/fullcoverage copying coverage/py.typed -> build/lib.macosx-10.15-x86_64-cpython-37/coverage running build_ext building 'coverage.tracer' extension creating build/temp.macosx-10.15-x86_64-cpython-37 creating build/temp.macosx-10.15-x86_64-cpython-37/coverage creating build/temp.macosx-10.15-x86_64-cpython-37/coverage/ctracer clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include -I/private/tmp/bug1373/venv/include -I/usr/local/pyenv/pyenv/versions/3.7.15/include/python3.7m -c coverage/ctracer/datastack.c -o build/temp.macosx-10.15-x86_64-cpython-37/coverage/ctracer/datastack.o clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include -I/private/tmp/bug1373/venv/include -I/usr/local/pyenv/pyenv/versions/3.7.15/include/python3.7m -c coverage/ctracer/filedisp.c -o build/temp.macosx-10.15-x86_64-cpython-37/coverage/ctracer/filedisp.o clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include -I/private/tmp/bug1373/venv/include -I/usr/local/pyenv/pyenv/versions/3.7.15/include/python3.7m -c coverage/ctracer/module.c -o build/temp.macosx-10.15-x86_64-cpython-37/coverage/ctracer/module.o clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include -I/private/tmp/bug1373/venv/include -I/usr/local/pyenv/pyenv/versions/3.7.15/include/python3.7m -c coverage/ctracer/tracer.c -o build/temp.macosx-10.15-x86_64-cpython-37/coverage/ctracer/tracer.o clang -bundle -undefined dynamic_lookup -L/usr/local/opt/readline/lib -L/usr/local/opt/readline/lib -L/usr/local/pyenv/pyenv/versions/3.7.15/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/readline/lib -L/usr/local/pyenv/pyenv/versions/3.7.15/lib build/temp.macosx-10.15-x86_64-cpython-37/coverage/ctracer/datastack.o build/temp.macosx-10.15-x86_64-cpython-37/coverage/ctracer/filedisp.o build/temp.macosx-10.15-x86_64-cpython-37/coverage/ctracer/module.o build/temp.macosx-10.15-x86_64-cpython-37/coverage/ctracer/tracer.o -o build/lib.macosx-10.15-x86_64-cpython-37/coverage/tracer.cpython-37m-darwin.so installing to build/bdist.macosx-10.15-x86_64/wheel running install running install_lib creating build/bdist.macosx-10.15-x86_64 creating build/bdist.macosx-10.15-x86_64/wheel creating build/bdist.macosx-10.15-x86_64/wheel/coverage copying build/lib.macosx-10.15-x86_64-cpython-37/coverage/misc.py -> build/bdist.macosx-10.15-x86_64/wheel/coverage copying build/lib.macosx-10.15-x86_64-cpython-37/coverage/files.py -> build/bdist.macosx-10.15-x86_64/wheel/coverage copying build/lib.macosx-10.15-x86_64-cpython-37/coverage/phystokens.py -> build/bdist.macosx-10.15-x86_64/wheel/coverage copying build/lib.macosx-10.15-x86_64-cpython-37/coverage/lcovreport.py -> build/bdist.macosx-10.15-x86_64/wheel/coverage copying build/lib.macosx-10.15-x86_64-cpython-37/coverage/config.py -> build/bdist.macosx-10.15-x86_64/wheel/coverage copying build/lib.macosx-10.15-x86_64-cpython-37/coverage/version.py -> build/bdist.macosx-10.15-x86_64/wheel/coverage copying build/lib.macosx-10.15-x86_64-cpython-37/coverage/env.py -> build/bdist.macosx-10.15-x86_64/wheel/coverage copying build/lib.macosx-10.15-x86_64-cpython-37/coverage/templite.py -> build/bdist.macosx-10.15-x86_64/wheel/coverage copying build/lib.macosx-10.15-x86_64-cpython-37/coverage/results.py -> build/bdist.macosx-10.15-x86_64/wheel/coverage copying build/lib.macosx-10.15-x86_64-cpython-37/coverage/plugin_support.py -> build/bdist.macosx-10.15-x86_64/wheel/coverage copying build/lib.macosx-10.15-x86_64-cpython-37/coverage/numbits.py -> build/bdist.macosx-10.15-x86_64/wheel/coverage copying build/lib.macosx-10.15-x86_64-cpython-37/coverage/tracer.cpython-37m-darwin.so -> build/bdist.macosx-10.15-x86_64/wheel/coverage copying build/lib.macosx-10.15-x86_64-cpython-37/coverage/control.py -> build/bdist.macosx-10.15-x86_64/wheel/coverage copying build/lib.macosx-10.15-x86_64-cpython-37/coverage/html.py -> build/bdist.macosx-10.15-x86_64/wheel/coverage copying build/lib.macosx-10.15-x86_64-cpython-37/coverage/cmdline.py -> build/bdist.macosx-10.15-x86_64/wheel/coverage copying build/lib.macosx-10.15-x86_64-cpython-37/coverage/collector.py -> build/bdist.macosx-10.15-x86_64/wheel/coverage copying build/lib.macosx-10.15-x86_64-cpython-37/coverage/__init__.py -> build/bdist.macosx-10.15-x86_64/wheel/coverage copying build/lib.macosx-10.15-x86_64-cpython-37/coverage/pytracer.py -> build/bdist.macosx-10.15-x86_64/wheel/coverage copying build/lib.macosx-10.15-x86_64-cpython-37/coverage/types.py -> build/bdist.macosx-10.15-x86_64/wheel/coverage copying build/lib.macosx-10.15-x86_64-cpython-37/coverage/annotate.py -> build/bdist.macosx-10.15-x86_64/wheel/coverage copying build/lib.macosx-10.15-x86_64-cpython-37/coverage/sqldata.py -> build/bdist.macosx-10.15-x86_64/wheel/coverage copying build/lib.macosx-10.15-x86_64-cpython-37/coverage/disposition.py -> build/bdist.macosx-10.15-x86_64/wheel/coverage creating build/bdist.macosx-10.15-x86_64/wheel/coverage/htmlfiles copying build/lib.macosx-10.15-x86_64-cpython-37/coverage/htmlfiles/favicon_32.png -> build/bdist.macosx-10.15-x86_64/wheel/coverage/htmlfiles copying build/lib.macosx-10.15-x86_64-cpython-37/coverage/htmlfiles/coverage_html.js -> build/bdist.macosx-10.15-x86_64/wheel/coverage/htmlfiles copying build/lib.macosx-10.15-x86_64-cpython-37/coverage/htmlfiles/pyfile.html -> build/bdist.macosx-10.15-x86_64/wheel/coverage/htmlfiles copying build/lib.macosx-10.15-x86_64-cpython-37/coverage/htmlfiles/index.html -> build/bdist.macosx-10.15-x86_64/wheel/coverage/htmlfiles copying build/lib.macosx-10.15-x86_64-cpython-37/coverage/htmlfiles/keybd_open.png -> build/bdist.macosx-10.15-x86_64/wheel/coverage/htmlfiles copying build/lib.macosx-10.15-x86_64-cpython-37/coverage/htmlfiles/style.scss -> build/bdist.macosx-10.15-x86_64/wheel/coverage/htmlfiles copying build/lib.macosx-10.15-x86_64-cpython-37/coverage/htmlfiles/style.css -> build/bdist.macosx-10.15-x86_64/wheel/coverage/htmlfiles copying build/lib.macosx-10.15-x86_64-cpython-37/coverage/htmlfiles/keybd_closed.png -> build/bdist.macosx-10.15-x86_64/wheel/coverage/htmlfiles copying build/lib.macosx-10.15-x86_64-cpython-37/coverage/parser.py -> build/bdist.macosx-10.15-x86_64/wheel/coverage creating build/bdist.macosx-10.15-x86_64/wheel/coverage/fullcoverage copying build/lib.macosx-10.15-x86_64-cpython-37/coverage/fullcoverage/encodings.py -> build/bdist.macosx-10.15-x86_64/wheel/coverage/fullcoverage copying build/lib.macosx-10.15-x86_64-cpython-37/coverage/summary.py -> build/bdist.macosx-10.15-x86_64/wheel/coverage copying build/lib.macosx-10.15-x86_64-cpython-37/coverage/context.py -> build/bdist.macosx-10.15-x86_64/wheel/coverage copying build/lib.macosx-10.15-x86_64-cpython-37/coverage/xmlreport.py -> build/bdist.macosx-10.15-x86_64/wheel/coverage copying build/lib.macosx-10.15-x86_64-cpython-37/coverage/debug.py -> build/bdist.macosx-10.15-x86_64/wheel/coverage copying build/lib.macosx-10.15-x86_64-cpython-37/coverage/python.py -> build/bdist.macosx-10.15-x86_64/wheel/coverage copying build/lib.macosx-10.15-x86_64-cpython-37/coverage/plugin.py -> build/bdist.macosx-10.15-x86_64/wheel/coverage copying build/lib.macosx-10.15-x86_64-cpython-37/coverage/py.typed -> build/bdist.macosx-10.15-x86_64/wheel/coverage copying build/lib.macosx-10.15-x86_64-cpython-37/coverage/exceptions.py -> build/bdist.macosx-10.15-x86_64/wheel/coverage copying build/lib.macosx-10.15-x86_64-cpython-37/coverage/inorout.py -> build/bdist.macosx-10.15-x86_64/wheel/coverage copying build/lib.macosx-10.15-x86_64-cpython-37/coverage/jsonreport.py -> build/bdist.macosx-10.15-x86_64/wheel/coverage copying build/lib.macosx-10.15-x86_64-cpython-37/coverage/bytecode.py -> build/bdist.macosx-10.15-x86_64/wheel/coverage copying build/lib.macosx-10.15-x86_64-cpython-37/coverage/tomlconfig.py -> build/bdist.macosx-10.15-x86_64/wheel/coverage copying build/lib.macosx-10.15-x86_64-cpython-37/coverage/execfile.py -> build/bdist.macosx-10.15-x86_64/wheel/coverage copying build/lib.macosx-10.15-x86_64-cpython-37/coverage/multiproc.py -> build/bdist.macosx-10.15-x86_64/wheel/coverage copying build/lib.macosx-10.15-x86_64-cpython-37/coverage/__main__.py -> build/bdist.macosx-10.15-x86_64/wheel/coverage copying build/lib.macosx-10.15-x86_64-cpython-37/coverage/report.py -> build/bdist.macosx-10.15-x86_64/wheel/coverage copying build/lib.macosx-10.15-x86_64-cpython-37/coverage/data.py -> build/bdist.macosx-10.15-x86_64/wheel/coverage running install_egg_info running egg_info writing coverage.egg-info/PKG-INFO writing dependency_links to coverage.egg-info/dependency_links.txt writing entry points to coverage.egg-info/entry_points.txt writing requirements to coverage.egg-info/requires.txt writing top-level names to coverage.egg-info/top_level.txt reading manifest file 'coverage.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' no previously-included directories found matching 'doc/_build' no previously-included directories found matching 'doc/_spell' no previously-included directories found matching 'tests/eggsrc/build' adding license file 'LICENSE.txt' writing manifest file 'coverage.egg-info/SOURCES.txt' Copying coverage.egg-info to build/bdist.macosx-10.15-x86_64/wheel/coverage-7.2.6a0.dev1-py3.7.egg-info running install_scripts creating build/bdist.macosx-10.15-x86_64/wheel/coverage-7.2.6a0.dev1.dist-info/WHEEL creating '/private/tmp/bug1373/coveragepy/dist/.tmp-4chay8_r/coverage-7.2.6a0.dev1-cp37-cp37m-macosx_10_15_x86_64.whl' and adding 'build/bdist.macosx-10.15-x86_64/wheel' to it adding 'coverage/__init__.py' adding 'coverage/__main__.py' adding 'coverage/annotate.py' adding 'coverage/bytecode.py' adding 'coverage/cmdline.py' adding 'coverage/collector.py' adding 'coverage/config.py' adding 'coverage/context.py' adding 'coverage/control.py' adding 'coverage/data.py' adding 'coverage/debug.py' adding 'coverage/disposition.py' adding 'coverage/env.py' adding 'coverage/exceptions.py' adding 'coverage/execfile.py' adding 'coverage/files.py' adding 'coverage/html.py' adding 'coverage/inorout.py' adding 'coverage/jsonreport.py' adding 'coverage/lcovreport.py' adding 'coverage/misc.py' adding 'coverage/multiproc.py' adding 'coverage/numbits.py' adding 'coverage/parser.py' adding 'coverage/phystokens.py' adding 'coverage/plugin.py' adding 'coverage/plugin_support.py' adding 'coverage/py.typed' adding 'coverage/python.py' adding 'coverage/pytracer.py' adding 'coverage/report.py' adding 'coverage/results.py' adding 'coverage/sqldata.py' adding 'coverage/summary.py' adding 'coverage/templite.py' adding 'coverage/tomlconfig.py' adding 'coverage/tracer.cpython-37m-darwin.so' adding 'coverage/types.py' adding 'coverage/version.py' adding 'coverage/xmlreport.py' adding 'coverage/fullcoverage/encodings.py' adding 'coverage/htmlfiles/coverage_html.js' adding 'coverage/htmlfiles/favicon_32.png' adding 'coverage/htmlfiles/index.html' adding 'coverage/htmlfiles/keybd_closed.png' adding 'coverage/htmlfiles/keybd_open.png' adding 'coverage/htmlfiles/pyfile.html' adding 'coverage/htmlfiles/style.css' adding 'coverage/htmlfiles/style.scss' adding 'coverage-7.2.6a0.dev1.dist-info/LICENSE.txt' adding 'coverage-7.2.6a0.dev1.dist-info/METADATA' adding 'coverage-7.2.6a0.dev1.dist-info/WHEEL' adding 'coverage-7.2.6a0.dev1.dist-info/entry_points.txt' adding 'coverage-7.2.6a0.dev1.dist-info/top_level.txt' adding 'coverage-7.2.6a0.dev1.dist-info/RECORD' removing build/bdist.macosx-10.15-x86_64/wheel ```
python3 -sBm installer dist/*.whl --destdir /tmp/coveragepy ``` ```
PYTHONPATH=/tmp/coveragepy/$(python3 -Ic "import sysconfig; print(sysconfig.get_path('purelib'))") tox -r -e py37 ``` ROOT: tox-gh won't override envlist because tox is not running in GitHub Actions py37: remove tox env folder .tox/py37 .pkg: remove tox env folder .tox/.pkg py37: install_deps> python -m pip install -U -r requirements/pip.pip -r requirements/pytest.pip -r requirements/light-threads.pip .pkg: install_requires> python -I -m pip install setuptools .pkg: _optional_hooks> python /private/tmp/bug1373/venv/lib/python3.7/site-packages/pyproject_api/_backend.py True setuptools.build_meta .pkg: get_requires_for_build_editable> python /private/tmp/bug1373/venv/lib/python3.7/site-packages/pyproject_api/_backend.py True setuptools.build_meta .pkg: install_requires_for_build_editable> python -I -m pip install wheel .pkg: build_editable> python /private/tmp/bug1373/venv/lib/python3.7/site-packages/pyproject_api/_backend.py True setuptools.build_meta py37: install_package_deps> python -m pip install -U 'tomli; python_full_version <= "3.11.0a6"' py37: install_package> python -m pip install -U --force-reinstall --no-deps .tox/.tmp/package/2/coverage-7.2.6a0.dev1-0.editable-cp37-cp37m-macosx_10_15_x86_64.whl py37: commands[0]> python igor.py zip_mods py37: commands[1]> python igor.py test_with_tracer c === CPython 3.7.15 with C tracer (.tox/py37/bin/python) === bringing up nodes... .....................................................................................................................s..........x.............ss.s........ [ 11%] ..........................................x............................................................................................................... [ 22%] ................................................................................................s.........................s............s.s................ [ 34%] .......................................................................................................................................................... [ 45%] .....................................................................................................s.................................................... [ 57%] .......................................................................................................................................................... [ 68%] ..........................................................................s............................................................................... [ 80%] .........................................s.......s...............F......................................................................................... [ 91%] ......................................................................................s.FFFF................ [100%] ============================================================================ FAILURES ============================================================================ _____________________________________________________________ test_xdist_sys_path_nuttiness_is_fixed _____________________________________________________________ [gw1] darwin -- Python 3.7.15 /private/tmp/bug1373/coveragepy/.tox/py37/bin/python 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 '/tmp/coveragepy//private/tmp/bug1373/venv/lib/python3.7/site-packages' is None E + where '/tmp/coveragepy//private/tmp/bug1373/venv/lib/python3.7/site-packages' = ('PYTHONPATH') E + where = environ({'TERM_SESSION_ID': 'w0t4p0:1A8194A4-F8F4-4C2D-8655-2443B6267C44', 'SSH_AUTH_SOCK': '/private/tmp/com.apple.la...ST_WORKER_COUNT': '12', 'PYTEST_CURRENT_TEST': 'tests/test_testing.py::test_xdist_sys_path_nuttiness_is_fixed (call)'}).get E + where environ({'TERM_SESSION_ID': 'w0t4p0:1A8194A4-F8F4-4C2D-8655-2443B6267C44', 'SSH_AUTH_SOCK': '/private/tmp/com.apple.la...ST_WORKER_COUNT': '12', 'PYTEST_CURRENT_TEST': 'tests/test_testing.py::test_xdist_sys_path_nuttiness_is_fixed (call)'}) = os.environ tests/test_testing.py:33: AssertionError _______________________________________________ VirtualenvTest.test_third_party_venv_isnt_measured[coverage-True] ________________________________________________ [gw2] darwin -- Python 3.7.15 /private/tmp/bug1373/coveragepy/.tox/py37/bin/python self = , coverage_command = 'coverage', install_source_in_venv = True @pytest.mark.parametrize('install_source_in_venv', [True, False]) def test_third_party_venv_isnt_measured( self, coverage_command: str, install_source_in_venv: bool ) -> None: if install_source_in_venv: make_file("setup.py", """\ import setuptools setuptools.setup( name="myproduct", py_modules = ["myproduct"], ) """) try: run_in_venv("python -m pip install .") finally: shutil.rmtree("build", ignore_errors=True) shutil.rmtree("myproduct.egg-info", ignore_errors=True) # Ensure that coverage doesn't run the non-installed module. os.remove('myproduct.py') out = run_in_venv(coverage_command + " run --source=.,myproduct -m myproduct") else: out = run_in_venv(coverage_command + " run --source=. myproduct.py") # In particular, this warning doesn't appear: # Already imported a file that will be measured: .../coverage/__main__.py assert out == self.expected_stdout # Check that our tracing was accurate. Files are mentioned because # --source refers to a file. debug_out = self.get_trace_output() > assert re_lines( r"^Not tracing .*\bexecfile.py': inside --source, but is third-party", debug_out, ) E assert [] E + where [] = re_lines("^Not tracing .*\\bexecfile.py': inside --source, but is third-party", "sys.path:\n /private/var/folders/10/4sn2sk3j2mg5m116f08_367m0000gq/T/pytest-of-nedbatchelder/pytest-2088/popen-gw2...venv/lib/python3.7/site-packages/coverage/collector.py': module 'coverage.collector' falls outside the --source spec\n") /private/tmp/bug1373/coveragepy/tests/test_venv.py:234: AssertionError --------------------------------------------------------------------- Captured stdout setup ---------------------------------------------------------------------- Processing ./third_pkg Preparing metadata (setup.py): started Preparing metadata (setup.py): finished with status 'done' Processing /private/tmp/bug1373/coveragepy Installing build dependencies: started Installing build dependencies: finished with status 'done' Getting requirements to build wheel: started Getting requirements to build wheel: finished with status 'done' Installing backend dependencies: started Installing backend dependencies: finished with status 'done' Preparing metadata (pyproject.toml): started Preparing metadata (pyproject.toml): finished with status 'done' Obtaining file:///private/var/folders/10/4sn2sk3j2mg5m116f08_367m0000gq/T/pytest-of-nedbatchelder/pytest-2088/popen-gw2/venv_world0/another_pkg Preparing metadata (setup.py): started Preparing metadata (setup.py): finished with status 'done' Obtaining file:///private/var/folders/10/4sn2sk3j2mg5m116f08_367m0000gq/T/pytest-of-nedbatchelder/pytest-2088/popen-gw2/venv_world0/bug888/app Preparing metadata (setup.py): started Preparing metadata (setup.py): finished with status 'done' Obtaining file:///private/var/folders/10/4sn2sk3j2mg5m116f08_367m0000gq/T/pytest-of-nedbatchelder/pytest-2088/popen-gw2/venv_world0/bug888/plugin Preparing metadata (setup.py): started Preparing metadata (setup.py): finished with status 'done' Using legacy 'setup.py install' for third, since package 'wheel' is not installed. Building wheels for collected packages: coverage Building wheel for coverage (pyproject.toml): started Building wheel for coverage (pyproject.toml): finished with status 'done' Created wheel for coverage: filename=coverage-7.2.6a0.dev1-cp37-cp37m-macosx_10_15_x86_64.whl size=200267 sha256=e1083c66a3d3d33269a8fe8cf89cef1c104fc79cd9526eeda78665acaa75a30f Stored in directory: /private/var/folders/10/4sn2sk3j2mg5m116f08_367m0000gq/T/pip-ephem-wheel-cache-pyhsudy7/wheels/78/71/2d/e990c837a4c47b425b02d77489ebaf64a220bb2db6cce23075 Successfully built coverage Installing collected packages: third, testcov-plugin, testcov, another, coverage Running setup.py install for third: started Running setup.py install for third: finished with status 'done' Running setup.py develop for testcov-plugin Running setup.py develop for testcov Running setup.py develop for another Attempting uninstall: coverage Found existing installation: coverage 7.2.6a0.dev1 Not uninstalling coverage at /private/tmp/coveragepy/private/tmp/bug1373/venv/lib/python3.7/site-packages, outside environment /private/var/folders/10/4sn2sk3j2mg5m116f08_367m0000gq/T/pytest-of-nedbatchelder/pytest-2088/popen-gw2/venv_world0/venv Can't uninstall 'coverage'. No files were found to uninstall. Successfully installed another-0.0.0 coverage-7.2.6a0.dev1 testcov-0.0.0 testcov-plugin-0.0.0 third-0.0.0 ---------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------- Processing /private/var/folders/10/4sn2sk3j2mg5m116f08_367m0000gq/T/pytest-of-nedbatchelder/pytest-2088/popen-gw2/venv_world0 Preparing metadata (setup.py): started Preparing metadata (setup.py): finished with status 'done' Using legacy 'setup.py install' for myproduct, since package 'wheel' is not installed. Installing collected packages: myproduct Running setup.py install for myproduct: started Running setup.py install for myproduct: finished with status 'done' Successfully installed myproduct-0.0.0 33 110 198 1.5 _______________________________________________ VirtualenvTest.test_third_party_venv_isnt_measured[coverage-False] _______________________________________________ [gw2] darwin -- Python 3.7.15 /private/tmp/bug1373/coveragepy/.tox/py37/bin/python self = , coverage_command = 'coverage', install_source_in_venv = False @pytest.mark.parametrize('install_source_in_venv', [True, False]) def test_third_party_venv_isnt_measured( self, coverage_command: str, install_source_in_venv: bool ) -> None: if install_source_in_venv: make_file("setup.py", """\ import setuptools setuptools.setup( name="myproduct", py_modules = ["myproduct"], ) """) try: run_in_venv("python -m pip install .") finally: shutil.rmtree("build", ignore_errors=True) shutil.rmtree("myproduct.egg-info", ignore_errors=True) # Ensure that coverage doesn't run the non-installed module. os.remove('myproduct.py') out = run_in_venv(coverage_command + " run --source=.,myproduct -m myproduct") else: out = run_in_venv(coverage_command + " run --source=. myproduct.py") # In particular, this warning doesn't appear: # Already imported a file that will be measured: .../coverage/__main__.py assert out == self.expected_stdout # Check that our tracing was accurate. Files are mentioned because # --source refers to a file. debug_out = self.get_trace_output() > assert re_lines( r"^Not tracing .*\bexecfile.py': inside --source, but is third-party", debug_out, ) E assert [] E + where [] = re_lines("^Not tracing .*\\bexecfile.py': inside --source, but is third-party", "sys.path:\n /private/var/folders/10/4sn2sk3j2mg5m116f08_367m0000gq/T/pytest-of-nedbatchelder/pytest-2088/popen-gw2...eragepy/private/tmp/bug1373/venv/lib/python3.7/site-packages/coverage/collector.py': falls outside the --source spec\n") /private/tmp/bug1373/coveragepy/tests/test_venv.py:234: AssertionError ---------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------- 33 110 198 1.5 __________________________________________ VirtualenvTest.test_third_party_venv_isnt_measured[python -m coverage-True] ___________________________________________ [gw2] darwin -- Python 3.7.15 /private/tmp/bug1373/coveragepy/.tox/py37/bin/python self = , coverage_command = 'python -m coverage', install_source_in_venv = True @pytest.mark.parametrize('install_source_in_venv', [True, False]) def test_third_party_venv_isnt_measured( self, coverage_command: str, install_source_in_venv: bool ) -> None: if install_source_in_venv: make_file("setup.py", """\ import setuptools setuptools.setup( name="myproduct", py_modules = ["myproduct"], ) """) try: run_in_venv("python -m pip install .") finally: shutil.rmtree("build", ignore_errors=True) shutil.rmtree("myproduct.egg-info", ignore_errors=True) # Ensure that coverage doesn't run the non-installed module. os.remove('myproduct.py') out = run_in_venv(coverage_command + " run --source=.,myproduct -m myproduct") else: out = run_in_venv(coverage_command + " run --source=. myproduct.py") # In particular, this warning doesn't appear: # Already imported a file that will be measured: .../coverage/__main__.py assert out == self.expected_stdout # Check that our tracing was accurate. Files are mentioned because # --source refers to a file. debug_out = self.get_trace_output() > assert re_lines( r"^Not tracing .*\bexecfile.py': inside --source, but is third-party", debug_out, ) E assert [] E + where [] = re_lines("^Not tracing .*\\bexecfile.py': inside --source, but is third-party", "sys.path:\n /private/var/folders/10/4sn2sk3j2mg5m116f08_367m0000gq/T/pytest-of-nedbatchelder/pytest-2088/popen-gw2...venv/lib/python3.7/site-packages/coverage/collector.py': module 'coverage.collector' falls outside the --source spec\n") /private/tmp/bug1373/coveragepy/tests/test_venv.py:234: AssertionError ---------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------- Processing /private/var/folders/10/4sn2sk3j2mg5m116f08_367m0000gq/T/pytest-of-nedbatchelder/pytest-2088/popen-gw2/venv_world0 Preparing metadata (setup.py): started Preparing metadata (setup.py): finished with status 'done' Using legacy 'setup.py install' for myproduct, since package 'wheel' is not installed. Installing collected packages: myproduct Attempting uninstall: myproduct Found existing installation: myproduct 0.0.0 Uninstalling myproduct-0.0.0: Successfully uninstalled myproduct-0.0.0 Running setup.py install for myproduct: started Running setup.py install for myproduct: finished with status 'done' Successfully installed myproduct-0.0.0 33 110 198 1.5 __________________________________________ VirtualenvTest.test_third_party_venv_isnt_measured[python -m coverage-False] __________________________________________ [gw2] darwin -- Python 3.7.15 /private/tmp/bug1373/coveragepy/.tox/py37/bin/python self = , coverage_command = 'python -m coverage', install_source_in_venv = False @pytest.mark.parametrize('install_source_in_venv', [True, False]) def test_third_party_venv_isnt_measured( self, coverage_command: str, install_source_in_venv: bool ) -> None: if install_source_in_venv: make_file("setup.py", """\ import setuptools setuptools.setup( name="myproduct", py_modules = ["myproduct"], ) """) try: run_in_venv("python -m pip install .") finally: shutil.rmtree("build", ignore_errors=True) shutil.rmtree("myproduct.egg-info", ignore_errors=True) # Ensure that coverage doesn't run the non-installed module. os.remove('myproduct.py') out = run_in_venv(coverage_command + " run --source=.,myproduct -m myproduct") else: out = run_in_venv(coverage_command + " run --source=. myproduct.py") # In particular, this warning doesn't appear: # Already imported a file that will be measured: .../coverage/__main__.py assert out == self.expected_stdout # Check that our tracing was accurate. Files are mentioned because # --source refers to a file. debug_out = self.get_trace_output() > assert re_lines( r"^Not tracing .*\bexecfile.py': inside --source, but is third-party", debug_out, ) E assert [] E + where [] = re_lines("^Not tracing .*\\bexecfile.py': inside --source, but is third-party", "sys.path:\n /private/var/folders/10/4sn2sk3j2mg5m116f08_367m0000gq/T/pytest-of-nedbatchelder/pytest-2088/popen-gw2...eragepy/private/tmp/bug1373/venv/lib/python3.7/site-packages/coverage/collector.py': falls outside the --source spec\n") /private/tmp/bug1373/coveragepy/tests/test_venv.py:234: AssertionError ---------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------- 33 110 198 1.5 ==================================================================== short test summary info ===================================================================== FAILED tests/test_testing.py::test_xdist_sys_path_nuttiness_is_fixed - AssertionError: assert '/tmp/coveragepy//private/tmp/bug1373/venv/lib/python3.7/site-packages' is None FAILED tests/test_venv.py::VirtualenvTest::test_third_party_venv_isnt_measured[coverage-True] - assert [] FAILED tests/test_venv.py::VirtualenvTest::test_third_party_venv_isnt_measured[coverage-False] - assert [] FAILED tests/test_venv.py::VirtualenvTest::test_third_party_venv_isnt_measured[python -m coverage-True] - assert [] FAILED tests/test_venv.py::VirtualenvTest::test_third_party_venv_isnt_measured[python -m coverage-False] - assert [] 5 failed, 1321 passed, 13 skipped, 2 xfailed in 40.79s py37: exit 1 (41.84 seconds) /private/tmp/bug1373/coveragepy> python igor.py test_with_tracer c pid=65741 .pkg: _exit> python /private/tmp/bug1373/venv/lib/python3.7/site-packages/pyproject_api/_backend.py True setuptools.build_meta py37: FAIL code 1 (60.13=setup[18.08]+cmd[0.20,41.84] seconds) ```
kloczek commented 1 year ago

As I wrote I'm building rpm package with your module. In such case because such build is done from non-root account it is no possible to install module in python system sitearch and sitelib trees. Only way to test package is to use build root tree where are installed all files which will be used to finally assemble rpm package and run pytest with $PYTHONPATH env variable with added necessary paths. Using venvs in such cases does not make eny sense because build is done in system image in which are installed only resources listed in build requirements. In other woords what in ststem image it will be in ixacrly the same versionslike in potentially created venv.

Above methodology is widely used on building not only rpm but Debian deb packages as well. Opening ticket I've dropped exact list of modules installed in build env it that set is result of installing only what is listed in rpm spec file BuildRequires. In case of your coverage module such list looks like below:

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. To assembly python env is not used pypi repoo. Are used only packages already build and provided as repository. On instilling for example python3dist(build) (which is in python-build rpm package) are installed all other packages which are listed in install dependencies (rpm Requires).

If you need more details about context feel free to ask .. I'll try to explain everything as good as I only cane 😋

nedbat commented 1 year ago

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.

supakeen commented 1 year ago

@kloczek For which distribution are you building this RPM?

nedbat commented 1 year ago

@kloczek Fedora is building rpm's, maybe you can see how they are doing it: https://src.fedoraproject.org/rpms/python-coverage

kloczek commented 1 year ago

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. Only this and nothing more 😋 What is relevant here is build (use pep517 based build) install (unpack generated .whl in </install/prefix> and testing methdology (use pytest with set $PYTHONPATH).

@kloczek For which distribution are you building this RPM?

My own. That distribution however shares almost 100% methodologies used in Fedora. On Python packaging are it shares 100% of those methodologies. In other words if you want to test this issue you can grab fedora image ind play which procedure which I've described.

@kloczek Fedora is building rpm's, maybe you can see how they are doing it: https://src.fedoraproject.org/rpms/python-coverage

If you will look closer you woul find that Fedora spec file for coverage module filehttps://src.fedoraproject.org/rpms/python-coverage/blob/rawhide/f/python-coverage.spec:

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. In my case Ihave 100% python packjages with trst suite execution, 100% use pep517 and few more other thing which nine in Fedora are aware that it is possible to do like replace pip by installer to unpack .whl in </install/prefix> (pip has waay bigger install time depenmdencies than installer).

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

```spec # 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.

kloczek commented 1 year ago

Going back to the subject .. As you are able nowreporoduce some of those issues .. any conclutions? 😋