fix #363: clear meta data first to ensure independence for each test

This commit is contained in:
debugtalk
2018-11-24 10:28:00 +08:00
parent 3ea4789c7b
commit 61df6cdaae
3 changed files with 27 additions and 11 deletions

View File

@@ -47,13 +47,15 @@ class HttpRunner(object):
except exceptions.MyBaseFailure as ex:
self.fail(str(ex))
finally:
if hasattr(test_runner.http_client_session, "meta_data"):
self.meta_data = test_runner.http_client_session.meta_data
self.meta_data["validators"] = test_runner.evaluated_validators
test_runner.http_client_session.init_meta_data()
self.meta_data = test_runner.get_test_data()
if "config" in test_dict:
# run nested testcase
test.__doc__ = test_dict["config"].get("name")
else:
# run api test
test.__doc__ = test_dict.get("name")
# TODO: refactor
test.__doc__ = test_dict.get("name") or test_dict.get("config", {}).get("name")
return test
test_suite = unittest.TestSuite()