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

Allow a global context for setting the assertion exception class to be thrown on failures #29

Open
vmalloc opened this issue Feb 24, 2013 · 1 comment

Comments

@vmalloc
Copy link
Contributor

vmalloc commented Feb 24, 2013

In testing, it is very useful to separate random exceptions thrown from code from actual test assertion failures (unittest, nose and friends go at this half way by categorizing failures vs. errors).

In some of the environments one would like to use a custom exception type for assertions, to prevent confusions from actual assert statements inside his or her code.

It would be nice to do something like:

import sure

...

with sure.set_assertion_class(MyAssertionError):
    (2).should.be.a(str)

Of course this can also be a global setup function, but as a context/thread local it would be more flexible.

@timofurrer
Copy link
Collaborator

@gabrielfalcao what do you think about this?

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

3 participants