def test_custom_url(self):
"""custom protocol handlers"""
# it's unknown
self.assertRaises(ValueError, serial.serial_for_url, "test://")
# add search path
serial.protocol_handler_packages.append('handlers')
# now it should work
serial.serial_for_url("test://")
# remove our handler again
serial.protocol_handler_packages.remove('handlers')
# so it should not work anymore
self.assertRaises(ValueError, serial.serial_for_url, "test://")
评论列表
文章目录