示例#1
0
 def run_tests(self):
     # Run nose ensuring that argv simulates running nosetests directly
     argv = ['nosetests']
     if self.test_suite != 'all':
         argv.append('tests/tests.py:' + self.test_suite)
     import nose
     nose.run_exit(argv=argv)
示例#2
0
def unit(args, nose_run_kwargs=None):
    """ Run unittests """
    import os, sys
    from os.path import join, dirname, abspath
    
    test_project_module = "testproject"
    
    sys.path.insert(0, abspath(join(dirname(__file__), test_project_module)))
    sys.path.insert(0, abspath(dirname(__file__)))
    
    os.environ['DJANGO_SETTINGS_MODULE'] = "%s.settings" % test_project_module
    
    import nose

    os.chdir(test_project_module)

    argv = ["--with-django", "--with-cherrypyliveserver", "--with-selenium"] + args

    nose_run_kwargs = nose_run_kwargs or {}

    nose.run_exit(
        argv = ["nosetests"] + argv,
        defaultTest = test_project_module,
        **nose_run_kwargs
    )
示例#3
0
def main(argv=None):
    if argv is None:
        argv = ['nosetests', '--cover-erase', '--with-coverage',
                '--cover-package=fds.log_scraper']

    nose.run_exit(argv=argv,
                  defaultTest=os.path.join(os.path.dirname(__file__), 'tests'))
示例#4
0
文件: setup.py 项目: kdmurray91/mpg
 def run_tests(self):
     # Run nose ensuring that argv simulates running nosetests directly
     try:
         import nose
         nose.run_exit(argv=['nosetests'])
     except ImportError:
         pass
示例#5
0
 def run_tests(self):
     # Run nose ensuring that argv simulates running nosetests directly
     ret = subprocess.call([sys.executable, sys.argv[0], 'build_ext', '-i'])
     if ret != 0:
         raise RuntimeError("Building failed!")
     import nose
     nose.run_exit(argv=['nosetests'])
示例#6
0
def integrate(args):
    from citools.pavement import djangonize_test_environment
    test_project_module="example_project"

    args.extend(['--with-selenium', '--with-cherrypyliveserver', '--with-django', '--with-mongo-database'])

    djangonize_test_environment(test_project_module)

    import nose

    os.chdir(join(options.rootdir, "tests", test_project_module))

    from django.conf import settings
    from djangosanetesting.utils import get_live_server_path, DEFAULT_URL_ROOT_SERVER_ADDRESS

    settings.BUILDMASTER_NETWORK_NAME = getattr(settings, "URL_ROOT_SERVER_ADDRESS", DEFAULT_URL_ROOT_SERVER_ADDRESS)

    settings.NETWORK_NAME = get_live_server_path() + "/"


    nose.run_exit(
        argv = ["nosetests"] + args,
        defaultTest = test_project_module,
        addplugins = [get_plugin()]
    )
示例#7
0
def run_all():
    logging.debug('Running tests with arguments: %r' % sys.argv)

    nose.run_exit(
        argv=argv,
        config=CONFIG,
        addplugins=extra_plugins,
    )
示例#8
0
 def run_tests(self):
     # Run nose ensuring that argv simulates running nosetests directly
     import nose
     nose.run_exit(argv=['nosetests',
                         '--with-coverage',
                         '--cover-erase',
                         '--cover-branches',
                         '--cover-package=pbxproj',
                         '-w', 'tests'])
