0.2.2: missing files in pypi sdist tarball: unable to run tests
See original GitHub issueHi! I’m currently bringing python-dbus-next to the official Arch Linux repositories. As best practice we usually run tests against the packages (if there are any). Unfortunately this fails due to missing files, when using the sdist tarball on pypi:
============================= test session starts ==============================
platform linux -- Python 3.9.6, pytest-6.2.4, py-1.10.0, pluggy-0.13.1 -- /usr/bin/python
cachedir: .pytest_cache
rootdir: /build/python-dbus-next/src/python-dbus-next-0.2.2, configfile: pytest.ini
plugins: timeout-1.4.2, asyncio-0.15.1
timeout: 5.0s
timeout method: signal
timeout func_only: False
collecting ... collected 74 items / 2 errors / 72 selected
==================================== ERRORS ====================================
_________________ ERROR collecting test/test_introspection.py __________________
test/test_introspection.py:5: in <module>
example_data = open(f'{os.path.dirname(__file__)}/data/introspection.xml', 'r').read()
E FileNotFoundError: [Errno 2] No such file or directory: '/build/python-dbus-next/src/python-dbus-next-0.2.2/test/data/introspection.xml'
___________________ ERROR collecting test/test_marshaller.py ___________________
test/test_marshaller.py:20: in <module>
table = json.load(open(os.path.dirname(__file__) + '/data/messages.json'))
E FileNotFoundError: [Errno 2] No such file or directory: '/build/python-dbus-next/src/python-dbus-next-0.2.2/test/data/messages.json'
=========================== short test summary info ============================
ERROR test/test_introspection.py - FileNotFoundError: [Errno 2] No such file ...
ERROR test/test_marshaller.py - FileNotFoundError: [Errno 2] No such file or ...
!!!!!!!!!!!!!!!!!!! Interrupted: 2 errors during collection !!!!!!!!!!!!!!!!!!!!
============================== 2 errors in 0.30s ===============================
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Tests not included in pypi sdist tarball · Issue #1227 - GitHub
Hi, I'm packaging python-pymupdf for Arch Linux. Currently I am using a github generated tarball to be able to run tests (as pypi...
Read more >Including non-Python files with setup.py - Stack Overflow
I want to be able to control the location of the file. In the original source folder, the file is in the root...
Read more >collective.releaser - PyPI
a hook to be able to launch actions when a package is released, ... It will create a tarball with all eggs needed...
Read more >Changelog - pip documentation v22.3.1
Add an option to run the test suite with pip built as a zipapp. ... Do not consider a .dist-info directory found inside...
Read more >7. Releasing your package
The most common way to do this for scientific packages is to use conda-forge, ... twine upload --repository-url https://test.pypi.org/legacy/ dist/*.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I can run the tests using
dbus-run-session -- pytest -v
.Unfortunately in 0.2.3 the sdist tarball on pypi is still missing some files:
Affirmative. Would it also be feasible to gracefully
@pytest.mark.skipif(..., reason='Non-portable dbus test.')
the relevant integration tests away, in that case? Tests that can only reliably run within a unique non-portable environment (e.g., a particular Docker container running a particular dbus configuration) should ideally just be skipped with an informative message rather than fatally halting the entire test suite.Just my 🪙 🪙 as a friendly package maintainer, of course.
B-b-but… I’m packaging for Gentoo Linux. There is no specific “application” as such.
The intended userbase is literally all users running Gentoo Linux. The intended use case is
dbus_next
installed as a system-wide Python package for use by other downstream reverse dependencies also installed as system-wide Python packages (e.g., bleak).Again, the test suite itself should gracefully scale by selectively ignoring unit and integration tests that are inapplicable to the current execution environment. Thankfully,
@pytest.mark.skip
makes that trivial – assuming it’s trivial for your test suite to detect whether it’s running in your Docker container, of course. That should be trivial. That’s usually just a lookup of a unique environment variable exported by your Docker container.Annnnnyway. I’ve marked our Gentoo ebuild for
dbus_next
asRESTRICT=test
for now, meaning that tests are known to fail and should be ignored. I’m fine with that. It is what it is. 🤷♂️