Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[MRG+1] Do not ignore files starting with _ and . in nose #6466

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

Merged
merged 1 commit into from
Mar 19, 2016

Conversation

lesteve
Copy link
Member

@lesteve lesteve commented Feb 29, 2016

By default, files starting with . or _ and setup.py are ignored by nose (from this SO answer). This causes doctests to be skipped in _*.py modules as noticed in #6379 (comment).

Not sure exactly why, but setup.py in sub-packages confuses nose so we can not use ignore-files=regex_that_is_unlikely_to_match_any_file. I am guessing nose sees sklearn.datasets.setup and thinks it's a package-level fixture that it can call as a function. Here is the full traceback for completeness:

======================================================================
ERROR: test suite for <module 'sklearn.datasets' from '/home/le243287/dev/scikit-learn/sklearn/datasets/__init__.py'>
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/volatile/le243287/miniconda3/lib/python3.5/inspect.py", line 1089, in getfullargspec
    sigcls=Signature)
  File "/volatile/le243287/miniconda3/lib/python3.5/inspect.py", line 2156, in _signature_from_callable
    raise TypeError('{!r} is not a callable object'.format(obj))
TypeError: <module 'sklearn.datasets.setup' from '/home/le243287/dev/scikit-learn/sklearn/datasets/setup.py'> is not a callable object

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/volatile/le243287/miniconda3/lib/python3.5/site-packages/nose/util.py", line 460, in try_run
    inspect.getargspec(func)
  File "/volatile/le243287/miniconda3/lib/python3.5/inspect.py", line 1043, in getargspec
    getfullargspec(func)
  File "/volatile/le243287/miniconda3/lib/python3.5/inspect.py", line 1095, in getfullargspec
    raise TypeError('unsupported callable') from ex
TypeError: unsupported callable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/volatile/le243287/miniconda3/lib/python3.5/site-packages/nose/suite.py", line 210, in run
    self.setUp()
  File "/volatile/le243287/miniconda3/lib/python3.5/site-packages/nose/suite.py", line 293, in setUp
    self.setupContext(ancestor)
  File "/volatile/le243287/miniconda3/lib/python3.5/site-packages/nose/suite.py", line 316, in setupContext
    try_run(context, names)
  File "/volatile/le243287/miniconda3/lib/python3.5/site-packages/nose/util.py", line 466, in try_run
    (name, obj))
TypeError: Attribute setup of <module 'sklearn.datasets' from '/home/le243287/dev/scikit-learn/sklearn/datasets/__init__.py'> is not a python function. Only functions or callables may be used as fixtures.

@ogrisel
Copy link
Member

ogrisel commented Mar 3, 2016

LGTM.

@ogrisel ogrisel changed the title [MRG] Do not ignore files starting with _ and . in nose [MRG+1] Do not ignore files starting with _ and . in nose Mar 3, 2016
@lesteve lesteve force-pushed the nose-ignore-files-tweak branch from 144fcbf to ea6034f Compare March 11, 2016 18:08
@lesteve
Copy link
Member Author

lesteve commented Mar 11, 2016

I tweaked ignore-files a bit to use the same regex for setup.py as the default one. You can see it as the first line of nosetests -vvv:

nose.config: INFO: Ignoring files matching ['^\\.', '^_', '^setup\\.py$']

By default, files starting with _ and setup.py are ignored by nose. This
causes doctests to be skipped in _*.py modules.
@lesteve lesteve force-pushed the nose-ignore-files-tweak branch from ea6034f to 876f123 Compare March 11, 2016 18:27
glouppe added a commit that referenced this pull request Mar 19, 2016
[MRG+1] Do not ignore files starting with _ and . in nose
@glouppe glouppe merged commit 9691824 into scikit-learn:master Mar 19, 2016
@glouppe
Copy link
Contributor

glouppe commented Mar 19, 2016

Thanks!

@lesteve lesteve deleted the nose-ignore-files-tweak branch March 19, 2016 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants