whoisit icon indicating copy to clipboard operation
whoisit copied to clipboard

tests are packaged and installed at top-level

Open PierreF opened this issue 10 months ago • 1 comments

If we install whoisit, a top-level package tests will be installed in the site-package, which seems unwanted.

Step to reproduce (done in a freshly created virtualenv: virtualenv myvenv; . ./myvenv/bin/activate:

$ cd empty_folder_to_avoid_interference 
$ python -c "import tests; print(tests)"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
    import tests
ModuleNotFoundError: No module named 'tests'

expected, Python don't have tests package

Then:

$ pip install whoisit
$ python -c "import tests; print(tests)"
<module 'tests' from '/Users/pierref/tmp/20250220-1714/myvenv/lib/python3.13/site-packages/tests/__init__.py'>
$ ls -lh /Users/pierref/tmp/20250220-1714/myvenv/lib/python3.13/site-packages/tests/
total 80K
-rw-r--r-- 1 pierref staff    0 Feb 20 17:16 __init__.py
drwxr-xr-x 8 pierref staff  256 Feb 20 17:16 __pycache__
-rw-r--r-- 1 pierref staff  12K Feb 20 17:16 test_bootstrap.py
-rw-r--r-- 1 pierref staff  27K Feb 20 17:16 test_parser.py
-rw-r--r-- 1 pierref staff  27K Feb 20 17:16 test_public_interface.py
-rw-r--r-- 1 pierref staff 5.1K Feb 20 17:16 test_query.py
-rw-r--r-- 1 pierref staff 2.1K Feb 20 17:16 test_ssl.py

The versions involved:

$ pip --version
pip 24.3.1 from /Users/pierref/tmp/20250220-1714/myvenv/lib/python3.13/site-packages/pip (python 3.13)
$ python --version
Python 3.13.2
$ pip freeze | grep whoisit
whoisit==3.0.4

PierreF avatar Feb 20 '25 16:02 PierreF

Yeah I can probably strip those, thanks for the issue.

meeb avatar Feb 21 '25 11:02 meeb

While I've making private FreeBSD ports for whoisit, I've just encountered issue and avoid it by (obvious) patch below (Please ignore the timestamp):

--- ./setup.py.orig     2025-05-30 16:58:02.421203000 +0900
+++ ./setup.py  2025-05-30 16:57:52.354830000 +0900
@@ -26,7 +26,7 @@ setup(
     license = 'BSD',
     include_package_data = True,
     install_requires = requirements,
-    packages = find_packages(),
+    packages = find_packages(exclude=('tests',)),
     classifiers = [
         'Development Status :: 5 - Production/Stable',
         'Environment :: Web Environment',

futatuki avatar May 30 '25 08:05 futatuki

Thanks @futatuki ! I've incorporated your fix into the above commit and it'll be in the next release.

meeb avatar May 30 '25 11:05 meeb