[qmtest] [PATCH] Add more annotations to QMTest runs
Mark Mitchell
mark at codesourcery.com
Wed Feb 11 21:18:20 UTC 2004
Nathaniel Smith wrote:
>This patch, attached for review, adds more default annotations to
>QMTest. These are required for emulation of the TET[1] output format,
>but are useful generally.
>
>Also adds a few more calls to ExecutionEngine._Trace, and
>rationalizes the early termination handling;
>ExecutionEnginer._RunTests used to sometimes signal early termination
>by just exiting, and sometimes by raising an exception; we now always
>raise an exception of some form.
>
>
Yay.
>New annotations:
> qmtest.run.user: user who started the test run
> qmtest.run.version: version of QMTest used for this test run
> qmtest.run.uname: uname of the machine that started this test run
> qmtest.run.aborted: present with value "True" if test run was
> aborted early
>
>
>
Cool.
>Questions:
> - Currently the simple presence of qmtest.run.aborted signals an
> aborted run; should we instead always write this annotation with
> value either "True" or "False"?
>
>
I think your way is OK. Is "True" how we normally spell it in QMTest?
(Check qm.fields.) We should probably use a consistent spelling.
> - Is there any documentation that should be added for these? As far
> as I can tell, annotations aren't documentated at all ATM...
>
>
>
That's probably true -- but you should fix that. :-) Let's add a new
section in the manual somewhere.
>+def get_username():
>+ """Returns the current username as a string.
>+
>+ If the username cannot be found, raises a 'QMException'."""
>+
>+ # First try using the 'getpass' module.
>+ try:
>+ return getpass.getuser()
>+ except:
>+ pass
>
>
>
Do we actually know that getpass doesn't work on Windows? The docs
don't suggest that.
>+ # 'getpass' doesn't necessarily work on Windows, so if that fails,
>+ # try the win32 function.
>+ try:
>+ import win32api
>
>
I'm a little bit afraid that we could some how get here under UNIX, and
then try to import this module, which might cause weird things to
happen. Perhaps we could assert that doesn't happen, or condition this
whole block on sys.platform the way we do elsewhere in QMTest?
The rest of the patch is excellente.
--
Mark Mitchell
CodeSourcery, LLC
(916) 791-8304
mark at codesourcery.com
More information about the qmtest
mailing list