From 5e2f862dd5ba61eadff341dbf0a1202e91b1b145 Mon Sep 17 00:00:00 2001 From: Cary Zhao Date: Mon, 22 Nov 2021 10:42:06 -0800 Subject: [PATCH] fix DeprecationWarning for logging and fake_filesystem --- pyu2f/hid/macos.py | 2 +- pyu2f/tests/hid/linux_test.py | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) Index: pyu2f-0.1.5a/pyu2f/hid/macos.py =================================================================== --- pyu2f-0.1.5a.orig/pyu2f/hid/macos.py +++ pyu2f-0.1.5a/pyu2f/hid/macos.py @@ -174,7 +174,7 @@ if sys.platform.startswith('darwin'): ctypes.POINTER(ctypes.c_uint8), CF_INDEX] else: - logger.warn('Not running on MacOS') + logger.warning('Not running on MacOS') def CFStr(s): Index: pyu2f-0.1.5a/pyu2f/tests/hid/linux_test.py =================================================================== --- pyu2f-0.1.5a.orig/pyu2f/tests/hid/linux_test.py +++ pyu2f-0.1.5a/pyu2f/tests/hid/linux_test.py @@ -49,14 +49,14 @@ KEYBOARD_RD = ( def AddDevice(fs, dev_name, product_name, vendor_id, product_id, report_descriptor_b64): - uevent = fs.CreateFile('/sys/class/hidraw/%s/device/uevent' % dev_name) - rd = fs.CreateFile('/sys/class/hidraw/%s/device/report_descriptor' % dev_name) + uevent = fs.create_file('/sys/class/hidraw/%s/device/uevent' % dev_name) + rd = fs.create_file('/sys/class/hidraw/%s/device/report_descriptor' % dev_name) report_descriptor = base64.b64decode(report_descriptor_b64) - rd.SetContents(report_descriptor) + rd.set_contents(report_descriptor) buf = 'HID_NAME=%s\n' % product_name.encode('utf8') buf += 'HID_ID=0001:%08X:%08X\n' % (vendor_id, product_id) - uevent.SetContents(buf) + uevent.set_contents(buf) class FakeDeviceOsModule(object): @@ -79,10 +79,10 @@ class FakeDeviceOsModule(object): class LinuxTest(unittest.TestCase): def setUp(self): self.fs = fake_filesystem.FakeFilesystem() - self.fs.CreateDirectory('/sys/class/hidraw') + self.fs.create_dir('/sys/class/hidraw') def tearDown(self): - self.fs.RemoveObject('/sys/class/hidraw') + self.fs.remove_object('/sys/class/hidraw') def testCallEnumerate(self): AddDevice(self.fs, 'hidraw1', 'Logitech USB Keyboard',