Beispiel #1
0
    def test_tox_ini_additional_test_commands(self):
        """Test use of 'additional_test_commands' in vsc-ci.ini."""

        self.write_vsc_ci_ini('additional_test_commands=./more_tests.sh')
        expected = JENKINSFILE_INIT + JENKINSFILE_TEST_START + EASY_INSTALL_TOX + TOX_RUN_PY2 + '\n'.join(
            [
                "        sh './more_tests.sh'",
                "    }",
                "}",
                '',
            ])
        self.assertEqual(gen_jenkinsfile(), expected)

        self.write_vsc_ci_ini('\n'.join([
            'additional_test_commands=',
            '    ./more_tests.sh',
            '    another-command',
            '    test -f foo.txt',
            "    echo 'this command uses single quotes'",
        ]))
        expected = JENKINSFILE_INIT + JENKINSFILE_TEST_START + EASY_INSTALL_TOX + TOX_RUN_PY2 + '\n'.join(
            [
                "        sh './more_tests.sh'",
                "        sh 'another-command'",
                "        sh 'test -f foo.txt'",
                '        sh """echo \'this command uses single quotes\'"""',
                "    }",
                "}",
                '',
            ])
        self.assertEqual(gen_jenkinsfile(), expected)
Beispiel #2
0
    def test_gen_jenkinsfile_jira_issue_id_in_pr_title(self):
        """Test generating of Jenkinsfile incl. check for JIRA issue in PR title."""

        self.write_vsc_ci_ini('jira_issue_id_in_pr_title=1')

        jenkinsfile_txt = gen_jenkinsfile()
        self.assertEqual(jenkinsfile_txt, EXPECTED_JENKINSFILE_JIRA)
Beispiel #3
0
    def test_gen_jenkinsfile_pip3_install_tox(self):
        """Test generating of Jenkinsfile incl. install tox with 'pip3 install."""

        self.write_vsc_ci_ini('pip3_install_tox=1')
        jenkinsfile_txt = gen_jenkinsfile()
        self.assertEqual(jenkinsfile_txt,
                         EXPECTED_JENKINSFILE_PIP3_INSTALL_TOX)
Beispiel #4
0
    def test_gen_jenkinsfile_home_pip3_install_tox(self):
        """Test generating of Jenkinsfile incl. install tox with 'pip3 install."""

        self.write_vsc_ci_ini('home_install=1\npip3_install_tox=1')
        jenkinsfile_txt = gen_jenkinsfile()

        expected = EXPECTED_JENKINSFILE_PIP3_INSTALL_TOX
        expected = expected.replace('pip3 install', 'export PREFIX=$PWD && cd $HOME && pip3 install')
        expected = expected.replace('--prefix $PWD', '--prefix $PREFIX')
        self.assertEqual(jenkinsfile_txt, expected)
Beispiel #5
0
    def test_install_scripts_prefix_override(self):
        """Test generating of tox.ini when install_scripts_prefix_override is set."""

        self.write_vsc_ci_ini('install_scripts_prefix_override=1\npip3_install_tox=1')

        expected_tox_ini = EXPECTED_TOX_INI
        pip_regex = re.compile('pip install')
        pip_install_scripts = 'pip install --install-option="--install-scripts={envdir}/bin"'
        expected_tox_ini = pip_regex.sub(pip_install_scripts, expected_tox_ini)
        easy_install_regex = re.compile('easy_install -U')
        expected_tox_ini = easy_install_regex.sub('easy_install -U --script-dir={envdir}/bin', expected_tox_ini)

        self.assertEqual(gen_tox_ini(), expected_tox_ini)

        self.assertEqual(gen_jenkinsfile(), EXPECTED_JENKINSFILE_PIP3_INSTALL_TOX)
Beispiel #6
0
    def test_gen_jenkinsfile_shellcheck(self):
        """Test generating of Jenkinsfile incl. running of shellcheck."""

        self.write_vsc_ci_ini('run_shellcheck=1')
        jenkinsfile_txt = gen_jenkinsfile()
        self.assertEqual(jenkinsfile_txt, EXPECTED_JENKINSFILE_SHELLCHECK)
Beispiel #7
0
 def test_gen_jenkinsfile(self):
     """Test generating of Jenkinsfile."""
     self.assertEqual(gen_jenkinsfile(), EXPECTED_JENKINSFILE_DEFAULT)
Beispiel #8
0
 def test_jenkinsfile(self):
     """Test whether Jenkinsfile is in place, and was auto-generated by vsc-install."""
     check_autogenerated_ci_config_file(self, JENKINSFILE,
                                        gen_jenkinsfile())