From 24509889e163d8ae1c995ea12ccfd2cd8c152de2 Mon Sep 17 00:00:00 2001 From: Guillaume Bour Date: Fri, 17 Jun 2016 15:40:18 +0200 Subject: [PATCH] [test] #32: add cleanup method to get back to know environment when testsuite ends --- tests/TestSuite.py | 4 ++++ tests/testsuite/035_auth.py | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/tests/TestSuite.py b/tests/TestSuite.py index 8fedcbf..a6b42c5 100644 --- a/tests/TestSuite.py +++ b/tests/TestSuite.py @@ -54,6 +54,9 @@ class TestSuite(object): def __init__(self, suitename): self.suitename = suitename + def cleanup(self): + pass + @defer.inlineCallbacks def run(self, testfilter): status = True @@ -83,6 +86,7 @@ def run(self, testfilter): counters[DISPLAY[ret][1].lower()] += 1 status &= DISPLAY[ret][-1] + yield self.cleanup() defer.returnValue((status, counters)) def _print(self, (color, text, _ign), funcname, testname): diff --git a/tests/testsuite/035_auth.py b/tests/testsuite/035_auth.py index e73c444..64e2bca 100644 --- a/tests/testsuite/035_auth.py +++ b/tests/testsuite/035_auth.py @@ -35,6 +35,12 @@ class Auth(TestSuite): def __init__(self): TestSuite.__init__(self, "Authentication") + @defer.inlineCallbacks + def cleanup(self): + # set back default values (required = false) so following tests are working :) + yield set_env({}) + + @catch @desc("anonymous connection: auth optional") @defer.inlineCallbacks