Comments (9)
From your gist:
2023-05-24T00:18:02.9747182Z drwxr-xr-x 2 runner docker 4096 May 24 00:18 .coverage.accounts
2023-05-24T00:18:02.9748208Z drwxr-xr-x 2 runner docker 4096 May 24 00:18 .coverage.cash_app
2023-05-24T00:18:02.9749240Z drwxr-xr-x 2 runner docker 4096 May 24 00:18 .coverage.forecast
2023-05-24T00:18:02.9750276Z drwxr-xr-x 2 runner docker 4096 May 24 00:18 .coverage.registration
Each of these files is only 4096 bytes. They are not complete database files.
From your ci.yml file:
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: .coverage.${{ matrix.test_path }}
path: .coverage
I think you want path
to be .coverage.${{ matrix.test_path }}
, since that is the name of the file, and name
should be the name of the artifact to upload to. You might want to use path: .coverage.*
to make it less tightly coupled with the rest of the CI.
from coveragepy.
This issue is closed but I wasn't able to understand how to solve this
from coveragepy.
I also have write access to /tmp/ folder:
touch /tmp/foobar
sudo ls -la /tmp/
total 76
drwxrwxrwt 15 root root 20480 May 24 15:32 .
drwxr-xr-x 21 root root 4096 May 24 15:27 ..
drwxrwxrwt 2 root root 4096 May 24 15:26 .ICE-unix
drwxrwxrwt 2 root root 4096 May 24 15:26 .Test-unix
drwxrwxrwt 2 root root 4096 May 24 15:26 .X11-unix
drwxrwxrwt 2 root root 4096 May 24 15:26 .XIM-unix
drwxrwxrwt 2 root root 4096 May 24 15:26 .font-unix
prwx------ 1 runner docker 0 May 24 15:29 clr-debug-pipe-1554-17643-in
prwx------ 1 runner docker 0 May 24 15:29 clr-debug-pipe-1554-17643-out
prwx------ 1 runner docker 0 May 24 15:29 clr-debug-pipe-1568-17921-in
prwx------ 1 runner docker 0 May 24 15:29 clr-debug-pipe-1568-17921-out
prwx------ 1 root root 0 May 24 15:27 clr-debug-pipe-667-1375-in
prwx------ 1 root root 0 May 24 15:27 clr-debug-pipe-667-1375-out
srw------- 1 runner docker 0 May 24 15:29 dotnet-diagnostic-1554-17643-socket
srw------- 1 runner docker 0 May 24 15:29 dotnet-diagnostic-1568-17921-socket
srw------- 1 root root 0 May 24 15:27 dotnet-diagnostic-667-1375-socket
-rw-r--r-- 1 runner docker 0 May 24 15:32 foobar
drwx------ 3 root root 4096 May 24 15:27 snap-private-tmp
drwx------ 2 runner docker 4096 May 24 15:30 ssh-XXXXXXCXpIPI
drwx------ 3 root root 4096 May 24 15:27 systemd-private-ebc823ad41f54a7b94212a2898b5abbc-chrony.service-H1B0EJ
drwx------ 3 root root 4096 May 24 15:26 systemd-private-ebc823ad41f54a7b94212a2898b5abbc-haveged.service-Pfannn
drwx------ 3 root root 4096 May 24 15:27 systemd-private-ebc823ad41f54a7b94212a2898b5abbc-systemd-logind.service-7Mz83F
drwx------ 3 root root 4096 May 24 15:27 systemd-private-ebc823ad41f54a7b94212a2898b5abbc-systemd-resolved.service-rZVyYH
drwx------ 3 root root 4096 May 24 15:32 systemd-private-ebc823ad41f54a7b94212a2898b5abbc-systemd-timedated.service-GpPcwE
drwxr-xr-x 3 www-data www-data 4096 May 24 15:27 www-data-temp-aspnet-0
from coveragepy.
- Is there a reason you are still using version 5.5? There have been two years of fixes since then.
- If this is reproducible, can you run with
--debug=dataio
to get more information about the file operations?
from coveragepy.
@nedbat tks for the quick response!
- No specific reason. The project has a huge dependency list, things sometimes stay in an old version for a while. I mean, I could upgrade the lib if it would fix this.
- It is reproducible. Here is the output with
--debug=dataio
coverage combine --debug=dataio
shell: /usr/bin/bash -e {0}
env:
SSH_AUTH_SOCK: /tmp/ssh-XXXXXXvngGSM/agent.1768
SSH_AGENT_PID: 1769
pythonLocation: /opt/hostedtoolcache/Python/[3](https://github.com/Tesorio/Dashboard/actions/runs/5070250976/jobs/9105330173?pr=20940#step:7:3).9.16/x6[4](https://github.com/Tesorio/Dashboard/actions/runs/5070250976/jobs/9105330173?pr=20940#step:7:4)
PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.9.16/x64/lib/pkgconfig
Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.16/x64
Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.16/x64
Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.16/x64
LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.9.16/x64/lib
CACHE_KEY: [5](https://github.com/Tesorio/Dashboard/actions/runs/5070250976/jobs/9105330173?pr=20940#step:7:5)5c293d32544a[6](https://github.com/Tesorio/Dashboard/actions/runs/5070250976/jobs/9105330173?pr=20940#step:7:6)06a169ef282160c432
Combining data file '/home/runner/work/Dashboard/Dashboard/.coverage.cash_app'
Opening data file '/home/runner/work/Dashboard/Dashboard/.coverage.cash_app'
Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.9.16/x64/bin/coverage", line 8, in <module>
sys.exit(main())
File "/opt/hostedtoolcache/Python/3.9.16/x64/lib/python3.9/site-packages/coverage/cmdline.py", line 8[7](https://github.com/Tesorio/Dashboard/actions/runs/5070250976/jobs/9105330173?pr=20940#step:7:7)1, in main
status = CoverageScript().command_line(argv)
File "/opt/hostedtoolcache/Python/3.9.16/x64/lib/python3.9/site-packages/coverage/cmdline.py", line 594, in command_line
self.coverage.combine(data_dirs, strict=True, keep=bool(options.keep))
File "/opt/hostedtoolcache/Python/3.9.16/x64/lib/python3.9/site-packages/coverage/control.py", line 701, in combine
combine_parallel_data(
File "/opt/hostedtoolcache/Python/3.9.16/x64/lib/python3.9/site-packages/coverage/data.py", line 110, in combine_parallel_data
new_data.read()
File "/opt/hostedtoolcache/Python/3.9.16/x64/lib/python3.9/site-packages/coverage/sqldata.py", line 753, in read
with self._connect(): # TODO: doesn't look right
File "/opt/hostedtoolcache/Python/3.9.16/x64/lib/python3.9/site-packages/coverage/sqldata.py", line 29[8](https://github.com/Tesorio/Dashboard/actions/runs/5070250976/jobs/9105330173?pr=20940#step:7:8), in _connect
self._open_db()
File "/opt/hostedtoolcache/Python/3.[9](https://github.com/Tesorio/Dashboard/actions/runs/5070250976/jobs/9105330173?pr=20940#step:7:9).16/x64/lib/python3.9/site-packages/coverage/sqldata.py", line 266, in _open_db
self._read_db()
File "/opt/hostedtoolcache/Python/3.9.16/x64/lib/python3.9/site-packages/coverage/sqldata.py", line 270, in _read_db
with self._dbs[get_thread_id()] as db:
File "/opt/hostedtoolcache/Python/3.9.16/x64/lib/python3.9/site-packages/coverage/sqldata.py", line [10](https://github.com/Tesorio/Dashboard/actions/runs/5070250976/jobs/9105330173?pr=20940#step:7:10)37, in __enter__
self._connect()
File "/opt/hostedtoolcache/Python/3.9.[16](https://github.com/Tesorio/Dashboard/actions/runs/5070250976/jobs/9105330173?pr=20940#step:7:17)/x64/lib/python3.9/site-packages/coverage/sqldata.py", line 10[19](https://github.com/Tesorio/Dashboard/actions/runs/5070250976/jobs/9105330173?pr=20940#step:7:20), in _connect
self.con = sqlite3.connect(filename, check_same_thread=False)
sqlite3.OperationalError: unable to open database file
from coveragepy.
Thanks. The file name /home/runner/work/Dashboard/Dashboard/.coverage.cash_app
looks unusual. Is that something you authored? Coverage thinks it is a parallel-mode data file because it matches .coverage.*
.
from coveragepy.
Thanks. The file name
/home/runner/work/Dashboard/Dashboard/.coverage.cash_app
looks unusual. Is that something you authored? Coverage thinks it is a parallel-mode data file because it matches.coverage.*
.
Yes! The matrix is testing Django apps independently [1] and I want to combine it before writing the coverage comment in the PR.
Is the parallel mode a prerequisite for running the coverage combine
?
[1] https://gist.github.com/felipetio/25ff274f2692d3e721bd4cf85a47af94#file-ci-yml-L132-L133
from coveragepy.
@felipetio Does your thumb-up mean this issue can be closed?
from coveragepy.
I was able to solve the issue. @nedbat, thank you very much for the support!
I think you want path to be .coverage.${{ matrix.test_path }}, since that is the name of the file, and name should be the name of the artifact to upload to.
The path
is correct this is the file that exists in the directory (.coverage
in that case).
Each of these files is only 4096 bytes. They are not complete database files.
They are directories! I missed that! 😢
The solution was to create individual coverage for each Django app. Upload all to the same artifact directory and then combine the files in the final step. Everything works great and now we improved our coverage from 70% to 75%!
test:
name: Django Tests
runs-on: ubuntu-latest
steps:
...
- name: Run tests
run: |
COVERAGE_FILE=coverage_${{ matrix.test_path }} \
pytest ${{ matrix.test_path }} --nomigrations --cov --durations=20 --disable-pytest-warnings
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: coverage_data
path: coverage_${{ matrix.test_path }}
coverage:
name: Django Coverage Report
needs: test
if: ${{ always() }}
runs-on: ubuntu-latest
steps:
...
- name: Download artifacts
uses: actions/download-artifact@v2
- name: Combine coverage files
run: coverage combine coverage_data/*
- name: Create XML report
run: coverage xml
- name: Run coverage
uses: 5monkeys/cobertura-action@master
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
report_name: Here is the coverage report
minimum_coverage: 70
fail_below_threshold: true
- run: coverage report
from coveragepy.
Related Issues (20)
- Relative files where the files are relative to folder other than working directory
- `coverage run` breaks PYTHONSAFEPATH HOT 1
- Strange time increase running pytest, hypothesis through coverage leads to flaky errors HOT 1
- `branch=True` renders the last `case` statement as missing HOT 1
- Exclude code coverage based on operating system HOT 3
- Branches shown where there are none
- [FR] Loading/disabling plugins conditionally HOT 1
- is this option `COVERAGE_STORAGE=json` still available on latest version HOT 2
- Out-of-the-box behavior unexpected by new users / Modify FAQ/QuickStart/Doc HOT 6
- Question: Include all files in --source even unloaded HOT 6
- cannot create an xml report HOT 9
- Ignored warning induced bug
- coverage-7.3.3 broke pragma: no cover in match-case statement HOT 18
- Move from pylint to ruff? HOT 1
- Unable to collect code coverage when using `daphne` / `ChannelsLiveServerTestCase`
- no coverage file when run python file with supervisor
- 7.3.3 isn't "latest" on Read the Docs HOT 2
- Consider changing default value for precision from 0 to 2 HOT 3
- 7.3.4: pytest is failing im many units HOT 7
- Allow pyproject.toml to override a global coveragerc
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from coveragepy.