示例#9
0
def run_openmdao_suite():
    """This function is exported as a script that is runnable as part of
    an OpenMDAO virtual environment as openmdao_test.
    
    This function wraps nosetests, so any valid nose args should also
    work here.
    """
    
    #Add any default packages/directories to search for tests to tlist.
    tlist = ['openmdao']
    
    break_check = ['--help', '-h', '--all']
    
    covpkg = False # if True, --cover-package was specified by the user
    
    # check for args not starting with '-'
    args = sys.argv
    for i, arg in enumerate(args):
        if arg.startswith('--cover-package'):
            covpkg = True
        if (i>0 and not arg.startswith('-')) or arg in break_check:
            break
    else:  # no non '-' args, so assume they want to run the whole test suite
        args.append('--all')
        
    args.append('--exe') # by default, nose will skip any .py files that are
                         # executable. --exe prevents this behavior
    
    if '--with-coverage' in args:
        args.append('--cover-erase')
        if '--all' in args and not covpkg:
            for pkg in tlist:
                opt = '--cover-package=%s' % pkg
                if opt not in args:
                    args.append(opt)

            # Better coverage if we clobber cached data.
            base = os.path.expanduser(os.path.join('~', '.openmdao'))
            for name in ('eggsaver.dat', 'keys'):
                path = os.path.join(base, name)
                if os.path.exists(path):
                    os.remove(path)

    # this tells it to enable the console in the environment so that
    # the logger will print output to stdout. This helps greatly when 
    # debugging openmdao scripts running in separate processes.
    if '--enable_console' in args:
        args.remove('--enable_console')
        os.environ['OPENMDAO_ENABLE_CONSOLE'] = '1'

    if '--all' in args:
        args.remove('--all')
        args.extend(tlist)
        
    nose.run_exit(argv=args)
def start(argv=None):
    sys.exitfunc = lambda: sys.stderr.write("Shutting down...\n")

    if argv is None:
        argv = [
            "nosetests", "--cover-branches", "--with-coverage",
            "--cover-erase", "--verbose",
            "--cover-package=django_foobar",
        ]

    nose.run_exit(argv=argv, defaultTest=os.path.abspath(os.path.dirname(__file__)))
示例#11
0
def run_tests(test_project_module, nose_args, nose_run_kwargs=None):
    djangonize_test_environment(test_project_module)

    import nose

    os.chdir(join(options.rootdir, "tests", test_project_module))

    argv = ["--with-django"] + nose_args

    nose_run_kwargs = nose_run_kwargs or {}

    nose.run_exit(argv=["nosetests"] + argv, defaultTest=test_project_module, **nose_run_kwargs)
示例#12
0
def integrate_project(args):
    """ Run integration tests """
    
    djangonize_test_environment(options.project_module)

    os.chdir(join(options.rootdir, "tests"))

    import nose

    nose.run_exit(
        argv = ["nosetests", "--with-django", "--with-selenium", "--with-djangoliveserver"]+args
    )
示例#13
0
def run_all():
    argv = [
        "nosetests",
        "--nocapture",
        "--nologcapture",
        "--with-coverage",
        "--cover-package=ella_attachments",
        "--cover-erase",
        "--with-xunit",
    ]

    nose.run_exit(argv=argv, defaultTest=abspath(dirname(__file__)))
示例#14
0
def run_all(args=None):
    if not args:
        args = [
            'nosetests', '--with-xunit', '--with-xcoverage',
            '--cover-package=openformats', '--cover-erase',
            '--logging-filter=openformats', '--logging-level=DEBUG',
            '--verbose',
        ]

    nose.run_exit(
        argv=args,
        defaultTest=abspath(dirname(__file__))
    )
示例#15
0
def run_all(argv=None):
    if argv is None:
        argv = [
            'nosetests',
            '--with-coverage', '--cover-package=ella', '--cover-erase',
            '--nocapture', '--nologcapture',
            '--verbose',
        ]

    nose.run_exit(
        argv=argv,
        defaultTest=abspath(dirname(__file__)),
    )
示例#16
0
文件: runner.py 项目: predicthq/rfhq
def run_all(argv=None):
    # always insert coverage when running tests
    if argv is None:
        argv = [
            'nosetests',
            '--with-coverage', '--cover-package=rfhq', '--cover-erase',
            '--verbose',
        ]

    nose.run_exit(
        argv=argv,
        defaultTest=abspath(dirname(__file__))
    )
