Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot create coverage file locally on Mac #38

Open
peterdesmet opened this issue Mar 29, 2023 · 6 comments
Open

Cannot create coverage file locally on Mac #38

peterdesmet opened this issue Mar 29, 2023 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@peterdesmet
Copy link
Member

  1. tox -e dev
  2. source venv/bin/activate
  3. tox

Tests works fine until 98% after which I get an error:

tests/test_vpts_csv.py::TestVptsCsvV1SupportFun::test_check_source_file PASSED                                                                                            [ 98%]
/Users/peter_desmet/Coding/Repositories/enram/vptstools/.tox/py39/lib/python3.9/site-packages/coverage/data.py:166: CoverageWarning: Couldn't use data file '/Users/peter_desmet/Coding/Repositories/enram/vptstools/.coverage.Peters-MacBook-Air.local.50554.789008-journal': file is not a database
  data._warn(str(exc))
tests/test_vpts_csv.py::TestVptsCsvV1SupportFun::test_check_source_file_wrong_file PASSED                                                                                 [100%]
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/Users/peter_desmet/Coding/Repositories/enram/vptstools/.tox/py39/lib/python3.9/site-packages/_pytest/main.py", line 270, in wrap_session
INTERNALERROR>     session.exitstatus = doit(config, session) or 0
INTERNALERROR>   File "/Users/peter_desmet/Coding/Repositories/enram/vptstools/.tox/py39/lib/python3.9/site-packages/_pytest/main.py", line 324, in _main
INTERNALERROR>     config.hook.pytest_runtestloop(session=session)
INTERNALERROR>   File "/Users/peter_desmet/Coding/Repositories/enram/vptstools/.tox/py39/lib/python3.9/site-packages/pluggy/_hooks.py", line 265, in __call__
INTERNALERROR>     return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
INTERNALERROR>   File "/Users/peter_desmet/Coding/Repositories/enram/vptstools/.tox/py39/lib/python3.9/site-packages/pluggy/_manager.py", line 80, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR>   File "/Users/peter_desmet/Coding/Repositories/enram/vptstools/.tox/py39/lib/python3.9/site-packages/pluggy/_callers.py", line 55, in _multicall
INTERNALERROR>     gen.send(outcome)
INTERNALERROR>   File "/Users/peter_desmet/Coding/Repositories/enram/vptstools/.tox/py39/lib/python3.9/site-packages/pytest_cov/plugin.py", line 297, in pytest_runtestloop
INTERNALERROR>     self.cov_controller.finish()
INTERNALERROR>   File "/Users/peter_desmet/Coding/Repositories/enram/vptstools/.tox/py39/lib/python3.9/site-packages/pytest_cov/engine.py", line 44, in ensure_topdir_wrapper
INTERNALERROR>     return meth(self, *args, **kwargs)
INTERNALERROR>   File "/Users/peter_desmet/Coding/Repositories/enram/vptstools/.tox/py39/lib/python3.9/site-packages/pytest_cov/engine.py", line 242, in finish
INTERNALERROR>     self.cov.stop()
INTERNALERROR>   File "/Users/peter_desmet/Coding/Repositories/enram/vptstools/.tox/py39/lib/python3.9/site-packages/coverage/control.py", line 807, in combine
INTERNALERROR>     combine_parallel_data(
INTERNALERROR>   File "/Users/peter_desmet/Coding/Repositories/enram/vptstools/.tox/py39/lib/python3.9/site-packages/coverage/data.py", line 148, in combine_parallel_data
INTERNALERROR>     with open(f, "rb") as fobj:
INTERNALERROR> FileNotFoundError: [Errno 2] No such file or directory: '/Users/peter_desmet/Coding/Repositories/enram/vptstools/.coverage.Peters-MacBook-Air.local.50618.245710-journal'
@stijnvanhoey
Copy link
Collaborator

stijnvanhoey commented Mar 29, 2023

@peterdesmet damn, It seems that it does not relate to the unit tests as I see in your output:

...
tests/test_vpts_csv.py::TestVptsCsvV1SupportFun::test_check_source_file_wrong_file PASSED                                                                                 [100%]

and it also works in the Mac github action.

but rather with creating the coverage results. Can you retry with the .coverage.Peters-MacBook-Air.local.50618.245710-journal or other .coverage files/folders removed inside your repo folder?

@peterdesmet peterdesmet changed the title Tox tests fail locally on Mac Cannot create coverage file locally on Mac Mar 30, 2023
@peterdesmet
Copy link
Member Author

Running tox from the repository root creates 66 coverage files. One named .coverage and 65 named .coverage.Peters-MacBook-Air.local.<integer>.<integer>

  • Removing those files and running tox again results in the same error.
  • Removing those files and the committed (!) .coveragerc results in:
/Users/peter_desmet/Coding/Repositories/enram/vptstools/.tox/py39/lib/python3.9/site-packages/coverage/data.py:166: CoverageWarning: Data file '/Users/peter_desmet/Coding/Repositories/enram/vptstools/.coverage.Peters-MacBook-Air.local.57123.052681' doesn't seem to be a coverage data file: 
  data._warn(str(exc))
/Users/peter_desmet/Coding/Repositories/enram/vptstools/.tox/py39/lib/python3.9/site-packages/coverage/data.py:166: CoverageWarning: Couldn't use data file '/Users/peter_desmet/Coding/Repositories/enram/vptstools/.coverage.Peters-MacBook-Air.local.57176.003491-journal': file is not a database
  data._warn(str(exc))
/Users/peter_desmet/Coding/Repositories/enram/vptstools/.tox/py39/lib/python3.9/site-packages/coverage/data.py:166: CoverageWarning: Couldn't use data file '/Users/peter_desmet/Coding/Repositories/enram/vptstools/.coverage.Peters-MacBook-Air.local.57178.263251-journal': file is not a database
  data._warn(str(exc))
/Users/peter_desmet/Coding/Repositories/enram/vptstools/.tox/py39/lib/python3.9/site-packages/coverage/data.py:166: CoverageWarning: Data file '/Users/peter_desmet/Coding/Repositories/enram/vptstools/.coverage.Peters-MacBook-Air.local.57178.263251' doesn't seem to be a coverage data file: 
  data._warn(str(exc))

But with an indication that the tests have now succeeded.

@peterdesmet peterdesmet added the bug Something isn't working label Mar 30, 2023
@peterdesmet
Copy link
Member Author

Currently a warning:

tests/test_vpts_csv.py::TestVptsCsvV1SupportFun::test_int_to_nodata PASSED                              [ 95%]
tests/test_vpts_csv.py::TestVptsCsvV1SupportFun::test_int_to_nodata_wrong_type PASSED                   [ 96%]
tests/test_vpts_csv.py::TestVptsCsvV1SupportFun::test_number_to_bool_str PASSED                         [ 97%]
tests/test_vpts_csv.py::TestVptsCsvV1SupportFun::test_check_source_file PASSED                          [ 98%]
/Users/peter_desmet/Coding/Repositories/enram/vptstools/.tox/py39/lib/python3.9/site-packages/coverage/data.py:166: CoverageWarning: Couldn't use data file '/Users/peter_desmet/Coding/Repositories/enram/vptstools/.coverage.Peters-MacBook-Air.local.74805.766847-journal': file is not a database
  data._warn(str(exc))
tests/test_vpts_csv.py::TestVptsCsvV1SupportFun::test_check_source_file_wrong_file PASSED               [100%]

---------- coverage: platform darwin, python 3.9.6-final-0 -----------
Name                                Stmts   Miss Branch BrPart  Cover   Missing
-------------------------------------------------------------------------------
src/vptstools/__init__.py               8      0      0      0   100%
src/vptstools/bin/vph5_to_vpts.py      64      1     16      1    98%   42
src/vptstools/odimh5.py                63      0     10      0   100%
src/vptstools/s3.py                    97      0     10      0   100%
src/vptstools/vpts.py                  97      0     22      0   100%
src/vptstools/vpts_csv.py              57      0     13      0   100%
-------------------------------------------------------------------------------
TOTAL                                 386      1     71      1    99%


============================================= 90 passed in 20.07s =============================================
.pkg: _exit> python /opt/homebrew/Cellar/tox/4.4.8/libexec/lib/python3.11/site-packages/pyproject_api/_backend.py True setuptools.build_meta
  py39: OK (27.08=setup[5.00]+cmd[22.08] seconds)
  congratulations :) (27.12 seconds)

