coveragepy icon indicating copy to clipboard operation
coveragepy copied to clipboard

Disagreement between log trace and XML coverage report

Open seanxiaoyan opened this issue 2 years ago • 0 comments

Describe the bug Disagreement between log trace and XML coverage report for the Salt project integration test run. Observing log trace generated through test run but the line of the corresponding logging statement is indicated as not covered

To Reproduce How can we reproduce the problem? Please be specific. Don't link to a failing CI job. Answer the questions below:

  1. What version of Python are you using? 3.9.0
  2. What version of coverage.py shows the problem? The output of coverage debug sys is helpful. 5.2
  3. What versions of what packages do you have installed? The output of pip freeze is helpful. requirements
  4. What code shows the problem? Give us a specific commit of a specific repo that we can check out. If you've already worked around the problem, please provide a commit before that fix.

commit bb610f761e107de111fa8b4c92c60c77ff7a920e

My fork on this revision https://github.com/seanxiaoyan/salt.git

  1. What commands did you run?

I followed their documentation to set up the test environment and ran the integration test

Install pyenv (linux):

git clone https://github.com/pyenv/pyenv.git ~/.pyenv
export PATH="$HOME/.pyenv/bin:$PATH"
git clone https://github.com/pyenv/pyenv-virtualenv.git $(pyenv root)/plugins/pyenv-virtualenv

Add pyenv to .bashrc:

echo 'export PATH="$HOME/.pyenv/bin:$PATH"' >> ~/.bashrc
pyenv init 2>> ~/.bashrc
pyenv virtualenv-init 2>> ~/.bashrc

Restart the shell. Install Python 3.9

pyenv install 3.9.0

Create a new virtual environment and activate it

pyenv virtualenv 3.9.0 salt
pyenv activate salt

Clone repo

git clone --depth=1 https://github.com/seanxiaoyan/salt.git
cd salt

NOX setup

python -m pip install nox

Run test

python -m nox -e "pytest-3.9(coverage=True)" -- tests/integration

Expected behavior The following log trace is contained in the resulting log file at salt\artifacts\logs\runtests-*.log

[salt.utils.schedule :92  ][DEBUG   ][Maintenance(21045)] [SaltMaster(id='master')] Initializing new Schedule

The line number 92 of file salt\salt\utils\schedule.py should be indicated as "hits=1" in the resulting XML coverage report at salt\artifacts\coverage\salt.xml

Additional context Add any other context about the problem here.

seanxiaoyan avatar Aug 30 '22 23:08 seanxiaoyan