Backblaze / b2-sdk-python

Python library to access B2 cloud storage.
Other
186 stars 61 forks source link

Tests no longer shipped in tarball #470

Closed Hawk777 closed 10 months ago

Hawk777 commented 10 months ago

In 1.29.0, the test directory was included in the tarball uploaded to PyPI. In 1.30.1, it isn’t. This wasn’t mentioned in the changelog, so it’s not clear whether it was an intentional change or not.

vbaltrusaitis-reef commented 10 months ago

This is a byproduct of moving to a different build process (using pdm) and packaging only the files that implement the public API of this library, and package metadata. Infrastructure files (noxfile.py, CI/CD files) are excluded, tests as well, as they're not affecting the functionality of b2sdk.

@Hawk777 How did you notice this? Does this affect you negatively somehow, i.e. you used the tests from the tarball (as opposed to the repository) in CI?

Hawk777 commented 10 months ago

I use Gentoo, so I made myself an ebuild¹ to install b2sdk system-wide. It’s easiest to grab sources from a tarball, but Gentoo has a framework for running Python packages’ tests on the end-user’s box as part of installation, which stopped running those tests since they stopped being present. There’s a bit of documentation here, in particular it mentions in this section that “One of the more common test-related problems is that PyPI packages (generated via setup.py sdist) often miss some or all test files. The latter results in no tests being run, the former in test failures or errors. The simplest solution is to use a VCS snapshot instead of the PyPI tarball.” Which I could do, I just wasn’t before because using a PyPI tarball is more convenient, thus I noticed the change.

¹I’m not an official packager or anything, it’s just for my own use.

vbaltrusaitis-reef commented 10 months ago

Testing dependencies were not defined in any of the requirements*.txt files. Did you use nox for running the tests, with noxfile.py from the tarball? Or did you look up the dependencies in noxfile.py and hard-coded them in your ebuild definition?

I'm trying to understand the process here. We don't provide stability guarantees about how tests are organized and how they should be run, and test dependencies may also change, so it seems that this process would be somewhat brittle either way.

Hawk777 commented 10 months ago

I just use pytest. I also pulled in pytest-lazy-fixture and pytest-mock after determining they were needed. It seemed to work at that point.

Hawk777 commented 10 months ago

I should probably clarify: if your position is “if you want the tests, use a VCS snapshot instead of the PyPI tarball”, I’m totally fine with that. It just wasn’t mentioned in the changelog, so I thought the removal might have been accidental.

ppolewicz commented 10 months ago

99% of the users don't need the tests in their pypi package. They shouldn't have been placed there in the first place, that was a mistake.

If you do want to run tests, please switch to the VCS snapshot (of the highest "v.*" tag - master may not be as stable as the tags are)