rndusr / torf

Python module to create, parse and edit torrent files and magnet links
GNU General Public License v3.0
180 stars 17 forks source link

File conflict with python-hypothesis #19

Closed dbermond closed 4 years ago

dbermond commented 4 years ago

I'm on Arch Linux, and python-torf installs the file /usr/lib/python<version>/site-packages/tests/__init__.py. This same file is also installed by package python-hypothesis. Since these two packages installs the same file, this results in a package conflict (where both packages cannot be installed at the same time).

The list of files installed by package python-hypothesis on Arch Linux can be seen here. I've noticed that this file is being installed by python-hypothesis since its version 5.37.0.

Can this file conflict with python-hypothesis be fixed here?

rndusr commented 4 years ago

Why are the tests packaged at all? How does python packaging work on Arch exactly? Tests are not installed with pip or similar tools.

I could just rename init.py to something else (it's only used to share stuff between tests), but that is just dancing around the issue. conftest.py can't be renamed. And what if some other project contains tests/test_attributes.py or tests/test_read.py?

What do you suggest?

dbermond commented 4 years ago

Thank you for the reply.

Why are the tests packaged at all? How does python packaging work on Arch exactly? Tests are not installed with pip or similar tools.

On Arch Linux, the majority of python software is installed by the command python setup.py install, unless something else special is needed (which is not the case of python-torf). When tests are available, they are executed in a check function before installation. This is described in the Arch Linux python package guidelines. Being such, all the files produced by this command are installed to the package, and looks like this is including the test files.

I could not find an option in setup.py to disable the installation of the test files.

I could just rename init.py to something else (it's only used to share stuff between tests), but that is just dancing around the issue. conftest.py can't be renamed. And what if some other project contains tests/test_attributes.py or tests/test_read.py?

I see.

What do you suggest?

I'm not a python guy. Can these test files be marked to be not installed by the installation process (or something with similar effect)? Is there any option that can be passed to setup.py to disable installation of these test files?

rndusr commented 4 years ago

I think the init.py file in the tests directory includes it automatically in the package. I've explicitly excluded the tests and made a new release.

Thank you for reporting this.

BTW, I see the pkgbuild runs pytest at some point. I don't know if this still happens now that I've excluded them, but you can speed that up a lot by passing "--file-counts 1 --piece-counts 1" to pytest.

dbermond commented 4 years ago

Thank you for providing a solution for this!

And thank you about the pytest options hint. The tests are much faster now, and runs in just a few seconds :)

AUR package updated.

Closing.