@peterdesmet
Copy link
Member Author

peterdesmet commented May 8, 2023

This issue does not occur in the CI: https://github.com/enram/vptstools/actions/runs/4561907488/jobs/8048440757#step:5:109

Note, I'm using tox 4.4.8, while the CI uses tox 3.27.1 (set fixed here)

@stijnvanhoey
Copy link
Collaborator

@peterdesmet when working on the CI I encountered a similar issue. Can you try to use tox -e py instead of just tox? This runs tests only on current py-version instead of trying all of the enlisted and skipping when not available. The latter introduced an error on the .coverage in CI which I solved there with -e py parameter.

@peterdesmet
Copy link
Member Author

Started from a fresh repo and followed:

tox -e dev
source venv/bin/activate
tox -e py # rather than tox

Unfortunately, the error remained:

tests/test_vpts_csv.py::TestVptsCsvV1SupportFun::test_number_to_bool_str PASSED                                                                                      [ 97%]
tests/test_vpts_csv.py::TestVptsCsvV1SupportFun::test_check_source_file PASSED                                                                                       [ 98%]
/Users/peter_desmet/Coding/Repositories/enram/vptstools/.tox/py/lib/python3.11/site-packages/coverage/data.py:166: CoverageWarning: Data file '/Users/peter_desmet/Coding/Repositories/enram/vptstools/.coverage.Peters-MacBook-Air.local.93271.864909' doesn't seem to be a coverage data file: 
  data._warn(str(exc))
