fix environment variable invoke:

environment variable maybe loaded in debugtalk.py
thus .env file should be loaded before loading debugtalk.py
This commit is contained in:
httprunner
2018-11-22 20:43:27 +08:00
parent c9a97d3e1c
commit bae0f03c68
2 changed files with 41 additions and 30 deletions

View File

@@ -208,21 +208,27 @@ class TestModuleLoader(unittest.TestCase):
self.assertFalse(is_status_code_200(500))
def test_load_debugtalk_py(self):
project_working_directory, debugtalk_functions = loader.load_debugtalk_py("tests/data/demo_testcase.yml")
loader.load_project_tests("tests/data/demo_testcase.yml")
project_working_directory = loader.project_mapping["PWD"]
debugtalk_functions = loader.project_mapping["functions"]
self.assertEqual(
project_working_directory,
os.path.join(os.getcwd(), "tests")
)
self.assertIn("gen_md5", debugtalk_functions)
project_working_directory, debugtalk_functions = loader.load_debugtalk_py("tests/base.py")
loader.load_project_tests("tests/base.py")
project_working_directory = loader.project_mapping["PWD"]
debugtalk_functions = loader.project_mapping["functions"]
self.assertEqual(
project_working_directory,
os.path.join(os.getcwd(), "tests")
)
self.assertIn("gen_md5", debugtalk_functions)
project_working_directory, debugtalk_functions = loader.load_debugtalk_py("httprunner/__init__.py")
loader.load_project_tests("httprunner/__init__.py")
project_working_directory = loader.project_mapping["PWD"]
debugtalk_functions = loader.project_mapping["functions"]
self.assertEqual(
project_working_directory,
os.getcwd()