TestAddress for test function generator?

93 views
Skip to first unread message

Buck

unread,
Apr 23, 2011, 1:43:10 PM4/23/11
to nose-users
We have a test generator which generates hundreds of tests, but we're
seeing this one failure:

FAIL: test_revrc.test_small('/home/buck/myinput.txt',)

Is there any way to tell nose that I want to re-run the test with just
this specific argument?
Is there a different testing scheme I should use in this case?

--Buck


jason pellerin

unread,
Apr 25, 2011, 9:11:28 AM4/25/11
to nose-...@googlegroups.com
There's no way to tell nose to run only one particular param in a
generator test, unfortunately. If you want to be able to address test
cases individually, they have to be made known to nose at load time.
One way to do that is to use a metaclass or class decorator to inject
test case methods into a test class -- then you can address them by
name like normal methods.

JP

> --
> You received this message because you are subscribed to the Google Groups "nose-users" group.
> To post to this group, send email to nose-...@googlegroups.com.
> To unsubscribe from this group, send email to nose-users+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/nose-users?hl=en.
>
>

Raghuram Devarakonda

unread,
Apr 25, 2011, 3:05:48 PM4/25/11
to nose-...@googlegroups.com


On Mon, Apr 25, 2011 at 9:11 AM, jason pellerin <jpel...@gmail.com> wrote:
There's no way to tell nose to run only one particular param in a
generator test, unfortunately. If you want to be able to address test
cases individually, they have to be made known to nose at load time.
One way to do that is to use a metaclass or class decorator to inject
test case methods into a test class -- then you can address them by
name like normal methods.

JP



Interestingly, a similar question came up on TestNG user list today and it turns out that TestNG saves the indices of the failed tests so it can run only the failed iterations of a DataProvider based test (which is similar to generator based tests in nose). For example, if a DataProvider created 3 test cases and last one failed, TestNG would save "2" as failed and next time when the same DataProvider test is run, it would ignore the first two returned test cases but runs third one. More discussion can be found here:
    http://groups.google.com/group/testng-users/browse_thread/thread/5684b62846fe57d0

Perhaps the same logic can be followed in "Testid" plugin.

Thanks,
Raghu


Kumar McMillan

unread,
Apr 25, 2011, 3:18:46 PM4/25/11
to nose-...@googlegroups.com
On Mon, Apr 25, 2011 at 2:05 PM, Raghuram Devarakonda
<drag...@gmail.com> wrote:
> Interestingly, a similar question came up on TestNG user list today and it
> turns out that TestNG saves the indices

Yeah, we could probably add support for this with indices (assuming
they don't change in the generator).

As nose currently stands, you could make the test address
test_revrc.py:test_small and it will at least run just the generated
tests.


As a side note, I have done some work on translating test_address()
into a reliable path that can be fed back to Nose to run a specific
test. It is currently in a plugin but has gone through enough bug
fixes that I might move it to core:
https://github.com/kumar303/nose-nicedots/blob/0a525be9fe1ea6347d86a0b3ce6db88b9a4fdf23/nosenicedots/plugin.py#L128
https://github.com/kumar303/nose-nicedots/blob/0a525be9fe1ea6347d86a0b3ce6db88b9a4fdf23/nosenicedots/tests/test_units.py#L15

> of the failed tests so it can run
> only the failed iterations of a DataProvider based test (which is similar to
> generator based tests in nose). For example, if a DataProvider created 3
> test cases and last one failed, TestNG would save "2" as failed and next
> time when the same DataProvider test is run, it would ignore the first two
> returned test cases but runs third one. More discussion can be found here:
>
> http://groups.google.com/group/testng-users/browse_thread/thread/5684b62846fe57d0
>
> Perhaps the same logic can be followed in "Testid" plugin.
>
> Thanks,
> Raghu
>
>

Reply all
Reply to author
Forward
0 new messages