/Users/peter_desmet/Coding/Repositories/enram/vptstools/.tox/py/lib/python3.11/site-packages/coverage/data.py:166: CoverageWarning: Data file '/Users/peter_desmet/Coding/Repositories/enram/vptstools/.coverage.Peters-MacBook-Air.local.93326.698918' doesn't seem to be a coverage data file: 
  data._warn(str(exc))
/Users/peter_desmet/Coding/Repositories/enram/vptstools/.tox/py/lib/python3.11/site-packages/coverage/data.py:166: CoverageWarning: Data file '/Users/peter_desmet/Coding/Repositories/enram/vptstools/.coverage.Peters-MacBook-Air.local.93276.677394' doesn't seem to be a coverage data file: 
  data._warn(str(exc))
tests/test_vpts_csv.py::TestVptsCsvV1SupportFun::test_check_source_file_wrong_file PASSED                                                                            [100%]

---------- coverage: platform darwin, python 3.11.3-final-0 ----------
Name                                Stmts   Miss Branch BrPart  Cover   Missing
-------------------------------------------------------------------------------
src/vptstools/__init__.py               8      0      0      0   100%
src/vptstools/bin/vph5_to_vpts.py      64      1     22      1    98%   42
src/vptstools/odimh5.py                63      0     30      0   100%
src/vptstools/s3.py                    97      0     30      0   100%
src/vptstools/vpts.py                  97      0     30      0   100%
src/vptstools/vpts_csv.py              59      0     39      0   100%
-------------------------------------------------------------------------------
TOTAL                                 388      1    151      1    99%


=========================================================================== 90 passed in 21.89s ============================================================================
.pkg: _exit> python /opt/homebrew/Cellar/tox/4.5.1/libexec/lib/python3.11/site-packages/pyproject_api/_backend.py True setuptools.build_meta
  py: OK (66.57=setup[35.13]+cmd[31.43] seconds)
  congratulations :) (66.63 seconds)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants