We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Describe the bug In Python 3.8.2, coverage 6.5.0.
I am trying to measure the coverage of a test using subprocess.
If I start a subprocess in a different directory than the original directory, a data file will be generated in that directory.
Moving the data file to the original directory and combine&report will generate a report that does not reflect the execution of the sub-process.
To Reproduce
A simple example : ./main.py
import os import subprocess orig = os.getcwd() os.chdir("./d") subprocess.run( ["python", f"{orig}/sub.py"], env={ **os.environ, "COVERAGE_PROCESS_START": f"{orig}/pyproject.toml", "PYTHONPATH": f"{orig}", }, ) os.chdir(orig)
./sub.py
print("Hello,World!")
./pyproject.toml
[tool.coverage.run] branch = true source = ["."] parallel = true omit = ["sitecustomize.py"]
./sitecustomize.py
import coverage coverage.process_startup() print("Loaded!")
$ coverage run main.py Loaded! Hello,World! $ ls -a ./d . .. .coverage.nahco314-pc.16642.385055
Expected behavior I would like coverage results that include Python execution in sub-processes.
Additional context If only directory moves are pulled out and executed, coverage is generated successfully.
Output of coverage debug sys:
coverage debug sys
-- sys ------------------------------------------------------- coverage_version: 6.5.0 coverage_module: /home/nahco314/PycharmProjects/pythonProject6/venv/lib/python3.8/site-packages/coverage/__init__.py tracer: -none- CTracer: available plugins.file_tracers: -none- plugins.configurers: -none- plugins.context_switchers: -none- configs_attempted: .coveragerc setup.cfg tox.ini pyproject.toml configs_read: /home/nahco314/PycharmProjects/pythonProject6/pyproject.toml config_file: /home/nahco314/PycharmProjects/pythonProject6/pyproject.toml config_contents: b'[tool.coverage.run]\nbranch = true\nsource = ["."]\nparallel = true\nomit = ["sitecustomize.py"]\n' data_file: -none- python: 3.8.2 (default, Sep 22 2022, 00:18:42) [GCC 11.2.0] platform: Linux-5.15.0-53-generic-x86_64-with-glibc2.35 implementation: CPython executable: /home/nahco314/PycharmProjects/pythonProject6/venv/bin/python def_encoding: utf-8 fs_encoding: utf-8 pid: 27900 cwd: /home/nahco314/PycharmProjects/pythonProject6 path: /home/nahco314/PycharmProjects/pythonProject6/venv/bin /home/nahco314/.pyenv/versions/3.8.2/lib/python38.zip /home/nahco314/.pyenv/versions/3.8.2/lib/python3.8 /home/nahco314/.pyenv/versions/3.8.2/lib/python3.8/lib-dynload /home/nahco314/PycharmProjects/pythonProject6/venv/lib/python3.8/site-packages environment: HOME = /home/nahco314 PYENV_DIR = /home/nahco314/.local/share/JetBrains/Toolbox/apps/PyCharm-P/ch-0/223.7571.203/bin PYENV_HOOK_PATH = /home/nahco314/.pyenv/pyenv.d:/usr/local/etc/pyenv.d:/etc/pyenv.d:/usr/lib/pyenv/hooks PYENV_ROOT = /home/nahco314/.pyenv PYENV_SHELL = bash PYENV_VERSION = 3.11.0 command_line: /home/nahco314/PycharmProjects/pythonProject6/venv/bin/coverage debug sys sqlite3_version: 2.6.0 sqlite3_sqlite_version: 3.37.2 sqlite3_temp_store: 0 sqlite3_compile_options: ATOMIC_INTRINSICS=1, COMPILER=gcc-11.3.0, DEFAULT_AUTOVACUUM, DEFAULT_CACHE_SIZE=-2000, DEFAULT_FILE_FORMAT=4, DEFAULT_JOURNAL_SIZE_LIMIT=-1, DEFAULT_MMAP_SIZE=0, DEFAULT_PAGE_SIZE=4096, DEFAULT_PCACHE_INITSZ=20, DEFAULT_RECURSIVE_TRIGGERS, DEFAULT_SECTOR_SIZE=4096, DEFAULT_SYNCHRONOUS=2, DEFAULT_WAL_AUTOCHECKPOINT=1000, DEFAULT_WAL_SYNCHRONOUS=2, DEFAULT_WORKER_THREADS=0, ENABLE_COLUMN_METADATA, ENABLE_DBSTAT_VTAB, ENABLE_FTS3, ENABLE_FTS3_PARENTHESIS, ENABLE_FTS3_TOKENIZER, ENABLE_FTS4, ENABLE_FTS5, ENABLE_JSON1, ENABLE_LOAD_EXTENSION, ENABLE_MATH_FUNCTIONS, ENABLE_PREUPDATE_HOOK, ENABLE_RTREE, ENABLE_SESSION, ENABLE_STMTVTAB, ENABLE_UNLOCK_NOTIFY, ENABLE_UPDATE_DELETE_LIMIT, HAVE_ISNAN, LIKE_DOESNT_MATCH_BLOBS, MALLOC_SOFT_LIMIT=1024, MAX_ATTACHED=10, MAX_COLUMN=2000, MAX_COMPOUND_SELECT=500, MAX_DEFAULT_PAGE_SIZE=32768, MAX_EXPR_DEPTH=1000, MAX_FUNCTION_ARG=127, MAX_LENGTH=1000000000, MAX_LIKE_PATTERN_LENGTH=50000, MAX_MMAP_SIZE=0x7fff0000, MAX_PAGE_COUNT=1073741823, MAX_PAGE_SIZE=65536, MAX_SCHEMA_RETRY=25, MAX_SQL_LENGTH=1000000000, MAX_TRIGGER_DEPTH=1000, MAX_VARIABLE_NUMBER=250000, MAX_VDBE_OP=250000000, MAX_WORKER_THREADS=8, MUTEX_PTHREADS, OMIT_LOOKASIDE, SECURE_DELETE, SOUNDEX, SYSTEM_MALLOC, TEMP_STORE=1, THREADSAFE=1, USE_URI
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Describe the bug
In Python 3.8.2, coverage 6.5.0.
I am trying to measure the coverage of a test using subprocess.
If I start a subprocess in a different directory than the original directory, a data file will be generated in that directory.
Moving the data file to the original directory and combine&report will generate a report that does not reflect the execution of the sub-process.
To Reproduce
A simple example :
./main.py
./sub.py
./pyproject.toml
./sitecustomize.py
Expected behavior
I would like coverage results that include Python execution in sub-processes.
Additional context
If only directory moves are pulled out and executed, coverage is generated successfully.
Output of
coverage debug sys
:The text was updated successfully, but these errors were encountered: