Ejemplo n.º 1
0
 def test_get_builder_plugin(self, mock_ana, mock_conf):
     """test get plugin name method"""
     mock_config = mock.Mock()
     mock_config.get = mock.Mock(return_value={'builder': 'STEVE'})
     mock_config.has_gitconfig_param = mock.Mock(return_value=True)
     mock_config.get_gitconfig_param = mock.Mock(return_value='POOP')
     mock_conf.return_value = mock_config
     mock_ana.return_value = True
     self.assertEqual(get_builder_plugin(), 'POOP')
     mock_config.has_gitconfig_param.return_value = False
     self.assertEqual(get_builder_plugin(), 'STEVE')
     mock_config.get.return_value = {'builder': None}
     self.assertEqual(get_builder_plugin(), 'CondaPip')
     mock_ana.return_value = False
     self.assertEqual(get_builder_plugin(), 'VirtualenvPip')
Ejemplo n.º 2
0
def tox_run(config, opts):
    """
    tox test

    activate venv and run tox test suite

    """
    suite_conf = config.test_suite(opts.suite)
    tox_ini = suite_conf.get('tox_ini')
    test_opts = suite_conf.get('test_options')
    if opts.options:
        # command line overrides
        test_opts = opts.options
    tox_command = "tox"
    if tox_ini:
        tox_command += " -c {}".format(tox_ini)
    if test_opts:
        tox_command += " {}".format(test_opts)

    if opts.builder is None:
        opts.builder = get_builder_plugin()

    builder = FACTORY(opts.builder)
    activate = builder.activate()
    local(
        '{0} && {1}'.format(
            activate,
            tox_command
        )
    )
Ejemplo n.º 3
0
def nose_run(config, opts):
    """
    _nose_test_

    Locally activate vitrualenv and run tests via nose
    """
    where = config.test_where(opts.suite)
    suite_conf = config.test_suite(opts.suite)
    test_opts = suite_conf.get('test_options')
    if opts.options:
        # command line overrides
        test_opts = opts.options

    if opts.builder is None:
        opts.builder = get_builder_plugin()

    builder = FACTORY(opts.builder)
    activate = builder.activate()

    local(
        '{0} && nosetests -w {1} {2}'.format(
            activate,
            where,
            test_opts if test_opts else ""
        )
    )
Ejemplo n.º 4
0
def pytest_run(config, opts):
    """
    activate venv and run pytest
    """
    suite_conf = config.test_suite(opts.suite)
    test_opts = suite_conf.get('test_options')
    where = suite_conf.get('where', 'tests/unit')
    if opts.options:
        # command line overrides
        test_opts = opts.options
    command = "pytest {}".format(where)
    if test_opts:
        command += " {}".format(test_opts)

    if opts.builder is None:
        opts.builder = get_builder_plugin()

    builder = FACTORY(opts.builder)
    activate = builder.activate()
    local(
        '{0} && {1}'.format(
            activate,
            command
        )
    )
Ejemplo n.º 5
0
 def __init__(self, config, release):
     self._config
     self._release = release
     self._builder = get_builder_plugin()
Ejemplo n.º 6
0
 def __init__(self, config, release):
     self._config
     self._release = release
     self._builder = get_builder_plugin()