示例#17
0
def integrate_project(args):
    """ Run integration tests """
    from citools.pavement import djangonize_test_environment

    djangonize_test_environment(options.project_module)

    chdir(join(options.rootdir, "tests", "integration"))

    import nose

    nose.run_exit(
        argv = ["nosetests", "--with-django", "--with-selenium", "--with-djangoliveserver", "-w", join(options.rootdir, "tests", "integration")]+args,
    )
示例#18
0
def run_all(argv=None):
    sys.exitfunc = lambda: sys.stderr.write('Shutting down....\n')

    # always insert coverage when running tests through setup.py
    if argv is None:
        argv = [
            'nosetests', '--with-coverage', '--cover-package=haystack',
            '--cover-erase', '--verbose',
        ]

    nose.run_exit(
        argv=argv,
        defaultTest=abspath(dirname(__file__))
    )
示例#19
0
def run_all(argv=None):
    os.environ['DJANGO_SETTINGS_MODULE'] = 'test_ella_comments.settings'

    if argv is None:
        argv = [
            'nosetests',
            '--with-coverage', '--cover-package=ella_comments', '--cover-erase',
            '--nocapture', '--nologcapture',
            '--verbose',
        ]

    nose.run_exit(
        argv=argv,
        defaultTest=abspath(dirname(__file__)),
    )
示例#20
0
def start(argv=None):
    sys.exitfunc = lambda: sys.stderr.write('Shutting down...\n')

    if argv is None:
        argv = [
            'nosetests',
            '--verbose',
            '--with-coverage',
            '--cover-html', '--cover-html-dir=.htmlcov',
            '--cover-erase',
            '--cover-branches',
            '--cover-package=hesab',
        ]

    nose.run_exit(argv=argv, defaultTest=os.path.abspath(os.path.dirname(__file__)))
示例#21
0
def run_all(argv=None):
    sys.exitfunc = lambda msg='Process shutting down...': sys.stderr.write(msg + '\n')

    if argv is None:
        argv = [
            'nosetests',
            '--with-coverage', '--cover-package=ella_galleries', '--cover-erase',
            '--nocapture', '--nologcapture',
            '--verbose',
        ]

    nose.run_exit(
        argv=argv,
        defaultTest=abspath(dirname(__file__)),
    )
示例#22
0
def run_all(argv=None):

    os.environ["DJANGO_SETTINGS_MODULE"] = "tests.settings"
    sys.exitfunc = lambda msg="Process shutting down...": sys.stderr.write(msg + "\n")

    # called by setuptools
    params = ["--with-coverage", "--cover-package=entree", "--cover-erase", "--with-xunit"]
    if argv is None:
        argv = ["nosetests"] + params
    elif len(argv) == 1:  # only the command itself is in argv
        argv += params
    elif len(argv) > 1:
        argv = [argv[0]] + params + argv[1:]

    nose.run_exit(argv=argv, defaultTest=abspath(dirname(__file__)))
示例#23
0
def run_all(argv=None):
    sys.exitfunc = lambda msg="Process shutting down...": sys.stderr.write(msg + "\n")

    if argv is None:
        argv = [
            "nosetests",
            "--with-coverage",
            "--cover-package=ella_taggit",
            "--cover-erase",
            "--nocapture",
            "--nologcapture",
            "--verbose",
        ]

    nose.run_exit(argv=argv, defaultTest=abspath(dirname(__file__)))
示例#24
0
    def run_tests(self):
        build_path = assert_required_environment_variable('NORDICSEMI_NRF51_BLE_DRIVER_BUILD_PATH')
        import nose

        zip_content_test_report_dir = posixpath.join(build_path, 'test_reports')
        zip_content_test_report_file = posixpath.join(zip_content_test_report_dir, 'zip_content.xml')

        if not os.path.exists(zip_content_test_report_dir):
            print("Directory {} does not exist. Creating it.".format(zip_content_test_report_dir))
            os.mkdir(zip_content_test_report_dir)

        nose.run_exit(argv=['nosetests',
                            '--where={0}'.format(os.path.join(setup_py_path, 'zip_content')),
                            '--with-xunit',
                            '--xunit-file={0}'.format(zip_content_test_report_file),
                            '--nocapture'])
