Skip to content
This repository was archived by the owner on Jun 9, 2022. It is now read-only.

Commit 506a6ed

Browse files
author
Venkat Venkataraju
committed
fixes per feedback
1 parent 7243107 commit 506a6ed

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

setup.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727

2828
from u2flib_host.yubicommon.setup import setup
2929

30+
tests_require = ['cryptography>=1.0']
31+
if (sys.version_info < (3, 3)):
32+
tests_require.append('mock')
3033

3134
setup(
3235
name='python-u2flib-host',
@@ -44,7 +47,7 @@
4447
'u2f-authenticate=u2flib_host.authenticate:main',
4548
],
4649
},
47-
tests_require=['cryptography>=1.0'],
50+
tests_require=tests_require,
4851
extras_require={
4952
'soft_device': ['cryptography>=1.0'],
5053
},

test/test_hid_transport.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,13 @@
33
from u2flib_host import hid_transport
44
from u2flib_host import exc
55
from u2flib_host.yubicommon.compat import byte2int, int2byte
6-
from mock import patch
76

8-
class TestHIDDevice():
7+
try:
8+
from unittest.mock import patch
9+
except ImportError:
10+
from mock import patch
11+
12+
class TestHIDDevice(object):
913
def write(self, payload):
1014
self.cid = payload[1:5]
1115
self.cmd = payload[5] ^ hid_transport.TYPE_INIT
@@ -46,7 +50,7 @@ def test_init(self):
4650
dev.init()
4751
self.assertEqual(dev.capabilities, 0x05)
4852

49-
def test_init_invalid_nounce(self):
53+
def test_init_invalid_nonce(self):
5054
with patch.object(os, 'urandom', return_value=(b'\xab'*8)) as mock_method:
5155
hid_device = TestHIDDevice()
5256
hid_device.response = HIDDeviceTest.build_response(

0 commit comments

Comments
 (0)