From: Kieron Briggs Date: Fri, 30 Aug 2013 00:46:46 +0000 (+1000) Subject: Make test_jenkins_artifacts more forgiving X-Git-Tag: v0.2.23~100^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=79b8d472cf7e478558bd1c94a35bcd2ff408a3a1;p=tools%2Fpython-jenkinsapi.git Make test_jenkins_artifacts more forgiving On some systems, 127.0.0.1 reverse-resolves to an actual hostname, and not to 'localhost'. Hence, match the output by the IP address instead. --- diff --git a/jenkinsapi_tests/systests/test_jenkins_artifacts.py b/jenkinsapi_tests/systests/test_jenkins_artifacts.py index 42abdcb..1cf155e 100644 --- a/jenkinsapi_tests/systests/test_jenkins_artifacts.py +++ b/jenkinsapi_tests/systests/test_jenkins_artifacts.py @@ -2,6 +2,7 @@ System tests for `jenkinsapi.jenkins` module. ''' import os +import re import time import gzip import shutil @@ -38,7 +39,7 @@ class TestPingerJob(BaseSystemTest): text_artifact.save_to_dir(tempDir) readBackText = open(os.path.join( tempDir, text_artifact.filename), 'rb').read().strip() - self.assertTrue(readBackText.startswith('PING localhost')) + self.assertTrue(re.match(r'^PING \S+ \(127.0.0.1\)', readBackText)) self.assertTrue(readBackText.endswith('ms')) # Verify that we can hande binary artifacts @@ -47,7 +48,7 @@ class TestPingerJob(BaseSystemTest): tempDir, binary_artifact.filename, ), 'rb' ).read().strip() - self.assertTrue(readBackText.startswith('PING localhost')) + self.assertTrue(re.match(r'^PING \S+ \(127.0.0.1\)', readBackText)) self.assertTrue(readBackText.endswith('ms')) finally: shutil.rmtree(tempDir)