def run(self): """ensure tests are capable of being run, then run nose.main with a reconstructed argument list""" self.run_command('egg_info') # Build extensions in-place self.reinitialize_command('build_ext', inplace=1) self.run_command('build_ext') if self.distribution.tests_require: self.distribution.fetch_build_eggs(self.distribution.tests_require) argv = [] for (option_name, cmd_name) in self.option_to_cmds.items(): if option_name in option_blacklist: continue value = getattr(self, option_name) if value is not None: if flag(value): if _bool(value): argv.append('--' + cmd_name) else: argv.append('--' + cmd_name) argv.append(value) main(argv=argv, env=os.environ)
def run_tests(): database.reset() database.cache() results = main() pdb.set_trace() if results.wasSuccessful(): sys.exit(0) sys.exit(1)
#!/usr/bin/env python import runpy import sys import os sys.argv += ['-style', 'cleanlooks'] sys.path.append( os.path.join(os.path.dirname(__file__), 'test') ) sys.path.append( os.path.dirname(__file__) ) from nose.core import main main(argv=['build.py', '-v', '-s', '-P', 'test'], exit=False) del sys.argv[-2:] import sphinx sphinx.main(['sphinx-build', '-a', '-E', 'doc/sphinx/source', 'doc/sphinx/build',]) import sys sys.argv += ['sdist', 'bdist_egg'] runpy.run_module('setup', run_name='__main__')
#!/usr/bin/env python """Nose-based test runner. """ from nose.core import main from nose.plugins.builtin import plugins from nose.plugins.doctests import Doctest from . import ipdoctest from .ipdoctest import IPDocTestRunner if __name__ == '__main__': print('WARNING: this code is incomplete!') print() pp = [x() for x in plugins] # activate all builtin plugins first main(testRunner=IPDocTestRunner(), plugins=pp+[ipdoctest.IPythonDoctest(),Doctest()])
class FunctionalConfig(Config): def __init__(self, config_name=None): if not config_name: config_name = "runtests.yml" config_path = get_config_path(config_name) super(FunctionalConfig, self).__init__(config_path) # use 4 cores as a baseline for timeout corrected_timeout = self.runtests.timeout # use timeout from configuration - treat <0 as maximum timeout if corrected_timeout < 0: corrected_timeout = sys.maxint num_cpus = min(psutil.NUM_CPUS, 4) corrected_timeout = int(corrected_timeout / float(num_cpus) * 4.0) self.runtests.timeout = corrected_timeout # freeze the values self.freeze() cfg = FunctionalConfig() from nose import core core.main()
#!/usr/bin/env python """Nose-based test runner. """ from __future__ import print_function from nose.core import main from nose.plugins.builtin import plugins from nose.plugins.doctests import Doctest from . import ipdoctest from .ipdoctest import IPDocTestRunner if __name__ == '__main__': print('WARNING: this code is incomplete!') print() pp = [x() for x in plugins] # activate all builtin plugins first main(testRunner=IPDocTestRunner(), plugins=pp + [ipdoctest.IPythonDoctest(), Doctest()])
def test_checkout_package_nobranch(): rep = connect(repo_url) rep.useBranches = True olddir = os.getcwd() workdir = mkdtemp() def check(d): return exists(join(workdir, d)) try: # tag rep.checkout('Hat/NoBranch', 'v1r9', dest=workdir) assert all( map(check, [ 'Hat/NoBranch/cmt/requirements', 'Hat/NoBranch/cmt/version.cmt' ])) assert open(join( workdir, 'Hat/NoBranch/cmt/version.cmt')).read().strip() == 'v1r9' finally: os.chdir(olddir) rmtree(workdir, ignore_errors=True) if __name__ == '__main__': from nose.core import main main(defaultTest=os.path.dirname(__file__), argv=['nosetests', '-v', '--with-coverage'])
"""a decoy python script that can be run like `python nosepassthru.py` to test using an executable chain""" if __name__ == '__main__': from nose.core import main main()
class EasySeleniumPlugin(Plugin): name = 'easyselenium' enabled = False def __init__(self): Plugin.__init__(self) def help(self): return 'Easy Selenium plugin for Nose - allows to specify ' \ 'browser that tests will be executed with.' def options(self, parser, env): browsers = Browser.get_supported_browsers() parser.add_option('-b', '--browser', help="Specify browser by using initials. " \ "If value was not passed then 'ff' will be used. " \ "Supported choices: %s" % browsers, choices=browsers) Plugin.options(self, parser, env) def configure(self, options, conf): if options.browser: Browser.DEFAULT_BROWSER = options.browser return Plugin.configure(self, options, conf) if __name__ == '__main__': main(addplugins=[EasySeleniumPlugin()])
def run_tests(): print("foo") main()
class EasySeleniumPlugin(Plugin): name = 'easyselenium' enabled = False def __init__(self): Plugin.__init__(self) def help(self): return 'Easy Selenium plugin for Nose - allows to specify ' \ 'browser that tests will be executed with.' def options(self, parser, env): browsers = Browser.get_supported_browsers() parser.add_option('-b', '--browser', help="Specify browser by using initials. " "If value was not passed then 'ff' will be used. " "Supported choices: %s" % browsers, choices=browsers) Plugin.options(self, parser, env) def configure(self, options, conf): if options.browser: Browser.DEFAULT_BROWSER = options.browser return Plugin.configure(self, options, conf) if __name__ == '__main__': main(addplugins=[EasySeleniumPlugin()])