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

tox -re coverage b0rken for c-code projects #271

Closed
tseaver opened this issue Aug 27, 2024 · 3 comments
Closed

tox -re coverage b0rken for c-code projects #271

tseaver opened this issue Aug 27, 2024 · 3 comments
Assignees

Comments

@tseaver
Copy link
Member

tseaver commented Aug 27, 2024

BUG

$ git clone [email protected]:zopefoundation/persistent.git
Cloning into 'persistent'...
remote: Enumerating objects: 3244, done.
remote: Counting objects: 100% (740/740), done.
remote: Compressing objects: 100% (272/272), done.
remote: Total 3244 (delta 454), reused 661 (delta 398), pack-reused 2504 (from 1)
Receiving objects: 100% (3244/3244), 1.03 MiB | 12.40 MiB/s, done.
Resolving deltas: 100% (2290/2290), done.
$ cd persistent/
$ tox -e coverage
coverage: install_deps> python -I -m pip install coverage
.pkg: install_requires> python -I -m pip install 'setuptools>=40.8.0' wheel
.pkg: _optional_hooks> python /opt/Python-3.12.4/lib/python3.12/site-packages/pyproject_api/_backend.py True setuptools.build_meta __legacy__
.pkg: get_requires_for_build_sdist> python /opt/Python-3.12.4/lib/python3.12/site-packages/pyproject_api/_backend.py True setuptools.build_meta __legacy__
.pkg: install_requires_for_build_sdist> python -I -m pip install 'cffi; platform_python_implementation == "CPython"' 'cffi>=1.17.0rc1; platform_python_implementation == "CPython" and python_version >= "3.13a0"'
.pkg: get_requires_for_build_wheel> python /opt/Python-3.12.4/lib/python3.12/site-packages/pyproject_api/_backend.py True setuptools.build_meta __legacy__
.pkg: install_requires_for_build_wheel> python -I -m pip install 'cffi; platform_python_implementation == "CPython"' 'cffi>=1.17.0rc1; platform_python_implementation == "CPython" and python_version >= "3.13a0"'
.pkg: prepare_metadata_for_build_wheel> python /opt/Python-3.12.4/lib/python3.12/site-packages/pyproject_api/_backend.py True setuptools.build_meta __legacy__
.pkg: build_sdist> python /opt/Python-3.12.4/lib/python3.12/site-packages/pyproject_api/_backend.py True setuptools.build_meta __legacy__
coverage: install_package_deps> python -I -m pip install Sphinx 'cffi; platform_python_implementation == "CPython"' 'cffi>=1.17.0rc1; platform_python_implementation == "CPython" and python_version >= "3.13a0"' manuel repoze.sphinx.autointerface sphinx-rtd-theme zope.deferredimport zope.interface zope.testrunner
coverage: install_package> python -I -m pip install --force-reinstall --no-deps /tmp/persistent/.tox/.tmp/package/1/persistent-6.1.dev0.tar.gz
coverage: commands[0]> mkdir -p /tmp/persistent/parts/htmlcov
coverage: commands[1]> coverage run -m zope.testrunner --test-path=src -vc
Running tests at level 1
Running zope.testrunner.layer.UnitTests tests:
  Set up zope.testrunner.layer.UnitTests in 0.000 seconds.
  Running:
/tmp/persistent/.tox/coverage/lib/python3.12/site-packages/persistent/tests/test_mapping.py:319: DeprecationWarning: PersistentDict is deprecated. `persistent.dict.PersistentDict` is deprecated. Use `persistent.mapping.PersistentMapping` instead. This backward compatibility shim will be removed in persistent version 6.
  from persistent.dict import PersistentDict
...................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
  Ran 771 tests with 0 failures, 0 errors, 245 skipped in 0.336 seconds.
Tearing down left over layers:
  Tear down zope.testrunner.layer.UnitTests in 0.000 seconds.
/tmp/persistent/.tox/coverage/lib/python3.12/site-packages/coverage/control.py:894: CoverageWarning: No data was collected. (no-data-collected)
  self._warn("No data was collected.", slug="no-data-collected")
coverage: commands[2]> python -c 'import os, subprocess; subprocess.check_call("coverage run -a -m zope.testrunner --test-path=src", env=dict(os.environ, PURE_PYTHON="0"), shell=True)'
Running zope.testrunner.layer.UnitTests tests:
  Set up zope.testrunner.layer.UnitTests in 0.000 seconds.
/tmp/persistent/.tox/coverage/lib/python3.12/site-packages/persistent/tests/test_mapping.py:319: DeprecationWarning: PersistentDict is deprecated. `persistent.dict.PersistentDict` is deprecated. Use `persistent.mapping.PersistentMapping` instead. This backward compatibility shim will be removed in persistent version 6.
  from persistent.dict import PersistentDict
/opt/Python-3.12.4/lib/python3.12/unittest/case.py:690: DeprecationWarning: It is deprecated to return a value that is not None from a test case (<bound method PickleCacheTestMixin.test___delitem___w_persistent_class of <persistent.tests.test_picklecache.CPickleCacheTests testMethod=test___delitem___w_persistent_class>>)
  return self.run(*args, **kwds)
/opt/Python-3.12.4/lib/python3.12/unittest/case.py:690: DeprecationWarning: It is deprecated to return a value that is not None from a test case (<bound method PickleCacheTestMixin.test___setitem___ghost of <persistent.tests.test_picklecache.CPickleCacheTests testMethod=test___setitem___ghost>>)
  return self.run(*args, **kwds)