示例#25
0
def run_all(argv=None):
    sys.exitfunc = lambda: sys.stderr.write('Shutting down....\n')

    # always insert coverage when running tests through setup.py
    if argv is None:
        argv = [
            'nosetests', '--with-xunit',
            '--logging-format=%(levelname)s %(name)22s %(funcName)22s:%(lineno)-4d %(message)s',
            '--with-xcoverage', '--cover-package=curator', '--cover-erase',
            '--verbose',
        ]

    nose.run_exit(
        argv=argv,
        defaultTest=abspath(dirname(__file__))
    )
示例#26
0
文件: runner.py 项目: cpaulik/cis
def run(test_set='cis/test/unit', n_processors=1, stop=False, debug=False):
    import nose
    import logging
    import sys

    if debug:
        logging.basicConfig(level=logging.DEBUG,
                            format="%(asctime)s - %(levelname)s - %(module)s : %(lineno)d - %(message)s",
                            stream=sys.stdout)

    args = ['', test_set, '--processes=%s' % n_processors, '--verbosity=2']

    if stop:
        args.append('--stop')

    nose.run_exit(argv=args)
def run_all(argv=None):

    if argv is None:
        argv = [
            'nosetests',
            '--with-coverage', '--cover-package=supervisorwildcards', '--cover-erase',
            '--nocapture', '--nologcapture', '--verbose',
        ]
    else:
        for p in ('--with-coverage', '--cover-package=dashvisor', '--cover-erase'):
            if p not in argv:
                argv.append(p)

    nose.run_exit(
        argv=argv,
        defaultTest=path.abspath(path.dirname(__file__))
    )
示例#28
0
文件: runtests.py 项目: voy/bbnotify
def run_all():
    base = path.abspath(path.join(path.dirname(__file__), path.pardir))

    # hack pythonpath to contain dir to load proper module for testing
    oldpath = sys.path[:]
    if base in sys.path:
        sys.path.remove(base)
    sys.path.insert(0, base)

    # hack with argv if we are called from setup.py
    argv = sys.argv[:]
    if 'setup.py' in argv[0] and len(argv) >= 2 and argv[1] == 'test':
        argv = [argv[0]] + argv[2:]
    oldargv = sys.argv[:]
    sys.argv = argv

    nose.run_exit(defaultTest=base)
def run_all(argv=None):
    sys.exitfunc = lambda: sys.stderr.write('Shutting down....\n')

    # fetch elasticsearch
    # always insert coverage when running tests
    if argv is None:
        argv = [
            'nosetests', '--with-xunit',
            '--with-xcoverage', '--cover-package=elasticsearch_tornado',
            '--cover-erase', '--logging-filter=elasticsearch',
            '--logging-level=DEBUG', '--verbose',
        ]

    nose.run_exit(
        argv=argv,
        defaultTest=abspath(dirname(__file__))
    )
示例#30
0
def run_all(argv=None):
    os.environ['DJANGO_SETTINGS_MODULE'] = 'test_ella.settings'

    # called by setuptools
    if argv is None:
        argv = ['nosetests']

    if len(argv) == 1:  # only the command itself is in argv
        argv += [
            '--with-coverage', '--cover-package=ella', '--cover-erase',
            '--with-xunit',
        ]

    nose.run_exit(
        argv=argv,
        defaultTest=abspath(dirname(__file__)),
    )
示例#31
0
 def run_tests(self):
     """
     Run the test suite using nose.
     """
     import nose
     nose.run_exit(argv=['nosetests'])
示例#32
0
def main(argv=None):
    if argv is None:
        argv = ["nosetests"]
    path = os.path.abspath(os.path.dirname(__file__))
    nose.run_exit(argv=argv, defaultTest=path)
示例#33
0
import re
import sys

from nose import run_exit

