pyrollbar
pyrollbar copied to clipboard
fallback to unittest when unittest2 is not available
unittest2 is not neccessary in python3
@pgajdos Well, the question remains: why is it needed for Python 2.7? (it would be nice to mention it in changelog/spec file)? Is it really needed?
@mcepl
[ 7s] ____ SerializableTransformTest.test_encode_with_custom_repr_returns_object _____
[ 7s]
[ 7s] self = <rollbar.test.test_serializable_transform.SerializableTransformTest testMethod=test_encode_with_custom_repr_returns_object>
[ 7s]
[ 7s] def test_encode_with_custom_repr_returns_object(self):
[ 7s] class CustomRepr(object):
[ 7s] def __repr__(self):
[ 7s] return {'hi': 'there'}
[ 7s]
[ 7s] start = {'hello': 'world', 'custom': CustomRepr()}
[ 7s]
[ 7s] serializable = SerializableTransform(whitelist_types=[CustomRepr])
[ 7s] result = transforms.transform(start, serializable)
[ 7s] > self.assertRegex(result['custom'], "<class '.*CustomRepr'>")
[ 7s] E AttributeError: 'SerializableTransformTest' object has no attribute 'assertRegex'
[ 7s]
I think it is lost time to deal with it more as 2.7 is eol.
import six
six.assertRegex(self, result['custom'], "<class '.*CustomRepr'>")
I think it is lost time to deal with it more as 2.7 is eol.
Not for SLE (although python-rollbar is not in SLE).
@mcepl
import six six.assertRegex(self, result['custom'], "<class '.*CustomRepr'>")
Unfortunately, that does not work for me so.
I think it is lost time to deal with it more as 2.7 is eol.
Not for SLE (although
python-rollbaris not in SLE).
I do not discuss downstream matters in upstream issues. (I do not see the issue with above patch in SLE, though, perhaps bit of reasoning would help me understand the problem.)
Done.
Hmm, @mrunalk and @mcepl: so should I actually revert to (original) cdfc35b?
I do not insist on making this change myself, so feel free to do the change yourself, if you wish -- I can just file an issue, if you think it would be better.
Hmm, @mrunalk and @mcepl: so should I actually revert to (original) cdfc35b?
I do not insist on making this change myself, so feel free to do the change yourself, if you wish -- I can just file an issue, if you think it would be better.
I still haven’t got a reply to my answer what capabilities of python3/unittest2 is used in the test suite. Do we need unittest2 (with Python 2.7) at all?
@mcepl
See https://github.com/rollbar/pyrollbar/pull/340#issuecomment-649349929.
Hmm, @mrunalk and @mcepl: so should I actually revert to (original) cdfc35b?
I do not insist on making this change myself, so feel free to do the change yourself, if you wish -- I can just file an issue, if you think it would be better.
I am OK removing 'unittest2' but Not OK with removing support for python2 at this time. Alternatively I can merge your original patch of 'fallback to unittest when unittest2 is not available' if you can provide some explanation on what is motivating on this change that will help understand the context.
I am OK removing 'unittest2' but Not OK with removing support for python2 at this time.
I completely agree, see the linked pull request.