Esempio n. 1
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)
Esempio n. 2
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='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)
Esempio n. 3
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()
Esempio n. 4
0
    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()
Esempio n. 5
0
    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()
Esempio n. 6
0
    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()
Esempio n. 7
0
    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()
Esempio n. 8
0
    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)
Esempio n. 9
0
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')
Esempio n. 10
0
def runtests(**params):
    import pulsar
    from pulsar.apps.test import TestSuite
    from pulsar.apps.test.plugins import bench, profile
    import pulsar.utils.settings.backend
    #
    TestSuite(description='Pulsar Asynchronous test suite',
              modules=('tests',
                       ('examples', 'tests'),
                       ('examples', 'test_*')),
              plugins=(bench.BenchMark(),
                       profile.Profile()),
              pidfile='test.pid',
              **params).start()
Esempio n. 11
0
def runtests(**params):
    from pulsar.apps.test import TestSuite
    from pulsar.apps.test.plugins import bench, profile
    import pulsar.utils.settings.backend  # noqa

    djangopath = os.path.join(os.path.dirname(__file__), 'examples', 'djchat')
    if djangopath not in sys.path:
        sys.path.append(djangopath)
    #
    TestSuite(description='Pulsar Asynchronous test suite',
              modules=('tests', ('examples', 'tests'), ('examples', 'test_*')),
              plugins=(bench.BenchMark(), profile.Profile()),
              pidfile='test.pid',
              **params).start()
Esempio n. 12
0
def runtests(**params):
    import lux
    suite = TestSuite(description='Lux Asynchronous test suite',
                      version=lux.__version__,
                      modules=['tests'],
                      plugins=(bench.BenchMark(),
                               profile.Profile()),
                      pidfile='test.pid',
                      **params).start()
    #
    if suite.cfg.coveralls:
        from pulsar.utils.cov import coveralls
        coveralls(strip_dirs=strip_dirs,
                  stream=suite.stream,
                  repo_token='CNw6W9flYDDXZYeStmR1FX9F4vo0MKnyX')
Esempio n. 13
0
def runtests():
    from pulsar.apps.test import TestSuite
    from pulsar.apps.test.plugins import bench, profile

    args = sys.argv
    if '--coveralls' in args:
        import lux
        from pulsar.utils.path import Path
        from pulsar.apps.test.cov import coveralls

        repo_token = None
        strip_dirs = [Path(lux.__file__).parent.parent, os.getcwd()]
        if os.path.isfile('.coveralls-repo-token'):
            with open('.coveralls-repo-token') as f:
                repo_token = f.read().strip()
        coveralls(strip_dirs=strip_dirs, repo_token=repo_token)
        sys.exit(0)
    #
    TestSuite(description='Lux Asynchronous test suite',
              modules=['tests'],
              test_timeout=30,
              thread_workers=2,
              plugins=(bench.BenchMark(), profile.Profile())).start()
Esempio n. 14
0
def runtests(cov=None, **params):
    import pulsar
    from pulsar.utils.path import Path
    from pulsar.apps.test import TestSuite
    from pulsar.apps.test.plugins import bench, profile
    import pulsar.utils.settings.backend
    #
    path = Path(__file__)
    path.add2python('stdnet', 1, down=['python-stdnet'], must_exist=False)
    strip_dirs = [Path(pulsar.__file__).parent.parent, os.getcwd()]
    #
    suite = TestSuite(description='Pulsar Asynchronous test suite',
                      modules=('tests', ('examples', 'tests'), ('examples',
                                                                'test_*')),
                      plugins=(bench.BenchMark(), profile.Profile()),
                      pidfile='test.pid',
                      **params).start()
    #
    if suite.cfg.coveralls:
        from pulsar.utils.cov import coveralls
        coveralls(strip_dirs=strip_dirs,
                  stream=suite.stream,
                  repo_token='CNw6W9flYDDXZYeStmR1FX9F4vo0MKnyX')
Esempio n. 15
0
def run():
    from pulsar.apps.test import TestSuite
    from pulsar.apps.test.plugins import bench, profile

    args = sys.argv
    if '--coveralls' in args:
        import cloud
        from pulsar.utils.path import Path
        from pulsar.apps.test.cov import coveralls

        repo_token = None
        strip_dirs = [Path(cloud.__file__).parent.parent, os.getcwd()]
        if os.path.isfile('.coveralls-repo-token'):
            with open('.coveralls-repo-token') as f:
                repo_token = f.read().strip()
        coveralls(strip_dirs=strip_dirs, repo_token=repo_token)
        sys.exit(0)
    # Run the test suite
    #
    TestSuite(description='pulsar-pusher asynchronous test suite',
              modules=['tests'],
              plugins=(bench.BenchMark(), profile.Profile()),
              test_timeout=30,
              config='config.py').start()
Esempio n. 16
0
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')
Esempio n. 17
0
 def test_profile_plugins(self):
     suite = TestSuite(plugins=[profile.Profile()])
     self.assertTrue(suite.cfg.plugins)
     self.assertTrue('profile' in suite.cfg.settings)
     self.assertTrue('profile_stats_path' in suite.cfg.settings)
Esempio n. 18
0
 def test_no_plugins(self):
     suite = TestSuite(test_plugins=[])
     self.assertFalse(suite.cfg.test_plugins)
     self.assertFalse('profile' in suite.cfg.settings)
Esempio n. 19
0
if __name__ == '__main__':
    from pulsar.apps.test import TestSuite
    test_suite = TestSuite(test_modules=('tests', 'examples'))
    test_suite.start()
Esempio n. 20
0
from stdnet.utils import PPath
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()