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

MAINT: clean up testing.assert_raises_regexp, 2.6-specific code removed. #7636

Merged
merged 1 commit into from
May 14, 2016

Conversation

rgommers
Copy link
Member

The global also was ugly and not useful.


return assert_raises_regex_impl(exception_class, expected_regexp,
callable_obj, *args, **kwargs)
if sys.version_info.major >= 3:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not do this up above at line 22

if sys.version_info[0] >= 3:
    from io import StringIO
    from nose.tools import assert_raises_regex
else:
    from StringIO import StringIO
    from nose.tools import assert_raises_regexp as assert_raises_regex

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nose is an optional dependency, so the import_nose call is hidden inside each test function on purpose. therefore can't do line 22.

also the line __tracebackhide__ = True # Hide traceback for py.test seems to be useful to people, so don't want to remove that

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, OK. Although one could question to what degree nose is optional ;)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many users will never run the tests, so making it non-optional will result in lots of errors on import numpy. all fixable of course, but why add the dependency?

@charris charris merged commit 47645ff into numpy:master May 14, 2016
@charris
Copy link
Member

charris commented May 14, 2016

Thanks Ralf.

@rgommers rgommers deleted the assert-raises-regexp branch May 15, 2016 07:42
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.

None yet

2 participants