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

timed() now enforces time limit. #982

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

belisarius222
Copy link

The timed() decorator used to wait indefinitely for its test function to return. Now it runs the test function in a new thread, and if the function doesn't return within the specified time limit, it throws a TimeExpired error.

@jszakmeister
Copy link
Contributor

What happens when the function doesn't return in the specified time frame? Does it kill the thread? That would be really bad. Is there a chance that it's going to interfere with other running tests? I don't think I like this direction, personally.

@belisarius222
Copy link
Author

Ok.

I can see how this might not be the best direction for nose, considering how general it needs to be. Adding a thread does introduce more complexity, and now that you mention it, I can see some troublesome edge cases. It should really run the function's teardown if it didn't complete, for example.

I felt compelled to write this because I kept putting @timed() decorators on tests, expecting the decorator to flag them as failures if they didn't complete in time, but instead the test will continue on, even if it's hanging. I need something like this function to test certain pieces of code that tend to hang if they're not working properly, mostly multiprocessing-related.

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

Successfully merging this pull request may close these issues.

2 participants