sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #02749
Re: [Question #134349]: setUp and tearDown per class not per test fixture
Question #134349 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/134349
RaiMan proposed the following answer:
Ok, nice try ;-)
So this should be the final version that runs correctly in the IDE AND
from command line:
(the print statements are for testing purposes and have to be replaced
by your appropriate code)
def setUp(self):
try:
int(Settings.already_done) # this should fail at start
if Settings.already_done > 0: return
except:
Settings.already_done = 0
import inspect
Settings.numberOfTests = len([e for e in inspect.getmembers(self) if e[0].startswith('test')])
print "the other setUp code --", Settings.numberOfTests
def tearDown(self):
if Settings.already_done >= Settings.numberOfTests: Settings.already_done = None; return
elif Settings.already_done > 1: return
print "the other tearDown code"
def testA(self):
Settings.already_done += 1 # first line in every test
print "the other testA code --", Settings.already_done
return True
def testB(self):
Settings.already_done += 1 # first line in every test
print "the other testB code --", Settings.already_done
return True
# more tests might follow
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.