Skip to content
This repository has been archived by the owner on Jan 13, 2024. It is now read-only.

Commit

Permalink
fix #156, update to python-jenkins 1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sdpython committed Jul 22, 2018
1 parent 2c70ed2 commit 1087f83
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 11 deletions.
4 changes: 3 additions & 1 deletion HISTORY.rst
Expand Up @@ -5,9 +5,11 @@
History
=======

current - 2018-05-27 - 0.00Mb
current - 2018-07-22 - 0.00Mb
=============================

* `156`: fix issue with update to python-jenkins 1.1.0 (2018-07-22)
* `155`: fix issue with pylint 2.0 (2018-07-22)
* `154`: notebook coverage add color (2018-05-27)
* `153`: fix message "do not understand why t1 >= t2 for file %s" % full (2018-05-27)
* `151`: bug in autosignature, shorten path does not work for static method (2018-05-24)
Expand Down
21 changes: 14 additions & 7 deletions _unittests/ut_jenkinshelper/test_jenkinsext.py
Expand Up @@ -6,6 +6,8 @@
import os
import unittest
import re
import requests
import jenkins


try:
Expand All @@ -23,9 +25,10 @@

from src.pyquickhelper.loghelper import fLOG
from src.pyquickhelper.jenkinshelper.jenkins_server import JenkinsExt, JenkinsExtException
from src.pyquickhelper.pycode import ExtTestCase


class TestJenkinsExt(unittest.TestCase):
class TestJenkinsExt(ExtTestCase):

def test_src_import(self):
"""for pylint"""
Expand Down Expand Up @@ -54,12 +57,12 @@ def zz_st_jenkins_job_verif(self, platform):
if platform == "win":
job = "standalone [conda_update] [anaconda3]"
cmd = srv.get_cmd_standalone(job)
assert "Anaconda3" in cmd
self.assertIn("Anaconda3", cmd)

if platform == "win":
job = "pyrsslocal [py35] <-- pyquickhelper, pyensae"
cmd = "\n".join(srv.get_jenkins_script(job))
assert "Python34" not in cmd
self.assertNotIn("Python34", cmd)
else:
try:
job = "pyrsslocal [py35] <-- pyquickhelper, pyensae"
Expand All @@ -83,15 +86,15 @@ def test_jenkins_ext(self):
upstreams=None,
location=r"/home/username/jenkins/")

assert "auto_unittest_setup_help.bat" in conf
self.assertIn("auto_unittest_setup_help.bat", conf)

conf = srv.create_job_template("pyquickhelper",
git_repo=github +
"%s/" % "pyquickhelper",
upstreams=None,
location=r"/home/username/jenkins/",
scheduler="H H(13-14) * * *")
assert "H H(13-14) * * *" in conf
self.assertIn("H H(13-14) * * *", conf)

try:
conf = srv.create_job_template("pyquickhelper",
Expand All @@ -110,7 +113,7 @@ def test_jenkins_ext(self):
upstreams=["pyquickhelper"],
location=r"/home/username/jenkins/",
scheduler=None)
assert "pyquickhelper" in conf
self.assertIn("pyquickhelper", conf)

def test_jenkins_ext_setup_server(self):
fLOG(
Expand Down Expand Up @@ -329,7 +332,11 @@ def test_jenkins_ext_setup_server(self):
if "%jenkinspythonexe% -u %current%setup.py build_script" not in conf:
raise Exception(conf)

assert i > 0
self.assertGreater(i, 0)

def test_python_jenkins_request(self):
req = requests.Request
self.assertNotEmpty(req)


if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion src/pyquickhelper/benchhelper/benchmark.py
Expand Up @@ -436,7 +436,7 @@ def final_():
functions[i]()

self._progressbars = None
return self._metrics, self._meta
return self._metrics, self._metadata

@property
def Metrics(self):
Expand Down
3 changes: 2 additions & 1 deletion src/pyquickhelper/jenkinshelper/jenkins_server.py
Expand Up @@ -26,6 +26,7 @@
import socket
import hashlib
import re
import requests
from xml.sax.saxutils import escape
import jenkins
from ..loghelper.flog import noLOG
Expand Down Expand Up @@ -185,7 +186,7 @@ def delete_job(self, name):
r = self._get_job_folder(name)
if r is None:
raise JenkinsExtException('delete[%s] failed (no job)' % (name))
self.jenkins_open(jenkins.Request(
self.jenkins_open(requests.Request(
self.server + jenkins.DELETE_JOB % self._get_encoded_params(locals()), b''))
if self.job_exists(name):
raise JenkinsExtException('delete[%s] failed' % (name))
Expand Down
3 changes: 2 additions & 1 deletion src/pyquickhelper/pycode/utils_tests_helper.py
Expand Up @@ -33,7 +33,8 @@
if pylint_version <= '2.0.0':
PyLinterRunV = PyLinterRun
else:
PyLinterRunV = lambda *args, do_exit=False: PyLinterRun(*args, exit=do_exit)
PyLinterRunV = lambda *args, do_exit=False: PyLinterRun(
*args, exit=do_exit)


def get_temp_folder(thisfile, name=None, clean=True, create=True, max_path=False, max_path_name="tpath"):
Expand Down

0 comments on commit 1087f83

Please sign in to comment.