aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--functest/ci/run_tests.py4
-rw-r--r--functest/tests/unit/ci/test_run_tests.py3
2 files changed, 6 insertions, 1 deletions
diff --git a/functest/ci/run_tests.py b/functest/ci/run_tests.py
index 36b52fd4..8c0b11b1 100644
--- a/functest/ci/run_tests.py
+++ b/functest/ci/run_tests.py
@@ -96,7 +96,11 @@ class Runner(object):
@staticmethod
def source_envfile(rc_file=ENV_FILE):
"""Source the env file passed as arg"""
+ if not os.path.isfile(rc_file):
+ LOGGER.debug("No env file %s found", rc_file)
+ return
with open(rc_file, "r") as rcfd:
+ LOGGER.info("Sourcing env file %s", rc_file)
for line in rcfd:
var = (line.rstrip('"\n').replace('export ', '').split(
"=") if re.search(r'(.*)=(.*)', line) else None)
diff --git a/functest/tests/unit/ci/test_run_tests.py b/functest/tests/unit/ci/test_run_tests.py
index aaa265c5..bc967743 100644
--- a/functest/tests/unit/ci/test_run_tests.py
+++ b/functest/tests/unit/ci/test_run_tests.py
@@ -92,7 +92,8 @@ class RunTestsTesting(unittest.TestCase):
envfile = 'rc_file'
with mock.patch('six.moves.builtins.open',
mock.mock_open(read_data=msg),
- create=True) as mock_method:
+ create=True) as mock_method,\
+ mock.patch('os.path.isfile', return_value=True):
mock_method.return_value.__iter__ = lambda self: iter(
self.readline, '')
self.runner.source_envfile(envfile)