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

Add decorator to set timer thresholds per test #80

Open
cryptk opened this issue Jan 13, 2017 · 6 comments
Open

Add decorator to set timer thresholds per test #80

cryptk opened this issue Jan 13, 2017 · 6 comments

Comments

@cryptk
Copy link

cryptk commented Jan 13, 2017

In a given test suite, some tests are expected to pass in different amounts of time. Currently with the --timer-(ok|warning|error) flags, you can only set the threshold for every test all at once. It would be really nice if there was a decorator that you could use to specify the threshold on a per-test basis.

As an example, I am testing an API where some tests are very fast (list all of your assets) and other tests take longer (create a new asset and wait for it to finish). It would be nice to be able to warn or error if the first test took more than a second, but this would be inappropriate for the latter test (which can take up to a minute).

Something like this would be great

@timer_warn(1)
@timer_error(5)
def fast_test():
    pass

@timer_warn(60)
@timer_error(120)
def slow_test():
    pass
@skudriashev
Copy link
Collaborator

@mahmoudimus, what you think about this?

@mahmoudimus
Copy link
Owner

@skudriashev @cryptk that's a seriously cool idea!

@e0ne
Copy link
Collaborator

e0ne commented Jul 12, 2017

@cryptk great idea! are you going to implement it or just would like to propose this feature?

@cryptk
Copy link
Author

cryptk commented Jul 12, 2017

@e0ne Currently I am just proposing it as a feature, sadly I don't currently have the time to write it myself.

@JoaoGFarias
Copy link

Adding other proposes for the decorator:
@time_warning(value=15, unit='ms')
@time_error(value=15, unit='ms')

@radzhome
Copy link

I was thinking a timer warning exempt decorator but this would be even better!

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

No branches or pull requests

6 participants