tests do end up in root `site-packages/tests` folder
amureki opened this issue · comments
Greetings fellows!
Thanks for an amazing package.
Describe the bug
Whenever I do pip install django_select2
, I discover in my site-packages/tests
tests from django-select2:
I do believe, this is due to the current packages
definition in setup.cfg:
Line 22 in 2bb6f3a
This is rather a small thing, but it can lead to some bad things (you can import tests in your codebase, etc).
I would be happy to fix it on my own, but I'd rather hear your opinion on how would you want to proceed:
- to install only package without tests (then we just define something like
django-select2
in this config - to install package with tests (not sure I like that idea, but it might be useful for people who do integrity tests of installed packages) - then we would need to put tests under
django-select2
folder, so they would appear as part ofdjango-select2
package.
Cheers!
@codingjoe I am using django-select2 7.0.3
(latest from pypi).
I did check MANIFEST.in and wonder what is wrong and why it is ignoring it.
Here is an output from fresh virtual environment which I just created:
17:02 $ mkvirtualenv select2test
Using base prefix '/Users/amureki/.pyenv/versions/3.6.8'
New python executable in /Users/amureki/.virtualenvs/select2test/bin/python3.6
Also creating executable in /Users/amureki/.virtualenvs/select2test/bin/python
Installing setuptools, pip, wheel...
done.
virtualenvwrapper.user_scripts creating /Users/amureki/.virtualenvs/select2test/bin/predeactivate
virtualenvwrapper.user_scripts creating /Users/amureki/.virtualenvs/select2test/bin/postdeactivate
virtualenvwrapper.user_scripts creating /Users/amureki/.virtualenvs/select2test/bin/preactivate
virtualenvwrapper.user_scripts creating /Users/amureki/.virtualenvs/select2test/bin/postactivate
virtualenvwrapper.user_scripts creating /Users/amureki/.virtualenvs/select2test/bin/get_env_details
(select2test) ✔ ~
17:03 $ pip install django_select2
Collecting django_select2
Downloading https://files.pythonhosted.org/packages/3a/9a/44d836f7ffcdb1c276a6d7f220f59b08e478434e6f4a5db7589efad6bc6c/django_select2-7.0.3-py2.py3-none-any.whl
Collecting django-appconf>=0.6.0 (from django_select2)
Using cached https://files.pythonhosted.org/packages/f6/b3/fcec63afcf323581c4919f21e90ef8c8200034108a6a0ab47a6bf6a9327b/django_appconf-1.0.3-py2.py3-none-any.whl
Collecting django>=2.0 (from django_select2)
Using cached https://files.pythonhosted.org/packages/eb/4b/743d5008fc7432c714d753e1fc7ee56c6a776dc566cc6cfb4136d46cdcbb/Django-2.2.2-py3-none-any.whl
Collecting six (from django-appconf>=0.6.0->django_select2)
Using cached https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1fecfe898238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl
Collecting sqlparse (from django>=2.0->django_select2)
Using cached https://files.pythonhosted.org/packages/ef/53/900f7d2a54557c6a37886585a91336520e5539e3ae2423ff1102daf4f3a7/sqlparse-0.3.0-py2.py3-none-any.whl
Collecting pytz (from django>=2.0->django_select2)
Using cached https://files.pythonhosted.org/packages/3d/73/fe30c2daaaa0713420d0382b16fbb761409f532c56bdcc514bf7b6262bb6/pytz-2019.1-py2.py3-none-any.whl
Installing collected packages: six, sqlparse, pytz, django, django-appconf, django-select2
Successfully installed django-2.2.2 django-appconf-1.0.3 django-select2-7.0.3 pytz-2019.1 six-1.12.0 sqlparse-0.3.0
(select2test) ✔ ~
17:03 $ cd /Users/amureki/.virtualenvs/select2test/lib/python3.6/site-packages/tests/
(select2test) ✔ ~/.virtualenvs/select2test/lib/python3.6/site-packages/tests
17:05 $ head -n 15 conftest.py
import random
import string
import pytest
from django.utils.encoding import force_text
from selenium import webdriver
from selenium.common.exceptions import WebDriverException
def random_string(n):
return ''.join(
random.choice(string.ascii_uppercase + string.digits)
for _ in range(n)
)
@amureki I just downloaded the tarball from pypi. The test file are not in there. I just released a new version. Can you test with 7.0.4?
Apparently tests are still included in wheel file, which is being used whenever you do pip install
:
17:22 $ ls
total 104
drwxr-xr-x@ 3 amureki staff 96B Jul 9 2016 $RECYCLE.BIN
drwx------+ 7 amureki staff 224B Jun 10 17:22 .
drwxr-xr-x+ 134 amureki staff 4.2K Jun 10 17:04 ..
-rw-r--r--@ 1 amureki staff 24K Jun 10 17:21 django_select2-7.0.4-py2.py3-none-any.whl
17:22 $ unzip -l django_select2-7.0.4-py2.py3-none-any.whl
Archive: django_select2-7.0.4-py2.py3-none-any.whl
Length Date Time Name
--------- ---------- ----- ----
279 06-10-2019 15:20 django_select2/__init__.py
213 06-10-2019 15:20 django_select2/apps.py
550 06-10-2019 15:20 django_select2/cache.py
5384 06-10-2019 15:20 django_select2/conf.py
18489 06-10-2019 15:20 django_select2/forms.py
400 06-10-2019 15:20 django_select2/urls.py
3064 06-10-2019 15:20 django_select2/views.py
1783 06-10-2019 15:20 django_select2/static/django_select2/django_select2.js
0 06-10-2019 15:20 tests/__init__.py
1582 06-10-2019 15:20 tests/conftest.py
140 06-10-2019 15:20 tests/test_cache.py
24045 06-10-2019 15:20 tests/test_forms.py
3924 06-10-2019 15:20 tests/test_views.py
0 06-10-2019 15:20 tests/testapp/__init__.py
5821 06-10-2019 15:20 tests/testapp/forms.py
242 06-10-2019 15:20 tests/testapp/manage.py
1518 06-10-2019 15:20 tests/testapp/models.py
787 06-10-2019 15:20 tests/testapp/settings.py
1402 06-10-2019 15:20 tests/testapp/urls.py
949 06-10-2019 15:20 tests/testapp/views.py
1071 06-10-2019 15:20 django_select2-7.0.4.dist-info/LICENSE
2774 06-10-2019 15:20 django_select2-7.0.4.dist-info/METADATA
110 06-10-2019 15:20 django_select2-7.0.4.dist-info/WHEEL
21 06-10-2019 15:20 django_select2-7.0.4.dist-info/top_level.txt
2017 06-10-2019 15:20 django_select2-7.0.4.dist-info/RECORD
--------- -------
76565 25 files
Here is a SO answer, mentioning that for the packages a combination of MANIFEST.in and packages config in setup.py/cfg
should be used:
https://stackoverflow.com/posts/45847842/
True, that seems to be right. I found and fixed the issue, PR is comming
@codingjoe thanks Johannes! 🏅