/opt/Python-3.12.4/lib/python3.12/unittest/case.py:690: DeprecationWarning: It is deprecated to return a value that is not None from a test case (<bound method PickleCacheTestMixin.test_debug_info_w_ghost of <persistent.tests.test_picklecache.CPickleCacheTests testMethod=test_debug_info_w_ghost>>)
  return self.run(*args, **kwds)
/opt/Python-3.12.4/lib/python3.12/unittest/case.py:690: DeprecationWarning: It is deprecated to return a value that is not None from a test case (<bound method PickleCacheTestMixin.test_debug_info_w_normal_object of <persistent.tests.test_picklecache.CPickleCacheTests testMethod=test_debug_info_w_normal_object>>)
  return self.run(*args, **kwds)
/opt/Python-3.12.4/lib/python3.12/unittest/case.py:690: DeprecationWarning: It is deprecated to return a value that is not None from a test case (<bound method PickleCacheTestMixin.test_debug_info_w_persistent_class of <persistent.tests.test_picklecache.CPickleCacheTests testMethod=test_debug_info_w_persistent_class>>)
  return self.run(*args, **kwds)
/opt/Python-3.12.4/lib/python3.12/unittest/case.py:690: DeprecationWarning: It is deprecated to return a value that is not None from a test case (<bound method PickleCacheTestMixin.test_new_ghost_obj_already_in_cache of <persistent.tests.test_picklecache.CPickleCacheTests testMethod=test_new_ghost_obj_already_in_cache>>)
  return self.run(*args, **kwds)
/opt/Python-3.12.4/lib/python3.12/unittest/case.py:690: DeprecationWarning: It is deprecated to return a value that is not None from a test case (<bound method PickleCacheTestMixin.test_new_ghost_w_pclass_ghost of <persistent.tests.test_picklecache.CPickleCacheTests testMethod=test_new_ghost_w_pclass_ghost>>)
  return self.run(*args, **kwds)
/opt/Python-3.12.4/lib/python3.12/unittest/case.py:690: DeprecationWarning: It is deprecated to return a value that is not None from a test case (<bound method PickleCacheTestMixin.test_new_ghost_w_pclass_non_ghost of <persistent.tests.test_picklecache.CPickleCacheTests testMethod=test_new_ghost_w_pclass_non_ghost>>)
  return self.run(*args, **kwds)
  Ran 771 tests with 0 failures, 0 errors and 6 skipped in 0.547 seconds.
Tearing down left over layers:
  Tear down zope.testrunner.layer.UnitTests in 0.000 seconds.
coverage: commands[3]> coverage html -i
Wrote HTML report to parts/htmlcov/index.html
coverage: commands[4]> coverage report -i -m --fail-under=99.8
Name                                         Stmts   Miss   Cover   Missing
---------------------------------------------------------------------------
src/persistent/__init__.py                      15     15   0.00%   19-51
src/persistent/_compat.py                       58     58   0.00%   15-204
src/persistent/dict.py                           2      2   0.00%   14-17
src/persistent/interfaces.py                    58     58   0.00%   17-572
src/persistent/list.py                          61     61   0.00%   16-141
src/persistent/mapping.py                       55     55   0.00%   16-152
src/persistent/persistence.py                  368    368   0.00%   14-629
src/persistent/picklecache.py                  244    244   0.00%   14-506
src/persistent/ring.py                          73     73   0.00%   15-188
src/persistent/tests/__init__.py                 0      0 100.00%
src/persistent/tests/attrhooks.py               36     36   0.00%   19-126
src/persistent/tests/cucumbers.py               63     63   0.00%   16-112
src/persistent/tests/test__compat.py            50     50   0.00%   19-107
src/persistent/tests/test_compile_flags.py       9      9   0.00%   14-29
src/persistent/tests/test_docs.py               23     23   0.00%   19-64
src/persistent/tests/test_list.py              261    261   0.00%   17-391
src/persistent/tests/test_mapping.py           205    205   0.00%   14-324
src/persistent/tests/test_persistence.py      1624   1624   0.00%   15-2225
src/persistent/tests/test_picklecache.py       916    916   0.00%   14-1341
src/persistent/tests/test_ring.py               79     79   0.00%   14-126
src/persistent/tests/test_timestamp.py         278    278   0.00%   14-430
src/persistent/tests/test_wref.py              277    277   0.00%   14-346
src/persistent/tests/utils.py                   57     57   0.00%   1-110
src/persistent/timestamp.py                    110    110   0.00%   14-208
src/persistent/wref.py                          67     67   0.00%   17-129
---------------------------------------------------------------------------
TOTAL                                         4989   4989   0.00%
Coverage failure: total of 0.00 is less than fail-under=99.80
coverage: exit 2 (0.37 seconds) /tmp/persistent> coverage report -i -m --fail-under=99.8 pid=1298229
  coverage: FAIL code 2 (23.82=setup[20.27]+cmd[0.00,1.00,1.29,0.88,0.37] seconds)
  evaluation failed :( (23.89 seconds)

The failure is down to the removal of usedevelop = True for all test environments in 379920c (my commit). That change is great for normal environments, but disastrous for coverage.

@dataflake
Copy link
Member

Fixed separately, see #272 and zopefoundation/persistent@149c88e

@tseaver tseaver reopened this Aug 28, 2024
@tseaver
Copy link
Member Author

tseaver commented Aug 28, 2024

Ugh, I have tox -e coverage failling in my main persistent repo with that change, but when I clone it afresh, it passes.

@tseaver
Copy link
Member Author

tseaver commented Aug 28, 2024

OK, the main rep had an empty persistent/tests directory in the root, left over from before the repo switched to src/. Once I removed it, tox -e coverage passes.

@tseaver tseaver closed this as completed Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants