def start(): global pulsar argv = sys.argv if len(argv) > 1 and argv[1] == 'nose': pulsar = None sys.argv.pop(1) if pulsar: from pulsar.apps.test import TestSuite from pulsar.apps.test.plugins import bench, profile os.environ['stdnet_test_suite'] = 'pulsar' suite = TestSuite( description='Stdnet Asynchronous test suite', modules=('tests.py',), plugins=(test.StdnetPlugin(), bench.BenchMark(), profile.Profile()) ) suite.start() elif nose: from stdnet.utils.test import NoseStdnetServer os.environ['stdnet_test_suite'] = 'nose' argv = list(sys.argv) noseoption(argv, '-w', value = 'tests/regression') noseoption(argv, '--all-modules') nose.main(argv=argv, addplugins=[NoseStdnetServer()]) else: print('To run tests you need either pulsar or nose.') exit(0)
def start(): global pulsar argv = sys.argv if len(argv) > 1 and argv[1] == 'nose': pulsar = None sys.argv.pop(1) if pulsar: from pulsar.apps.test import TestSuite from pulsar.apps.test.plugins import bench, profile os.environ['stdnet_test_suite'] = 'pulsar' suite = TestSuite(description='Dynts Asynchronous test suite', plugins=( profile.Profile(), bench.BenchMark(), )) suite.start() elif nose: os.environ['stdnet_test_suite'] = 'nose' argv = list(sys.argv) noseoption(argv, '-w', value='tests/regression') noseoption(argv, '--all-modules') nose.main(argv=argv, addplugins=[NoseHttpProxy()]) else: print('To run tests you need either pulsar or nose.') exit(0)
def start(argv=None, modules=None, nose_options=None, description=None, version=None, plugins=None): '''Start djpcms tests. Use this function to start tests for djpcms aor djpcms applications. It check for pulsar and nose and add testing plugins.''' use_nose = False argv = argv or sys.argv description = description or 'Djpcms Asynchronous test suite' version = version or djpcms.__version__ if len(argv) > 1 and argv[1] == 'nose': use_nose = True sys.argv.pop(1) if use_nose: os.environ['djpcms_test_suite'] = 'nose' if stdnet_test and plugins is None: plugins = [stdnet_test.NoseStdnetServer()] argv = list(argv) if nose_options: nose_options(argv) nose.main(argv=argv, addplugins=plugins) else: os.environ['djpcms_test_suite'] = 'pulsar' from pulsar.apps.test import TestSuite from pulsar.apps.test.plugins import bench, profile if stdnet_test and plugins is None: plugins = (stdnet_test.PulsarStdnetServer(), bench.BenchMark(), profile.Profile()) suite = TestSuite(modules=modules, plugins=plugins, description=description, version=version) suite.start()
def run_tests(self): if self.coverage and self.start_coverage: import coverage p = current_process() p._coverage = coverage.Coverage(data_suffix=True) coverage.process_startup() p._coverage.start() from pulsar.apps.test import TestSuite params = self.get_test_parameters() test_suite = TestSuite(argv=self.test_args, **params) test_suite.start()
def run_tests(self): if self.coverage and self.start_coverage: import coverage from coverage.monkey import patch_multiprocessing p = current_process() p._coverage = coverage.Coverage(data_suffix=True) patch_multiprocessing() p._coverage.start() from pulsar.apps.test import TestSuite test_suite = TestSuite(verbosity=self.verbose+1, argv=self.test_args, **self.test_params) test_suite.start()
def run_tests(self): if self.coverage and self.start_coverage: import coverage from coverage.monkey import patch_multiprocessing p = current_process() p._coverage = coverage.Coverage(data_suffix=True) patch_multiprocessing() p._coverage.start() from pulsar.apps.test import TestSuite test_suite = TestSuite(verbosity=self.verbose + 1, argv=self.test_args, **self.test_params) test_suite.start()
def runtests(**params): import stdnet from stdnet.utils import test # strip_dirs = [Path(stdnet.__file__).parent.parent, os.getcwd()] # suite = TestSuite(description='Stdnet Asynchronous test suite', modules=('tests.all', ), plugins=(test.StdnetPlugin(), bench.BenchMark(), profile.Profile()), **params) suite.bind_event('tests', test.create_tests) suite.start() # if suite.cfg.coveralls: from pulsar.utils.cov import coveralls coveralls(strip_dirs=strip_dirs, stream=suite.stream, repo_token='ZQinNe5XNbzQ44xYGTljP8R89jrQ5xTKB')
def runtests(**params): import stdnet from stdnet.utils import test # strip_dirs = [Path(stdnet.__file__).parent.parent, os.getcwd()] # suite = TestSuite(description='Stdnet Asynchronous test suite', modules=('tests.all',), plugins=(test.StdnetPlugin(), bench.BenchMark(), profile.Profile()), **params) suite.bind_event('tests', test.create_tests) suite.start() # if suite.cfg.coveralls: from pulsar.utils.cov import coveralls coveralls(strip_dirs=strip_dirs, stream=suite.stream, repo_token='ZQinNe5XNbzQ44xYGTljP8R89jrQ5xTKB')
def run_tests(self): if self.coverage: import coverage from coverage.monkey import patch_multiprocessing print('Collect coverage') p = current_process() p._coverage = coverage.Coverage(data_suffix=True) patch_multiprocessing() p._coverage.start() from pulsar.apps.test import TestSuite test_suite = TestSuite(list_labels=self.list_labels, verbosity=self.verbose+1, coverage=self.coverage, argv=self.test_args) self.result_code = test_suite.start(exit=False)
if __name__ == '__main__': from pulsar.apps.test import TestSuite test_suite = TestSuite(test_modules=('tests', 'examples')) test_suite.start()
p = PPath(__file__) p.add(module = 'pulsar', up = 1, down = ('pulsar',)) from pulsar.apps.test import TestSuite, TestOptionPlugin from pulsar.apps.test.plugins import bench class TestServer(TestOptionPlugin): name = "server" flags = ["-s", "--server"] desc = 'Backend server where to run tests.' default = settings.DEFAULT_BACKEND def configure(self, cfg): settings.DEFAULT_BACKEND = cfg.server class TestDataSize(TestOptionPlugin): name = "size" flags = ["--size"] desc = 'Size of the dataset to test. Choose one between "tiny", "small",\ "normal", "big", "huge".' default = 'small' if __name__ == '__main__': suite = TestSuite(description = 'Stdnet Asynchronous test suite', modules = ('tests','stdnet.apps'), plugins = (TestServer(),bench.BenchMark(),) ) suite.start()