Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #62936 > unrolled thread
| Started by | roy@panix.com (Roy Smith) |
|---|---|
| First post | 2013-12-31 12:49 -0500 |
| Last post | 2013-12-31 20:50 -0500 |
| Articles | 3 — 3 participants |
Back to article view | Back to comp.lang.python
What does --no-skip do in nose? roy@panix.com (Roy Smith) - 2013-12-31 12:49 -0500
Re: What does --no-skip do in nose? Chris Angelico <rosuav@gmail.com> - 2014-01-01 11:14 +1100
Re: What does --no-skip do in nose? Ned Batchelder <ned@nedbatchelder.com> - 2013-12-31 20:50 -0500
| From | roy@panix.com (Roy Smith) |
|---|---|
| Date | 2013-12-31 12:49 -0500 |
| Subject | What does --no-skip do in nose? |
| Message-ID | <l9v02l$a91$1@panix2.panix.com> |
Environment: Python 2.7.3 nose 1.3.0 Ubuntu 12.04 Linux I'm befuddled about how test skipping, and in particular, --no-skip, is supposed to work in nose. I've got a trivial test file: > from nose import SkipTest > def test_skip(): > raise SkipTest > assert 0 If I run this, it skips the test, as expected: > $ nosetests try.py > S > ---------------------------------------------------------------------- > Ran 1 test in 0.001s > > OK (SKIP=1) What's confusing is, if I use --no-skip, it STILL skips the test: > $ nosetests --no-skip try.py > > ---------------------------------------------------------------------- > Ran 1 test in 0.001s > > OK The only difference is it doesn't print the "S". Am I just mis-understanding what --no-skip is supposed to do?
[toc] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2014-01-01 11:14 +1100 |
| Message-ID | <mailman.4766.1388535625.18130.python-list@python.org> |
| In reply to | #62936 |
On Wed, Jan 1, 2014 at 4:49 AM, Roy Smith <roy@panix.com> wrote: >> from nose import SkipTest >> def test_skip(): >> raise SkipTest >> assert 0 > > What's confusing is, if I use --no-skip, it STILL skips the test: > I don't know nosetests, but I'm fairly sure it's not going to be mangling the Python language itself. Once you say "raise", the rest of the code isn't going to run. If you were calling "skip_test()", then I could imagine it either raising SkipTest or not based on a command-line parameter, but if there's no such function and you directly raise the exception, there's not a lot else Python can do. ChrisA
[toc] | [prev] | [next] | [standalone]
| From | Ned Batchelder <ned@nedbatchelder.com> |
|---|---|
| Date | 2013-12-31 20:50 -0500 |
| Message-ID | <mailman.4768.1388541053.18130.python-list@python.org> |
| In reply to | #62936 |
On 12/31/13 12:49 PM, Roy Smith wrote:
> Environment:
> Python 2.7.3
> nose 1.3.0
> Ubuntu 12.04 Linux
>
> I'm befuddled about how test skipping, and in particular, --no-skip,
> is supposed to work in nose. I've got a trivial test file:
>
>> from nose import SkipTest
>> def test_skip():
>> raise SkipTest
>> assert 0
>
> If I run this, it skips the test, as expected:
>
>
>> $ nosetests try.py
>> S
>> ----------------------------------------------------------------------
>> Ran 1 test in 0.001s
>>
>> OK (SKIP=1)
>
>
> What's confusing is, if I use --no-skip, it STILL skips the test:
>
>> $ nosetests --no-skip try.py
>>
>> ----------------------------------------------------------------------
>> Ran 1 test in 0.001s
>>
>> OK
>
> The only difference is it doesn't print the "S". Am I just
> mis-understanding what --no-skip is supposed to do?
>
I don't understand why, but my tests confirm what you found: if a test
raises SkipTest, then it is marked as an S, and included in the count of
tests run. If you run with --no-skip, then the result of the test isn't
displayed in the dots at all, but the test is still included in the
total count:
$ nosetests
F.S
======================================================================
FAIL: test_fail (test_foo.Test)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/ned/lab/test_foo.py", line 8, in test_fail
assert 0
AssertionError
----------------------------------------------------------------------
Ran 3 tests in 0.004s
FAILED (SKIP=1, failures=1)
$ nosetests --no-skip
F.
======================================================================
FAIL: test_fail (test_foo.Test)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/ned/lab/test_foo.py", line 8, in test_fail
assert 0
AssertionError
----------------------------------------------------------------------
Ran 3 tests in 0.003s
FAILED (failures=1)
--
Ned Batchelder, http://nedbatchelder.com
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web