Message177748
| Author |
berker.peksag |
| Recipients |
asvetlov, berker.peksag, eric.araujo, hieu.nguyen, michael.foord, pitrou |
| Date |
2012年12月19日.15:47:15 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1355932109.91.0.732415919675.issue14266@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
Antoine and Éric: Thank you for the reviews and suggestions.
> Why the "__unittest" variable?
I added the "__unittest" variable after read issue 7815 and the related
changeset: http://hg.python.org/cpython/rev/2858cae540e4/
See also:
- http://stackoverflow.com/questions/12583015/how-can-i-hide-my-stack-frames-in-a-testcase-subclass
- https://github.com/nose-devs/nose2/pull/28/files
However, without the variable tracebacks are still clear:
$ pyunit -v
test_acc (test_bar.TestAcc) ... ok
test_acc_negative (test_bar.TestAccNegative) ... ok
test_mul (test_foo.TestMul) ... ok
test_mul_negative (test_foo.TestMulNegative) ... ok
test_mul (test_baz.TestMul) ... FAIL
======================================================================
FAIL: test_mul (test_baz.TestMul)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/berker/hacking/cpython/test_baz.py", line 12, in test_mul
self.assertEqual(3, mul(2, 2))
AssertionError: 3 != 4
----------------------------------------------------------------------
Ran 5 tests in 0.002s
FAILED (failures=1)
> Also, it would be better to make unittest's API more flexible, rather
> than manually tweaking sys.argv to enable discovery.
You're right. Something like that? unittest.main(discover=True)
> About the script: can’t it be as simple as runpy.run_module?
I will try that, thanks. |
|