Skip to content

Commit

Permalink
Fix for TypeError in python 3.7 (python-validators#113)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Max Blackmer, CSM authored and kvesteri committed Jan 24, 2019
1 parent fc0eeae commit 359653a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion validators/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from decorator import decorator


class ValidationFailure(object):
class ValidationFailure(Exception):
def __init__(self, func, args):
self.func = func
self.__dict__.update(args)
Expand Down

0 comments on commit 359653a

Please sign in to comment.