if __name__ == '__main__':
    # We try to use the reactor that does not use 'select' or '*poll' to
    # avoid hitting Twisted bug that causes the reactor to wait on
    # cancelled delayed calls when all delayed calls are cancelled.
    try:
        from twisted.internet import glib2reactor as reactor
    except ImportError:
        from twisted.internet import selectreactor as reactor

    reactor.install()

    # Shameless copypaste from nosetests.py, for complete compatibility
    # of command line arguments
    sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
    sys.exit(run_exit())
示例#34
0
    Requires Nose. Try:

        $ sudo easy_install nose

    Exiting. """, file=stderr)
        exit(1)


    if '--with-coverage' in argv:
        try:
            import coverage
        except ImportError:
            print("No coverage module found, skipping code coverage.", file=stderr)
            argv.remove('--with-coverage')
        else:
            NOSE_ARGS += COVERAGE_EXTRA_ARGS


    if True not in [a.startswith('-a') or a.startswith('--attr=') for a in argv]:
        argv.append('--attr=' + ','.join(DEFAULT_ATTRS))

    if not [a for a in argv[1:] if not a.startswith('-')]:
        argv += DEFAULT_DIRS  # since nose doesn't look here by default..

    if not [a for a in argv if a.startswith('--where=')]:
        argv += [DEFAULT_LOCATION]

    finalArgs = argv + NOSE_ARGS
    print("Running nose with:", " ".join(finalArgs[1:]))
    nose.run_exit(argv=finalArgs)
示例#35
0
 def run_tests(self):
     # Run nose ensuring that argv simulates running nosetests directly
     import nose
     nose.run_exit(
         argv=["nosetests", "--with-coverage", "--cover-package=pycaching"])
示例#36
0
 def run_tests(self):
     import nose
     nose.run_exit(argv=["nosetests"])
示例#37
0
from os.path import join, pardir, abspath, dirname, split

import nose

# django settings module
DJANGO_SETTINGS_MODULE = '%s.%s' % (split(abspath(
    dirname(__file__)))[1], 'settings')
# pythonpath dirs
PYTHONPATH = [
    abspath(join(dirname(__file__), pardir, pardir)),
    abspath(join(dirname(__file__), pardir)),
]

# inject few paths to pythonpath
for p in PYTHONPATH:
    if p not in sys.path:
        sys.path.insert(0, p)

# django needs this env variable
os.environ['DJANGO_SETTINGS_MODULE'] = DJANGO_SETTINGS_MODULE

# TODO: ugly hack to inject django plugin to nose.run

# also, this is our all-suite, not just unittest one

for i in ['--with-django', '--with-djangoliveserver']:
    if i not in sys.argv:
        sys.argv.insert(1, i)

nose.run_exit(defaultTest=dirname(__file__), )
示例#38
0
 def run_tests(self):
     # Run nose ensuring that argv simulates running nosetests directly
     import nose
     nose.run_exit(argv=['nosetests'])
示例#39
0
#!/usr/bin/env python
import nose
nose.run_exit(argv=["-v", "-w", "tests/integration_tests", "-s"])
示例#40
0
文件: run_tests.py 项目: krtek/gap
def run_all():
    logging.debug('Running tests with arguments: %r' % sys.argv)

    nose.run_exit(
        config = CONFIG
    )
示例#41
0
def run_openmdao_suite(argv=None):
    """This function is exported as a script that is runnable as part of
    an OpenMDAO virtual environment as openmdao test.
    
    This function wraps nosetests, so any valid nose args should also
    work here.
    """
    if argv is None:
        argv = sys.argv

    #Add any default packages/directories to search for tests to tlist.
    tlist = _get_openmdao_packages()

    break_check = ['--help', '-h', '--all']

    covpkg = False  # if True, --cover-package was specified by the user

    # check for args not starting with '-'
    args = argv[:]
    for i, arg in enumerate(args):
        if arg.startswith('--cover-package'):
            covpkg = True
        if (i > 0 and not arg.startswith('-')) or arg in break_check:
            break
    else:  # no non '-' args, so assume they want to run the default test suite
        # in a release install, default is the set of tests specified in release_tests.cfg
        if not is_dev_install() or '--small' in args:
            if '--small' in args:
                args.remove('--small')
            args.extend([
                '-c',
                os.path.join(os.path.dirname(__file__), 'release_tests.cfg')
            ])
        else:  # in a dev install, default is all tests
            args.append('--all')

    args.append('--exe')  # by default, nose will skip any .py files that are
    # executable. --exe prevents this behavior

    # Clobber cached data in case Python environment has changed.
    base = os.path.expanduser(os.path.join('~', '.openmdao'))
    for name in ('eggsaver.dat', 'fileanalyzer.dat'):
        path = os.path.join(base, name)
        if os.path.exists(path):
            os.remove(path)

    # Avoid having any user-defined resources causing problems during testing.
    ResourceAllocationManager.configure('')

    if '--with-coverage' in args:
        args.append('--cover-erase')
        if '--all' in args and not covpkg:
            for pkg in tlist:
                opt = '--cover-package=%s' % pkg
                if opt not in args:
                    args.append(opt)

            # Better coverage if we clobber credential data.
            path = os.path.join(base, 'keys')
            if os.path.exists(path):
                os.remove(path)

    # this tells it to enable the console in the environment so that
    # the logger will print output to stdout. This helps greatly when
    # debugging openmdao scripts running in separate processes.
    if '--enable_console' in args:
        args.remove('--enable_console')
        os.environ['OPENMDAO_ENABLE_CONSOLE'] = '1'

    if '--all' in args:
        args.remove('--all')
        args.extend(tlist)

    if '--plugins' in args:
        args.remove('--plugins')
        from openmdao.main.plugin import plugin_install, _get_plugin_parser
        argv = ['install', '--all']
        parser = _get_plugin_parser()
        options, argz = parser.parse_known_args(argv)
        plugin_install(parser, options, argz)

    # The default action should be to run the GUI functional tests.
    # The 'win32' test here is to allow easily changing the default for Windows
    # where testing still has occasional problems not terminating on EC2.
    if sys.platform == 'win32':
        do_gui_tests = False
    else:
        do_gui_tests = True

    # run GUI functional tests, overriding default action
    if '--gui' in args:
        args.remove('--gui')
        do_gui_tests = True

    # skip GUI functional tests, overriding default action
    if '--skip-gui' in args:
        args.remove('--skip-gui')
        do_gui_tests = False

    if not do_gui_tests:
        os.environ['OPENMDAO_SKIP_GUI'] = '1'

    # some libs we use call multiprocessing.cpu_count() on import, which can
    # raise NotImplementedError, so try to monkeypatch it here to return 1 if
    # that's the case
    try:
        import multiprocessing
        multiprocessing.cpu_count()
    except ImportError:
        pass
    except NotImplementedError:
        multiprocessing.cpu_count = lambda: 1


#    _trace_atexit()
    nose.run_exit(argv=args)
if __name__ == "__main__":
    with open("rc_stdout.log", "w") as rc_stdout:
        with open("rc_stderr.log", "w") as rc_stderr:
            rc_process = start_rc(rc_stdout, rc_stderr)
            try:
                wait_until_rc_is_ready()
                args = [
                    __file__,
                    "-v",
                    "--with-xunit",
                    "--with-coverage",
                    "--cover-xml",
                    "--cover-package=hazelcast",
                    "--cover-inclusive",
                    "--nologcapture",
                ]

                enterprise_key = os.environ.get("HAZELCAST_ENTERPRISE_KEY",
                                                None)
                if not enterprise_key:
                    args.extend(["-A", "not enterprise"])

                return_code = nose.run_exit(argv=args)
                rc_process.kill()
                rc_process.wait()
                sys.exit(return_code)
            except:
                rc_process.kill()
                rc_process.wait()
                raise
示例#43
0
 def run_tests(self):
     # Run nose ensuring that argv simulates running nosetests directly
     import nose
     import os
     os.environ['COVERAGE_PROCESS_START'] = '.coveragerc'
     nose.run_exit(argv=['nosetests'])
示例#44
0
 def run_tests(self):
     import nose
     nose.run_exit(argv=['nosetests'])
"""
Assumes file is called as follows
"blender --background --factory-startup --python blender-nosetests.py ... ... ... ..."

