Skip to content

Conversation

benjaminp
Copy link
Contributor

The way mocking is written in these tests, we need to have the underlying function around.

The way mocking is written in these tests, we need to have the underlying function around.
@benjaminp benjaminp requested a review from warsaw March 2, 2017 07:12
@benjaminp benjaminp merged commit afbb5d1 into master Mar 2, 2017
@benjaminp benjaminp deleted the benjamin-uuid-tests branch March 2, 2017 07:35
@warsaw
Copy link
Member

warsaw commented Mar 2, 2017

@benjaminp Thanks for taking a look at this. Sorry 8 hours in the middle of USA night really isn't enough time to review it though. Did this fix an actual bug you encountered, and if so what was the failure mode?

@benjaminp
Copy link
Contributor Author

I didn't expect you to review this at 2:30 AM EST; I just wanted to let you know. The problem is the tests were not properly skipped as intended, so one had, for example, on Windows:


======================================================================
ERROR: test_uuid1_bogus_return_value (test.test_uuid.TestUUID)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "D:\buildarea\3.x.ware-win81-release\build\lib\test\test_uuid.py", line 379, in test_uuid1_bogus_return_value
    'restype', lambda x: 3):
  File "D:\buildarea\3.x.ware-win81-release\build\lib\unittest\mock.py", line 1239, in __enter__
    original, local = self.get_original()
  File "D:\buildarea\3.x.ware-win81-release\build\lib\unittest\mock.py", line 1213, in get_original
    "%s does not have the attribute %r" % (target, name)
AttributeError: None does not have the attribute 'restype'

======================================================================
ERROR: test_uuid1_is_safe (test.test_uuid.TestUUID)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "D:\buildarea\3.x.ware-win81-release\build\lib\test\test_uuid.py", line 365, in test_uuid1_is_safe
    'restype', lambda x: 0):
  File "D:\buildarea\3.x.ware-win81-release\build\lib\unittest\mock.py", line 1239, in __enter__
    original, local = self.get_original()
  File "D:\buildarea\3.x.ware-win81-release\build\lib\unittest\mock.py", line 1213, in get_original
    "%s does not have the attribute %r" % (target, name)
AttributeError: None does not have the attribute 'restype'

======================================================================
ERROR: test_uuid1_is_unsafe (test.test_uuid.TestUUID)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "D:\buildarea\3.x.ware-win81-release\build\lib\test\test_uuid.py", line 372, in test_uuid1_is_unsafe
    'restype', lambda x: -1):
  File "D:\buildarea\3.x.ware-win81-release\build\lib\unittest\mock.py", line 1239, in __enter__
    original, local = self.get_original()
  File "D:\buildarea\3.x.ware-win81-release\build\lib\unittest\mock.py", line 1213, in get_original
    "%s does not have the attribute %r" % (target, name)
AttributeError: None does not have the attribute 'restype'

======================================================================
ERROR: test_uuid1_unknown (test.test_uuid.TestUUID)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "D:\buildarea\3.x.ware-win81-release\build\lib\test\test_uuid.py", line 358, in test_uuid1_unknown
    'restype', None):
  File "D:\buildarea\3.x.ware-win81-release\build\lib\unittest\mock.py", line 1239, in __enter__
    original, local = self.get_original()
  File "D:\buildarea\3.x.ware-win81-release\build\lib\unittest\mock.py", line 1213, in get_original
    "%s does not have the attribute %r" % (target, name)
AttributeError: None does not have the attribute 'restype'

----------------------------------------------------------------------

@warsaw
Copy link
Member

warsaw commented Mar 2, 2017

It's all good! Thanks for the additional details... and the fix.

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