Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exclude all tests from the package #111

Closed
moubctez opened this issue Feb 19, 2019 · 3 comments
Closed

Exclude all tests from the package #111

moubctez opened this issue Feb 19, 2019 · 3 comments
Labels
S: confirmed Confirmed bug report or approved feature request. T: bug Bug.
Milestone

Comments

@moubctez
Copy link

Please, exclude all tests from the package. Otherwise they'll get installed in site-packages/tests.

--- setup.py.orig	2019-02-19 09:37:15.000000000 +0000
+++ setup.py
@@ -51,7 +51,7 @@ setup(
     author='Isaac Muse',
     author_email='Isaac.Muse@gmail.com',
     url='https://github.com/facelessuser/soupsieve',
-    packages=find_packages(exclude=['tests', 'tools']),
+    packages=find_packages(exclude=['tests', 'tests.*', 'tools']),
     install_requires=get_requirements(),
     license='MIT License',
     classifiers=[
@facelessuser
Copy link
Owner

Hmm, I didn't realize it worked that way...

Looks like it may be better just to explicitly tell it the packages:

packages=['soupsieve']

I'll look into this. I didn't realize this is what we were doing.

@facelessuser facelessuser added T: bug Bug. S: confirmed Confirmed bug report or approved feature request. integration labels Feb 19, 2019
@facelessuser
Copy link
Owner

This project is simple enough that explicitly defining the package is more than sufficient. We have a fix via PR #113 .

Thanks for pointing this out....now I have to update some of my other projects ☹️ .

@facelessuser
Copy link
Owner

It seems that that what find_packages does is find the files or modules. In our case, the sub modules are treated separately. tests only excludes the top level package and its files, but does not exclude sub modules. A pattern of like so will actually exclude all tests and tools that we currently have:

>>> import setuptools
>>> setuptools.find_packages(exclude=['test*', 'tools'])
['soupsieve']
>>>

It's a bit counter intuitive as normally I would expect if the top level module was excluded, all sub modules would also be excluded, but this is not the case.

@facelessuser facelessuser added this to the 1.9.0 milestone Mar 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S: confirmed Confirmed bug report or approved feature request. T: bug Bug.
Projects
None yet
Development

No branches or pull requests

2 participants