mirror of
https://github.com/httprunner/httprunner.git
synced 2026-06-06 00:09:37 +08:00
bugfix: strip environment value
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
__title__ = 'HttpRunner'
|
__title__ = 'HttpRunner'
|
||||||
__description__ = 'One-stop solution for HTTP(S) testing.'
|
__description__ = 'One-stop solution for HTTP(S) testing.'
|
||||||
__url__ = 'https://github.com/HttpRunner/HttpRunner'
|
__url__ = 'https://github.com/HttpRunner/HttpRunner'
|
||||||
__version__ = '1.4.5'
|
__version__ = '1.4.6'
|
||||||
__author__ = 'debugtalk'
|
__author__ = 'debugtalk'
|
||||||
__author_email__ = 'mail@debugtalk.com'
|
__author_email__ = 'mail@debugtalk.com'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
|
|||||||
@@ -513,7 +513,8 @@ def load_dot_env_file(path):
|
|||||||
with io.open(path, 'r', encoding='utf-8') as fp:
|
with io.open(path, 'r', encoding='utf-8') as fp:
|
||||||
for line in fp:
|
for line in fp:
|
||||||
variable, value = line.split("=")
|
variable, value = line.split("=")
|
||||||
os.environ[variable] = value
|
variable = variable.strip()
|
||||||
|
os.environ[variable] = value.strip()
|
||||||
logger.log_debug("Loaded variable: {}".format(variable))
|
logger.log_debug("Loaded variable: {}".format(variable))
|
||||||
|
|
||||||
def validate_json_file(file_list):
|
def validate_json_file(file_list):
|
||||||
|
|||||||
@@ -158,6 +158,7 @@ class TestHttpRunner(ApiServerUnittest):
|
|||||||
self.assertNotIn("PROJECT_KEY", os.environ)
|
self.assertNotIn("PROJECT_KEY", os.environ)
|
||||||
HttpRunner(dot_env_path="tests/data/test.env").run(self.testset_path)
|
HttpRunner(dot_env_path="tests/data/test.env").run(self.testset_path)
|
||||||
self.assertIn("PROJECT_KEY", os.environ)
|
self.assertIn("PROJECT_KEY", os.environ)
|
||||||
|
self.assertEqual(os.environ["UserName"], "debugtalk")
|
||||||
|
|
||||||
def test_load_env_path_not_exist(self):
|
def test_load_env_path_not_exist(self):
|
||||||
with self.assertRaises(FileNotFoundError):
|
with self.assertRaises(FileNotFoundError):
|
||||||
|
|||||||
Reference in New Issue
Block a user