Skip to content

Commit

Permalink
[test] #32: add cleanup method to get back to know environment when t…
Browse files Browse the repository at this point in the history
…estsuite ends
  • Loading branch information
Guillaume Bour committed Jun 17, 2016
1 parent 818b466 commit 2450988
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/TestSuite.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down
6 changes: 6 additions & 0 deletions tests/testsuite/035_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2450988

Please sign in to comment.