Add pyserial adapter for --list-deps
This commit is contained in:
parent
240ab0d226
commit
44b6307046
@ -29,6 +29,7 @@ def format_dependency_list(adapters=None):
|
||||
pyspotify_info,
|
||||
pylast_info,
|
||||
dbus_info,
|
||||
serial_info,
|
||||
]
|
||||
|
||||
lines = []
|
||||
@ -107,3 +108,14 @@ def dbus_info():
|
||||
except ImportError:
|
||||
pass
|
||||
return dep_info
|
||||
|
||||
|
||||
def serial_info():
|
||||
dep_info = {'name': 'pyserial'}
|
||||
try:
|
||||
import serial
|
||||
dep_info['version'] = serial.VERSION
|
||||
dep_info['path'] = serial.__file__
|
||||
except ImportError:
|
||||
pass
|
||||
return dep_info
|
||||
|
||||
@ -13,6 +13,11 @@ try:
|
||||
except ImportError:
|
||||
pylast = False
|
||||
|
||||
try:
|
||||
import serial
|
||||
except ImportError:
|
||||
serial = False
|
||||
|
||||
try:
|
||||
import spotify
|
||||
except ImportError:
|
||||
@ -81,3 +86,11 @@ class DepsTest(unittest.TestCase):
|
||||
self.assertEquals('dbus-python', result['name'])
|
||||
self.assertEquals(dbus.__version__, result['version'])
|
||||
self.assertIn('dbus', result['path'])
|
||||
|
||||
@unittest.skipUnless(serial, 'serial not found')
|
||||
def test_serial_info(self):
|
||||
result = deps.serial_info()
|
||||
|
||||
self.assertEquals('pyserial', result['name'])
|
||||
self.assertEquals(serial.VERSION, result['version'])
|
||||
self.assertIn('serial', result['path'])
|
||||
|
||||
Loading…
Reference in New Issue
Block a user