-
-
Notifications
You must be signed in to change notification settings - Fork 25.5k
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
py.test test discovery in the root directory #9699
Comments
Personally I just don't think this is worth the pain. For examples benchmarks can have additional dependencies like pandas, Maybe we could tweak pytest discovery in a way that make |
Definitely, that's why IMO they should be excluded from unit tests auto-discovered by py.test
I know. Just run into this for the 3rd time because I keep forgetting to prepend the Just opening this issue in case someones runs into this often enough and becomes motivated to fix it ) |
Is jnothman@master...pytest-ignore
sufficient, @rth?
|
@jnothman No, but,
should be, I think. Thanks for checking this.. |
PR welcome..?
…On 7 September 2017 at 18:19, Roman Yurchak ***@***.***> wrote:
@jnothman <https://github.com/jnothman> No, but,
[tool:pytest]
addopts =
[...]
--ignore=benchmarks/
--ignore=doc/
--ignore=examples/
should be, I think. Thanks for checking this..
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#9699 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAEz62nWHzU1H5D8OTKK9LiPqY5suu1pks5sf6cPgaJpZM4POsHl>
.
|
Well the there is one additional issue is that when running
|
Any idea why that happens??
…On 7 September 2017 at 19:51, Roman Yurchak ***@***.***> wrote:
Well the there is one additional issue is that when running pytest . with
these changes as opposed to with pytest sklearn one test fails,
def test_root_import_all_completeness():
EXCEPTIONS = ('utils', 'tests', 'base', 'setup')
for _, modname, _ in pkgutil.walk_packages(path=sklearn.__path__,
onerror=lambda _: None):
if '.' in modname or modname.startswith('_') or modname in EXCEPTIONS:
continue
> assert_in(modname, sklearn.__all__)
E AttributeError: module 'sklearn' has no attribute '__all__'
sklearn/tests/test_common.py:145: AttributeError
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#9699 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAEz69C0zSbzhYfqk_rMDMDHu9W5OWOzks5sf7yZgaJpZM4POsHl>
.
|
Essentially, if one installs scikit-learn with, @lesteve How about I just skip this test if ` |
The test is there to ensure that nothing has been forgotten from __all__
unintentionally when modules are added or renamed.
I've not investigated, but don't get why __SKLEARN_SETUP__ would be on
after setup is completed
|
OK, got it: |
This was fixed a while ago (#12011) without closing this issue. |
Not sure if this is addressed somewhere, but with the current migration to pytest, it would be nice if pytest was able to correctly collect unit tests from the scikit-learn root directory. Currently,
fails (partial traceback below) because it believes that benchmarks are unit tests a and consequently fails to import some packages.
works correctly. There should be a way to modify the test discovery in pytest settings somewhere I imagine..
cc @lesteve @massich
(partial traceback below)
The text was updated successfully, but these errors were encountered: