Exemplo n.º 1
0
    def begin(self):
        # The tests require that the environment is currently set to C, to avoid
        # translated strings and use the default date/number/currency formatting
        os.environ['LC_ALL'] = 'C'
        os.environ['LANG'] = 'C'
        os.environ['LANGUAGE'] = 'C'

        if 'STOQ_USE_GI' in os.environ:
            from stoq.lib import gicompat
            gicompat.enable()

        # If we import tests.base before Cover.setup() in the coverage plugin
        # is called the statistics will skip the modules imported by tests.base
        from stoqlib.database.testsuite import bootstrap_suite

        hostname = os.environ.get('STOQLIB_TEST_HOSTNAME')
        dbname = os.environ.get('STOQLIB_TEST_DBNAME')
        username = os.environ.get('STOQLIB_TEST_USERNAME')
        password = os.environ.get('STOQLIB_TEST_PASSWORD')
        port = int(os.environ.get('STOQLIB_TEST_PORT') or 0)
        quick = os.environ.get('STOQLIB_TEST_QUICK', None) is not None

        config = os.path.join(os.path.dirname(stoqlib.__file__), 'tests',
                              'config.py')
        if os.path.exists(config):
            execfile(config, globals(), locals())

        bootstrap_suite(address=hostname,
                        dbname=dbname,
                        port=port,
                        username=username,
                        password=password,
                        quick=quick)
Exemplo n.º 2
0
    def _setup_gobject(self):
        if not self._initial:
            return
        assert not 'gobject' in sys.modules
        assert not 'gtk' in sys.modules

        if 'STOQ_USE_GI' in os.environ:
            from stoq.lib import gicompat
            gicompat.enable()

        import gobject
        gobject.threads_init()
Exemplo n.º 3
0
    def _setup_gobject(self):
        if not self._initial:
            return
        assert not 'gobject' in sys.modules
        assert not 'gtk' in sys.modules

        if 'STOQ_USE_GI' in os.environ:
            from stoq.lib import gicompat
            gicompat.enable()

        import gobject
        gobject.threads_init()
Exemplo n.º 4
0
import os
import re
import sys

# The tests require that the environment is currently set to C, to avoid
# translated strings and use the default date/number/currency formatting
os.environ['LC_ALL'] = 'C'
os.environ['LANG'] = 'C'
os.environ['LANGUAGE'] = 'C'

import nose
from nose.plugins import Plugin

if 'STOQ_USE_GI' in os.environ:
    from stoq.lib import gicompat
    gicompat.enable()


class Stoq(Plugin):
    # This is a little hack to make sure that Stoq's database configuration
    # is properly setup. If we import tests.base before Cover.setup() in the
    # coverage plugin is called the statistics will skip the modules imported
    # by tests.base
    def begin(self):
        import tests.base
        tests.base  # pylint: disable=W0104


ATTRIBUTES = dict(bold=1, dark=2, underline=4, blink=5,
                  reverse=7, concealed=8)
COLORS = dict(grey=30, red=31, green=32, yellow=33, blue=34,
Exemplo n.º 5
0
import os
import re
import sys

# The tests require that the environment is currently set to C, to avoid
# translated strings and use the default date/number/currency formatting
os.environ['LC_ALL'] = 'C'
os.environ['LANG'] = 'C'
os.environ['LANGUAGE'] = 'C'

import nose
from nose.plugins import Plugin

if 'STOQ_USE_GI' in os.environ:
    from stoq.lib import gicompat
    gicompat.enable()


class Stoq(Plugin):
    # This is a little hack to make sure that Stoq's database configuration
    # is properly setup. If we import tests.base before Cover.setup() in the
    # coverage plugin is called the statistics will skip the modules imported
    # by tests.base
    def begin(self):
        import tests.base
        tests.base  # pyflakes


ATTRIBUTES = dict(bold=1, dark=2, underline=4, blink=5,
                  reverse=7, concealed=8)
COLORS = dict(grey=30, red=31, green=32, yellow=33, blue=34,