Terry J. Reedy added the comment:
Thanks. That still leaves the problem of getting all tests to run during
development when running them with unittest. Calling requires('gui') passes
when (_is_gui_available() and (caller is __main__ or 'gui' in use_resources)).
Use_resources is normally set by regrtest. As far as I saw, most other support
functions work fine with unittest and are not dependent on regrtest.
The doc for unittest.main say that the argv argument can be a list of options
passed to the program. Which program? Can that be used to set a resource?
I plan to try
from test import support; support.use_resources = ['gui']
in the 'if __name__ ...' sections of xyz.py and test_idle.py, but that will not
work from the command line ('python -m unittest whatever').
An alternative is to have requires() check whether the test is running under
regrtest (which supposedly changes support.verbose from 1 (which it starts as)
to 0) and passing, at least for 'gui', if not. (Is there any other way for a
test to detect the test runner?)
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue18103>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com