set_os_environ before parsing testcase, unset_os_environ after parsing testcase

This commit is contained in:
httprunner
2018-11-14 22:11:14 +08:00
parent 934c209a2e
commit 2c90c64dc2
5 changed files with 16 additions and 4 deletions

View File

@@ -7,7 +7,6 @@ import time
from tests.api_server import HTTPBIN_SERVER, SECRET_KEY, gen_md5, get_sign
BASE_URL = "http://127.0.0.1:5000"
UserName = os.environ['UserName']
demo_default_request = {

View File

@@ -565,7 +565,6 @@ class TestSuiteLoader(unittest.TestCase):
path = os.path.join(
os.getcwd(), 'tests/data/demo_locust.yml')
locust_tests = loader.load_locust_tests(path)
self.assertEqual(locust_tests["config"]["variables"]["UserName"], "debugtalk")
self.assertEqual(len(locust_tests["tests"]), 10)
self.assertEqual(locust_tests["tests"][0][0]["name"], "index")
self.assertEqual(locust_tests["tests"][9][0]["name"], "user-agent")