From f958b39b22457444e165436444b65428730bb9fc Mon Sep 17 00:00:00 2001 From: hluguoj Date: Thu, 14 Mar 2019 20:31:42 +0800 Subject: [PATCH] =?UTF-8?q?bugfix:=E8=A7=A3=E5=86=B3validate=E4=B8=BA?= =?UTF-8?q?=E7=A9=BA=E6=97=B6=E6=B2=BF=E7=94=A8=E4=B8=8A=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E7=9A=84validate=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- httprunner/context.py | 2 +- tests/test_context.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/httprunner/context.py b/httprunner/context.py index 3fe3d572..7d402fbf 100644 --- a/httprunner/context.py +++ b/httprunner/context.py @@ -168,12 +168,12 @@ class SessionContext(object): def validate(self, validators, resp_obj): """ make validations """ + self.validation_results = [] if not validators: return logger.log_debug("start to validate.") - self.validation_results = [] validate_pass = True failures = [] diff --git a/tests/test_context.py b/tests/test_context.py index 51e980e5..a5c6a835 100644 --- a/tests/test_context.py +++ b/tests/test_context.py @@ -146,6 +146,9 @@ class TestContext(ApiServerUnittest): self.context.init_test_variables(variables) self.context.validate(validators, resp_obj) + self.context.validate([], resp_obj) + self.assertEqual(self.context.validation_results, []) + def test_validate_exception(self): url = "http://127.0.0.1:5000/" resp = requests.get(url)