Created
June 5, 2014 20:35
-
-
Save bartek/d8a6b2505bf985e81af4 to your computer and use it in GitHub Desktop.
tests/noserunner.py standard for allowing integration and unittest separation.
This file contains 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
import nose | |
from nose.plugins.base import Plugin | |
class IntegrationSelector(Plugin): | |
def options(self, parser, env): | |
parser.add_option("--exclude-integration", | |
dest="integration", action="store_false", | |
default=None) | |
parser.add_option("--integration", | |
dest="integration", action="store_true", | |
default=None) | |
def configure(self, options, config): | |
self.integration = options.integration | |
self.enabled = options.integration is not None | |
def wantClass(self, cls): | |
if self.integration: | |
return hasattr(cls, 'isIntegrationTest') | |
elif hasattr(cls, 'isIntegrationTest'): | |
return False | |
if __name__ == "__main__": | |
nose.main(addplugins=[IntegrationSelector()]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment