Skip to content

fix deprecation warnings #1161

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

Merged
merged 3 commits into from
Jan 18, 2018

Conversation

cmccandless
Copy link
Contributor

In changes made in #1113, a convention was added to ensure that all exceptions raises by exercise solutions contained messages. The existing Python2/3 compatible solution was actually calling assertRaisesRegexp in Python3, raising DeprecationWarnings in the Travis-CI output for all Python3 builds. This PR fixes this, accomplishing the original intent to call assertRaisesRegex in Python3 and assertRaisesRegexp in Python2.

@@ -82,9 +82,10 @@ def test_both_bases_are_negative(self):
# Utility functions
def setUp(self):
try:
self.assertRaisesRegex = self.assertRaisesRegexp
with self.assertRaisesRegex(AttributeError, r".+"):
raise AttributeError('x')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A cleaner solution is to just call self.assertRaisesRegex without actually using it.

try:
    self.assertRaisesRegex
except AttributeError:
    self.assertRaisesRegex = self.assertRaisesRegexp

@N-Parsons N-Parsons self-assigned this Jan 18, 2018
@N-Parsons N-Parsons merged commit efa7636 into exercism:master Jan 18, 2018
@N-Parsons
Copy link
Contributor

Thanks @cmccandless!

@cmccandless cmccandless deleted the fix-deprecation-warnings branch August 5, 2019 14:52
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