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

Convert tests to regex versions #452

Merged
merged 4 commits into from Jul 28, 2020
Merged

Convert tests to regex versions #452

merged 4 commits into from Jul 28, 2020

Conversation

@grvvy
Copy link
Contributor

@grvvy grvvy commented Jul 27, 2020

No description provided.

@whitequark
Copy link
Member

@whitequark whitequark commented Jul 28, 2020

Thanks. Can you remove the implementations of assertRaises and assertWarns too?

Loading

@grvvy
Copy link
Contributor Author

@grvvy grvvy commented Jul 28, 2020

Okay, there are a few calls left to the non-regex versions that don’t contain a msg argument. I’m guessing those should be changed over to regex versions as well then?

Loading

@whitequark
Copy link
Member

@whitequark whitequark commented Jul 28, 2020

I mean these:

@contextmanager
def assertRaises(self, exception, msg=None):
with super().assertRaises(exception) as cm:
yield
if msg is not None:
# WTF? unittest.assertRaises is completely broken.
self.assertEqual(str(cm.exception), msg)
@contextmanager
def assertWarns(self, category, msg=None):
with warnings.catch_warnings(record=True) as warns:
yield
self.assertEqual(len(warns), 1)
self.assertEqual(warns[0].category, category)
if msg is not None:
self.assertEqual(str(warns[0].message), msg)

Loading

@whitequark
Copy link
Member

@whitequark whitequark commented Jul 28, 2020

I’m guessing those should be changed over to regex versions as well then?

Nope, they should work fine as-is, with no additional changes.

Loading

@whitequark whitequark merged commit 8117ef6 into nmigen:master Jul 28, 2020
5 checks passed
Loading
@whitequark
Copy link
Member

@whitequark whitequark commented Jul 28, 2020

Thank you!

Loading

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

Successfully merging this pull request may close these issues.

None yet

2 participants