<commit_before># -*- coding: utf-8 -*-
"""
@brief      test log(time=60s)
"""
import sys
import unittest
from pyquickhelper.loghelper import fLOG
from pyquickhelper.jenkinshelper import JenkinsExt
from ensae_teaching_cs.automation.jenkins_helper import setup_jenkins_server, default_jenkins_jobs


class TestJenkins(unittest.TestCase):

    def test_jenkins_local(self):
        fLOG(
            __file__,
            self._testMethodName,
            OutputPrint=__name__ == "__main__")

        engines = dict(anaconda2="C:\\Anaconda2", anaconda3="C:\\Anaconda3",
                       winpython="C:\\WinPython-64bit-3.4.2.3\\python-3.4.2.amd64",
                       default="c:\\PythonXX_x64", py27="c:\\Python27", py35="c:\\Python35_x64",
                       py36="c:\\Python36_x64", Python34="py34", Python35="py35",
                       Python36="py36", Anaconda3="apy35", Anaconda2="apy27",
                       Python27="py27", WinPython35="wpy35", WinPython36="wpy36",
                       Python35pyq="DDD", Python37="py37")
        vers = "%d%d" % sys.version_info[:2]
        engines["Python" + vers] = "py" + vers

        js = JenkinsExt('http://machine:8080/', "user",
                        "password", mock=True, engines=engines, fLOG=fLOG)

        if sys.platform.startswith("win"):
            res = setup_jenkins_server(js,
                                       overwrite=True,
                                       location=r"c:\\jenkins\\pymy",
                                       prefix="_node_")
            self.assertGreater(len(res), 0)

            job = "pyrsslocal [py35] <-- pyquickhelper, pyensae"
            cmd = "\n".join(js.get_jenkins_script(job))
            if "PythonXX" in cmd:
                raise Exception(cmd)

    def test_jenkins_local27(self):
        fLOG(
            __file__,
            self._testMethodName,
            OutputPrint=__name__ == "__main__")

        modules = default_jenkins_jobs(".*yml.*", ".*update.*")
        self.assertEqual(len(modules), 38)
        modules = default_jenkins_jobs(".*27.*", ".*update.*")
        self.assertEqual(len(modules), 0)


if __name__ == "__main__":
    unittest.main()<commit_msg>Update test_jenkins.py<commit_after># -*- coding: utf-8 -*-
"""
@brief      test log(time=60s)
"""
import sys
import unittest
from pyquickhelper.loghelper import fLOG
from pyquickhelper.jenkinshelper import JenkinsExt
from ensae_teaching_cs.automation.jenkins_helper import setup_jenkins_server, default_jenkins_jobs


class TestJenkins(unittest.TestCase):

    def test_jenkins_local(self):
        fLOG(
            __file__,
            self._testMethodName,
            OutputPrint=__name__ == "__main__")

        engines = dict(anaconda2="C:\\Anaconda2", anaconda3="C:\\Anaconda3",
                       winpython="C:\\WinPython-64bit-3.4.2.3\\python-3.4.2.amd64",
                       default="c:\\PythonXX_x64", py27="c:\\Python27", py35="c:\\Python35_x64",
                       py36="c:\\Python36_x64", Python34="py34", Python35="py35",
                       Python36="py36", Anaconda3="apy35", Anaconda2="apy27",
                       Python27="py27", WinPython35="wpy35", WinPython36="wpy36",
                       Python35pyq="DDD", Python37="py37")
        vers = "%d%d" % sys.version_info[:2]
        engines["Python" + vers] = "py" + vers

        js = JenkinsExt('http://machine:8080/', "user",
                        "password", mock=True, engines=engines, fLOG=fLOG)

        if sys.platform.startswith("win"):
            res = setup_jenkins_server(js,
                                       overwrite=True,
                                       location=r"c:\\jenkins\\pymy",
                                       prefix="_node_")
            self.assertGreater(len(res), 0)

            job = "pyrsslocal [py35] <-- pyquickhelper, pyensae"
            cmd = "\n".join(js.get_jenkins_script(job))
            if "PythonXX" in cmd:
                raise Exception(cmd)

    def test_jenkins_local27(self):
        fLOG(
            __file__,
            self._testMethodName,
            OutputPrint=__name__ == "__main__")

        modules = default_jenkins_jobs(".*yml.*", ".*update.*")
        self.assertEqual(len(modules), 39)
        modules = default_jenkins_jobs(".*27.*", ".*update.*")
        self.assertEqual(len(modules), 0)


if __name__ == "__main__":
    unittest.main()
{'fraction_non_alphanumeric': 0.1391087989142728, 'fraction_numerical': 0.03935761140013572, 'mean_word_length': 2.010211027910143, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1354681', 'n_tokens_mistral': 1489, 'n_tokens_neox': 1352, 'n_words': 214}