Closed laike9m closed 9 years ago
I'm going to go ahead and close this issue, but feel free to reply if you would like help from me. I'll still get notified even though it's closed.
tests = unittest.TestLoader().discover(
os.path.join(setup_dir, 'tests'), pattern='*.py')
unittest.TextTestRunner().run(tests)
How to run this code using green?
What's the point of using green in this place? unittest does discovery and testing well.
@kxepal Quote from green's readme:
Green grew out of a desire to see pretty colors.
People use green for better discovering or testing? Of course not. If what I need is not prettier output, why do I use green?
@laike9m I believe something like this should work:
from green.suite import GreenTestSuite
from green.runner import run
from green.config import default_args
# If you want to change options, modify default_args here
# default_args.verbose = 3 # etc.
tests = unittest.TestLoader().discover(
os.path.join(setup_dir, 'tests'), pattern='*.py')
run(GreenTestSuite(tests), sys.stdout, default_args)
Thx CleanCut, I'll try.
@CleanCut Works as expected. Thx again! Why don't you put it into documentation?
Well, if I'm going to officially support it, I'd rather add a new feature so it goes something more like:
from green import runTestSuite
tests = (however you want to manually load tests)
runTestSuite(tests)
Yes!
If you will tell me where in your process you want to launch them from, I can point you in the right direction. For example, is it from a Makefile? From bash? From another python script? From the test file itself?