This repository has been archived by the owner on Jan 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 59
/
test_jenkins.py
75 lines (60 loc) · 2.41 KB
/
test_jenkins.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# -*- coding: utf-8 -*-
"""
@brief test log(time=60s)
"""
import sys
import os
import unittest
from pyquickhelper.loghelper import fLOG
from pyquickhelper.jenkinshelper import JenkinsExt
try:
import src
except ImportError:
path = os.path.normpath(
os.path.abspath(
os.path.join(
os.path.split(__file__)[0],
"..",
"..")))
if path not in sys.path:
sys.path.append(path)
import src
from src.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")
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), 29)
modules = default_jenkins_jobs(".*27.*", ".*update.*")
self.assertEqual(len(modules), 0)
modules = default_jenkins_jobs(".*27.*")
self.assertEqual(len(modules), 2)
if __name__ == "__main__":
unittest.main()