add --dot-env-path back

This commit is contained in:
httprunner
2018-08-28 14:35:26 +08:00
parent 7fbef8aaf1
commit e0fe6b2a4f
5 changed files with 31 additions and 6 deletions

3
tests/data/test.env Normal file
View File

@@ -0,0 +1,3 @@
UserName=test
Password=654321
PROJECT_KEY=AAABBBCCC

View File

@@ -140,6 +140,16 @@ class TestFileLoader(unittest.TestCase):
self.assertIn("PROJECT_KEY", env_variables_mapping)
self.assertEqual(env_variables_mapping["UserName"], "debugtalk")
def test_load_custom_dot_env_file(self):
loader.project_working_directory = os.path.join(
os.getcwd(), "tests",
)
loader.dot_env_path = "tests/data/test.env"
env_variables_mapping = loader.load_dot_env_file()
self.assertIn("PROJECT_KEY", env_variables_mapping)
self.assertEqual(env_variables_mapping["UserName"], "test")
loader.dot_env_path = None
def test_load_env_path_not_exist(self):
loader.project_working_directory = os.path.join(
os.getcwd(), "tests", "data",