pipenv icon indicating copy to clipboard operation
pipenv copied to clipboard

sdist is missing tests

Open mtelka opened this issue 1 year ago • 15 comments

The sdist package at PyPI is missing tests. Please add tests to sdist to make downstream testing easier. Thank you.

mtelka avatar Oct 30 '24 07:10 mtelka

@mtelka to be honest, I am not sure what is being requested here.

matteius avatar Oct 30 '24 11:10 matteius

Please try this (sdist at PyPI):

$ wget https://files.pythonhosted.org/packages/source/p/pipenv/pipenv-2024.3.0.tar.gz
$ tar xf pipenv-2024.3.0.tar.gz
$ ls pipenv-2024.3.0/tests
ls: cannot access 'pipenv-2024.3.0/tests': No such file or directory
$

And now the same with the github tarball:

$ wget https://github.com/pypa/pipenv/archive/refs/tags/v2024.3.0.tar.gz
$ tar xf v2024.3.0.tar.gz
$ ls pipenv-2024.3.0/tests
conftest.py  fixtures  __init__.py  integration  pypi  test_artifacts  unit
$

mtelka avatar Oct 30 '24 11:10 mtelka

We intentionally prune out the tests from the pypi published wheels and packages, that would be a very large package size if we did not.

matteius avatar Oct 30 '24 11:10 matteius

I agree that tests should not be in wheels, but sdists are different. Most Python projects keep tests in their sdists. Also setuptools does so by default.

mtelka avatar Oct 30 '24 12:10 mtelka

First , this issue revealed to me that we are not distributing wheels. We should consider. .. Second, pipenv is quite a special case here, as we use the sdist to let people install pipenv . If we add the tests people who wanted to just install and use pipenv will unnecessarily download the tests too. To fix it, we need to build wheels. But even if we did that, distributing the tests only would be useless. The reason for this is that pipenv's extended integration tests required many source packages that are included in the repository as git submodules. Hence, the audience of the sdist file - developers - would come short handed here. The best way to get the sources with tests is included is to close the repository directly from GitHub.

oz123 avatar Dec 11 '24 19:12 oz123

Sorry we are building wheels and uploading them to pypi. I oversaw it when replying from a mobile device. @matteius I believe we can close the issue.

oz123 avatar Dec 11 '24 19:12 oz123

Hence, the audience of the sdist file - developers - would come short handed here.

In addition to developers the sdist audience are also downstream distributions. Which is my case too. I use sdists to create OpenIndiana packages.

The best way to get the sources with tests is included is to close the repository directly from GitHub.

Yes, I can use github tarballs for that (I actually do so now for pipenv), but github tarballs are unstable (they could change later) and so sdists are always the preferred way for getting the sources.

Thank you.

mtelka avatar Dec 11 '24 20:12 mtelka

@mtelka are you running the complete integration test as part of the build?

The gentoo ebuild is only running the unittest because the gentoo build system does not allow network calles.

oz123 avatar Dec 11 '24 21:12 oz123

@mtelka are you running the complete integration test as part of the build?

I do not know. I just run pytest :-). However many tests are failing and the testing takes about one hour:

===== 54 failed, 325 passed, 18 skipped, 27 warnings in 3919.83s (1:05:19) =====

Unfortunately, I had no time yet to analyze what exactly is failing there.

mtelka avatar Dec 11 '24 22:12 mtelka

I recommend that you just do:

pytest -m "not cli and not needs_internet" tests/unit/

These tests do not detpend on git submodules and do not require a local pypiserver to run. Also, they should take around no more than 20 seconds on a normal computer.

oz123 avatar Dec 11 '24 22:12 oz123

I recommend that you just do:

pytest -m "not cli and not needs_internet" tests/unit/

Thanks for the hint. It looks far better now:

=========== 143 passed, 8 skipped, 12 deselected, 1 warning in 3.89s ===========

mtelka avatar Dec 12 '24 13:12 mtelka

I guess I can close the ticket?

oz123 avatar Dec 12 '24 14:12 oz123

The sdist is still missing tests :-).

mtelka avatar Dec 12 '24 14:12 mtelka

Well, as I explained, putting the tests there is pointless. Maybe we can just put the unittests ...

oz123 avatar Dec 12 '24 14:12 oz123

Well, as I explained, putting the tests there is pointless. Maybe we can just put the unittests ...

No objection :-).

mtelka avatar Dec 12 '24 14:12 mtelka