Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to skip it per-test? #4

Open
slinkp opened this issue Dec 2, 2015 · 3 comments
Open

Option to skip it per-test? #4

slinkp opened this issue Dec 2, 2015 · 3 comments

Comments

@slinkp
Copy link

slinkp commented Dec 2, 2015

It would be awesome if there was eg. a decorator that would cause a test case to be ignored by nose-detecthttp.

Use case: possibly not common, but I have a regression test for a failure that happens deep in httplib when any header is of type unicode and the body contains binary data. (On python 2.7 this causes UnicodeDecodeError).

I can't use VCR for this regression test because it would intercept the call at too high a level (up in httplib2). So I want to instead mock.patch a method in httplib itself, deep enough to prevent network access, but still allow the error condition to be triggered.

Since we're using nose-detecthttp, I can't do that without it complaining every time I run the test. And if I decorate my test method with use_cassette, then vcr intercepts the call at too high a level (up in httplib2) and the bug would never actually be triggered. So my regression test case is no longer verifying that my bugfix hasn't regressed ... it will always pass unless I force vcr to re-record.

@simon-weber
Copy link
Contributor

Gotcha; opting out sounds good to me.

Would a nose attr be a reasonable place to put this flag? I haven't seen them used that way before, but it's the easiest place I can think to put this.

@slinkp
Copy link
Author

slinkp commented Dec 2, 2015

That sounds fine to me, thanks!
On Dec 2, 2015 3:35 PM, "Simon Weber" [email protected] wrote:

Gotcha; opting out sounds good to me.

Would a nose attr
http://nose.readthedocs.org/en/latest/plugins/attrib.html be a
reasonable place to put this flag? I haven't seen them used that way
before, but it's the easiest place I can think to put this.


Reply to this email directly or view it on GitHub
#4 (comment)
.

@simon-weber
Copy link
Contributor

Hm, this turns out to not be as straightforward as I thought. I'm having trouble getting access to the actual method inside startTest because of the way nose structures test cases.

Here's a workaround until I think of a better way to do this: add an attr no-detecthttp to the tests you want to skip. Then run your test suite with:

nosetests -a '!no-detecthttp' --with-detecthttp && nosetests -a 'no-detecthttp'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants