コード例 #1
0
ファイル: tests_runner.py プロジェクト: metrorede/stak
def main(args, extra_plugins=None):
    # FIXME: readline is segfaulting when the tests run inside a xvfb
    # environment. Changing it to gnureadline seems to normalize it
    if os.environ.get('PATCH_READLINE', '0') == '1':
        import gnureadline
        sys.modules['readline'] = gnureadline

    if '--sql' in args:
        args.remove('--sql')
        from stoqlib.database.debug import enable
        enable()

    if '--coverage' in args:
        args.remove('--coverage')
        modules = _collect_coverage_modules(args)
        if modules:
            args.append('--with-coverage')
            args.append('--cover-package=%s' % (','.join(modules), ))

    for extra_option in [
            # Disable capturing of stdout, we often use this for print debugging
            '--nocapture',
            # Disable logging capture, kiwi is quite verbose and doesn't give
            # a lot of useful information
            '--nologcapture',
            # Be verbose, one line per test instead of just a dot (like trial)
            '--verbose',
            # Detailed errors, useful for tracking down assertEqual
            '--detailed-errors',
            # Enable doctests
            '--with-doctest',
            # Our doctests ends with .txt, eg sellable.txt
            '--doctest-extension=txt'
    ]:
        if not extra_option in args:
            args.append(extra_option)

    plugins = [Stoq(), YANC()]
    if extra_plugins is not None:
        plugins.extend(extra_plugins)

    # --with-plugin must be the last args
    for p in plugins:
        args.append('--with-%s' % p.name)

    return nose.main(argv=args, addplugins=plugins)
コード例 #2
0
ファイル: tests_runner.py プロジェクト: hackedbellini/stoq
def main(args, extra_plugins=None):
    # FIXME: readline is segfaulting when the tests run inside a xvfb
    # environment. Changing it to gnureadline seems to normalize it
    if os.environ.get('PATCH_READLINE', '0') == '1':
        import gnureadline
        sys.modules['readline'] = gnureadline

    if '--sql' in args:
        args.remove('--sql')
        from stoqlib.database.debug import enable
        enable()

    if '--coverage' in args:
        args.remove('--coverage')
        modules = _collect_coverage_modules(args)
        if modules:
            args.append('--with-coverage')
            args.append('--cover-package=%s' % (','.join(modules), ))

    for extra_option in [
        # Disable capturing of stdout, we often use this for print debugging
        '--nocapture',
        # Disable logging capture, kiwi is quite verbose and doesn't give
        # a lot of useful information
        '--nologcapture',
        # Be verbose, one line per test instead of just a dot (like trial)
        '--verbose',
        # Detailed errors, useful for tracking down assertEqual
        '--detailed-errors',
        # Enable doctests
        '--with-doctest',
        # Our doctests ends with .txt, eg sellable.txt
        '--doctest-extension=txt']:
        if not extra_option in args:
            args.append(extra_option)

    plugins = [Stoq(), YANC()]
    if extra_plugins is not None:
        plugins.extend(extra_plugins)

    # --with-plugin must be the last args
    for p in plugins:
        args.append('--with-%s' % p.name)

    return nose.main(argv=args, addplugins=plugins)
コード例 #3
0
ファイル: tests_runner.py プロジェクト: ComradeHadi/stoq
def main(args, extra_plugins=None):
    if '--sql' in args:
        args.remove('--sql')
        from stoqlib.database.debug import enable
        enable()

    if '--coverage' in args:
        args.remove('--coverage')
        modules = _collect_coverage_modules(args)
        if modules:
            args.append('--with-coverage')
            args.append('--cover-package=%s' % (','.join(modules), ))

    for extra_option in [
            # Disable capturing of stdout, we often use this for print debugging
            '--nocapture',
            # Disable logging capture, kiwi is quite verbose and doesn't give
            # a lot of useful information
            '--nologcapture',
            # Be verbose, one line per test instead of just a dot (like trial)
            '--verbose',
            # Detailed errors, useful for tracking down assertEquals
            '--detailed-errors',
            # Enable doctests
            '--with-doctest',
            # Our doctests ends with .txt, eg sellable.txt
            '--doctest-extension=txt'
    ]:
        if not extra_option in args:
            args.append(extra_option)

    plugins = [Stoq(), YANC()]
    if extra_plugins is not None:
        plugins.extend(extra_plugins)

    # --with-plugin must be the last args
    for p in plugins:
        args.append('--with-%s' % p.name)

    return nose.main(argv=args, addplugins=plugins)
コード例 #4
0
ファイル: runtests.py プロジェクト: LeonamSilva/stoq
        path = '.'.join(parts)
        return '%s:%s.%s' % (path, klass, method)

    def begin(self):
        if self.color:
            self.conf.stream = ColorStream(self.conf.stream)

    def finalize(self, result):
        if self.color:
            self.conf.stream = self.conf.stream._stream

if '--sql' in sys.argv:
    sys.argv.remove('--sql')
    from stoqlib.database.debug import enable
    enable()

# The doctests plugin in nosetests 1.1.2 doesn't have --doctest-options,
# which we need to set to ELLIPSIS, so monkeypatch that support in.
import doctest
from nose.plugins.doctests import DocFileCase


def _init(self, test, optionflags=0, setUp=None, tearDown=None,
          checker=None, obj=None, result_var='_'):
    self._result_var = result_var
    self._nose_obj = obj
    super(DocFileCase, self).__init__(
        test, optionflags=doctest.ELLIPSIS | doctest.REPORT_ONLY_FIRST_FAILURE,
        setUp=setUp, tearDown=tearDown,
        checker=checker)
コード例 #5
0
ファイル: runtests.py プロジェクト: tmaxter/stoq
        path = '.'.join(parts)
        return '%s:%s.%s' % (path, klass, method)

    def begin(self):
        if self.color:
            self.conf.stream = ColorStream(self.conf.stream)

    def finalize(self, result):
        if self.color:
            self.conf.stream = self.conf.stream._stream

if '--sql' in sys.argv:
    sys.argv.remove('--sql')
    from stoqlib.database.debug import enable
    enable()

# The doctests plugin in nosetests 1.1.2 doesn't have --doctest-options,
# which we need to set to ELLIPSIS, so monkeypatch that support in.
import doctest
from nose.plugins.doctests import DocFileCase


def _init(self, test, optionflags=0, setUp=None, tearDown=None,
          checker=None, obj=None, result_var='_'):
    self._result_var = result_var
    self._nose_obj = obj
    super(DocFileCase, self).__init__(
        test, optionflags=doctest.ELLIPSIS | doctest.REPORT_ONLY_FIRST_FAILURE,
        setUp=setUp, tearDown=tearDown,
        checker=checker)