Skip to content

Fix for TypeError in python 3.7 and pytest#113

Merged
kvesteri merged 1 commit intopython-validators:masterfrom
agiletechnologist:patch-1
Jan 24, 2019
Merged

Fix for TypeError in python 3.7 and pytest#113
kvesteri merged 1 commit intopython-validators:masterfrom
agiletechnologist:patch-1

Conversation

@agiletechnologist
Copy link
Copy Markdown
Contributor

pytest with throw this error when running in version 3.7:
"TypeError: catching classes that do not inherit from BaseException is not allowed"
Changing the inheritance from object to Exception will fix this and is compatible back to version 2.7 and should cause no issues.

This pytest sample test that will trigger the error in python 3.7:
def test_init_with_bad_url(self):
with pytest.raises(validators.ValidationFailure):
assert True

pytest with throw this error when running in version 3.7:
"TypeError: catching classes that do not inherit from BaseException is not allowed"
Changing the inheritance from object to Exception will fix this and is compatible back to version 2.7 and should cause no issues. 

This pytest sample test that will trigger the error in python 3.7:
   def test_init_with_bad_url(self):
        with pytest.raises(validators.ValidationFailure):
            assert True
@kvesteri kvesteri merged commit 359653a into python-validators:master Jan 24, 2019
@kvesteri
Copy link
Copy Markdown
Collaborator

Thanks for the PR! 🚋

@agiletechnologist agiletechnologist deleted the patch-1 branch January 24, 2019 14:05
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