Message191255
| Author |
terry.reedy |
| Recipients |
Todd.Rovito, ezio.melotti, ncoghlan, ned.deily, r.david.murray, terry.reedy |
| Date |
2013年06月16日.02:44:17 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1371350658.15.0.364017562484.issue18103@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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?) |
|