Created
August 5, 2013 22:34
-
-
Save wesm/6160217 to your computer and use it in GitHub Desktop.
A metaclass for marking test cases (including superclasses) as requiring network connection (for nosetests -A "not network" to work)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Author: Wes McKinney | |
| # License: MIT | |
| from pandas.util.testing import network | |
| class NetworkTests(type): | |
| def __new__(cls, name, bases, attrs): | |
| for k, v in attrs.iteritems(): | |
| if k.startswith('test_'): | |
| attrs[k] = network(v) | |
| for base in bases: | |
| for k, v in base.__dict__.iteritems(): | |
| if k.startswith('test_'): | |
| attrs[k] = network(v) | |
| return type.__new__(cls, name, bases, attrs) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment