I have a test suite function in runTests.py
and I run the tests from this file:
def suite():
suite.addTest(makeSuite(Class1))
suite.addTest(makeSuite(Class2))
...
suite.addTest(makeSuite(ClassN))
if __name__ == '__main__':
# grab argument from the command line and
# initiate myVar1 and myVar2 here before running the suite
# run the suite here
What I want is to read in arguments from the command line and initiate them inside runTests.py
, right before I run the suite in the if
statement. These variables would also be used inside of Class1
, Class2
, etc.
Would it be correct if inside runTests.py
I have the following before the suite definition
myVar1 = 'defaultValue'
myVar2 = 'defaultValue'
Then in the if
statement grab the arguments from the command line and initialize myVar1
and myVar2
. So in the other classes, eg Class1
, I would import it like:
from runTests import myVar1
from runTests import myVar2
Basically, what I want is to read in a few parameters from the command line and be able to use those values in the other classes. Thanks!