Useful additional params:
-s : stdout is not captured by default, eg print().
--with-xunit, --with-coverage 
"""

import os
import site  # for fedora: get site-packages into sys.path so it finds nose
import sys

# Nose internally uses sys.argv for paramslist, prune extras params from chain, add name param
sys.argv = ['blender-nosetests'] + sys.argv[6:]

import nose
nose.run_exit()
示例#46
0
def run_openmdao_suite(argv=None):
    """This function is exported as a script that is runnable as part of
    an OpenMDAO virtual environment as openmdao test.

    This function wraps nosetests, so any valid nose args should also
    work here.
    """
    if argv is None:
        argv = sys.argv

    #Add any default packages/directories to search for tests to tlist.
    tlist = _get_openmdao_packages()

    break_check = ['--help', '-h', '--all']

    covpkg = False  # if True, --cover-package was specified by the user

    # check for args not starting with '-'
    args = argv[:]
    for i, arg in enumerate(args):
        if arg.startswith('--cover-package'):
            covpkg = True
        if (i > 0 and not arg.startswith('-')) or arg in break_check:
            break
    else:
        args.append("--all")

    args.append('--exe')  # by default, nose will skip any .py files that are
    # executable. --exe prevents this behavior

    # Clobber cached data in case Python environment has changed.
    base = os.path.expanduser(os.path.join('~', '.openmdao'))
    for name in ('eggsaver.dat', 'fileanalyzer.dat'):
        path = os.path.join(base, name)
        if os.path.exists(path):
            os.remove(path)

    # Avoid having any user-defined resources causing problems during testing.
    os.environ['OPENMDAO_RAMFILE'] = ''

    if '--with-coverage' in args:
        args.append('--cover-erase')
        if '--all' in args and not covpkg:
            for pkg in tlist:
                opt = '--cover-package=%s' % pkg
                if opt not in args:
                    args.append(opt)

            # Better coverage if we clobber credential data.
            path = os.path.join(base, 'keys')
            if os.path.exists(path):
                os.remove(path)

    # this tells it to enable the console in the environment so that
    # the logger will print output to stdout. This helps greatly when
    # debugging openmdao scripts running in separate processes.
    if '--enable_console' in args:
        args.remove('--enable_console')
        os.environ['OPENMDAO_ENABLE_CONSOLE'] = '1'

    if '--all' in args:
        args.remove('--all')
        args.extend(tlist)

    if '--plugins' in args:
        args.remove('--plugins')
        from openmdao.main.plugin import plugin_install, _get_plugin_parser
        argv = ['install', '--all']
        parser = _get_plugin_parser()
        options, argz = parser.parse_known_args(argv)
        plugin_install(parser, options, argz)

    # some libs we use call multiprocessing.cpu_count() on import, which can
    # raise NotImplementedError, so try to monkeypatch it here to return 1 if
    # that's the case
    try:
        import multiprocessing
        multiprocessing.cpu_count()
    except ImportError:
        pass
    except NotImplementedError:
        multiprocessing.cpu_count = lambda: 1


#    _trace_atexit()
    nose.run_exit(argv=args)
示例#47
0
    def run_tests(self):
        import nose

        test_script = os.path.join('pyhandle', 'tests', 'main_test_script.py')
        # See also nosetests section in setup.cfg
        nose.run_exit(argv=['nosetests', test_script])
示例#48
0
 def run_tests(self):
     import nose
     nose.run_exit(argv=[
         'nosetests', '--with-xunit',
         '--xunit-file=test-reports/unittests.xml'
     ])