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

tests: assertNotRaises raises AttributeError: __exit__ #1163

Closed
marmarek opened this Issue Sep 3, 2015 · 4 comments

Comments

Projects
None yet
2 participants
@marmarek
Member

marmarek commented Sep 3, 2015

ERROR: basic/TC_01_Properties/test_000_rename
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/qubes/tests/basic.py", line 101, in test_000_rename
    with self.assertNotRaises(QubesException, OSError):
AttributeError: __exit__

@marmarek marmarek added this to the Release 3.1 milestone Sep 3, 2015

@marmarek marmarek added C: tests and removed C: core labels Sep 3, 2015

@woju

This comment has been minimized.

Show comment
Hide comment
@woju

woju Sep 8, 2015

Member

Which version of python did you use?

Member

woju commented Sep 8, 2015

Which version of python did you use?

@marmarek

This comment has been minimized.

Show comment
Hide comment
@marmarek

marmarek Sep 8, 2015

Member

2.7

Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?

Member

marmarek commented Sep 8, 2015

2.7

Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?

@woju

This comment has been minimized.

Show comment
Hide comment
@woju

woju Sep 9, 2015

Member

Oh, I see. assertNotRaises does not support multiple exceptions passed to it.

There are two ways to use it. First, as context manager, like that:

with self.assertNotRaises(Exception):
    foo(arg1, kwarg=123)

The second one:

self.assertNotRaises(Exception, foo, arg1, kwarg=123)

If you'd like to check two exceptions, nest the context, or reopen as feature request.

Member

woju commented Sep 9, 2015

Oh, I see. assertNotRaises does not support multiple exceptions passed to it.

There are two ways to use it. First, as context manager, like that:

with self.assertNotRaises(Exception):
    foo(arg1, kwarg=123)

The second one:

self.assertNotRaises(Exception, foo, arg1, kwarg=123)

If you'd like to check two exceptions, nest the context, or reopen as feature request.

@woju woju closed this Sep 9, 2015

@marmarek

This comment has been minimized.

Show comment
Hide comment
@marmarek

marmarek Sep 30, 2015

Member

It does support multiple exceptions. Just needs to pass them as a tuple.

Member

marmarek commented Sep 30, 2015

It does support multiple exceptions. Just needs to pass them as a tuple.

marmarek added a commit to marmarek/old-qubes-core-admin that referenced this issue Oct 2, 2015

marmarek added a commit to marmarek/old-qubes-core-admin that referenced this issue Oct 2, 2015

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