diff --git a/.appveyor.yml b/.appveyor.yml index 56c97233d..e8f718fbb 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -23,9 +23,10 @@ install: - set PATH=%PYTHON_INSTALL%\\Scripts;%PATH% # We need to install the python-can library itself - - "python -m pip install .[test]" + - "python -m pip install .[test,neovi]" build: off test_script: - - "pytest -v --timeout=300" + - "pytest -v --timeout=300 --cov=can" + - "codecov" diff --git a/.travis.yml b/.travis.yml index 358d32666..9ce11410d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -45,12 +45,12 @@ matrix: install: - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo bash test/open_vcan.sh ; fi - - travis_retry pip install .[test] - travis_retry pip install sphinx + - travis_retry pip install .[test] script: - - pytest -v --timeout=300 + - pytest -v --timeout=300 --cov=can + - codecov # Build Docs with Sphinx - # # -a Write all files - - if [[ "$TRAVIS_PYTHON_VERSION" == "3.6" ]]; then python -m sphinx -an doc build; fi \ No newline at end of file + - if [[ "$TRAVIS_PYTHON_VERSION" == "3.6" ]]; then python -m sphinx -an doc build; fi diff --git a/can/interfaces/ics_neovi/neovi_bus.py b/can/interfaces/ics_neovi/neovi_bus.py index 6b164a0b0..7ede85909 100644 --- a/can/interfaces/ics_neovi/neovi_bus.py +++ b/can/interfaces/ics_neovi/neovi_bus.py @@ -136,7 +136,7 @@ def get_serial_number(device): def shutdown(self): super(NeoViBus, self).shutdown() ics.close_device(self.dev) - + @staticmethod def _detect_available_configs(): """Detect all configurations/channels that this interface could @@ -148,10 +148,18 @@ def _detect_available_configs(): """ if ics is None: return [] + + try: + devices = ics.find_devices() + except Exception as e: + logger.debug("Failed to detect configs: %s", e) + return [] + # TODO: add the channel(s) return [{ + 'interface': 'neovi', 'serial': NeoViBus.get_serial_number(device) - } for device in ics.find_devices()] + } for device in devices] def _find_device(self, type_filter=None, serial=None): if type_filter is not None: diff --git a/setup.py b/setup.py index a0db6fa57..c9cf2cf7c 100644 --- a/setup.py +++ b/setup.py @@ -20,13 +20,21 @@ long_description = f.read() # Dependencies +extras_require = { + 'serial': ['pyserial ~= 3.0'], + 'neovi': ['python-ics >= 2.12'] +} + tests_require = [ 'mock ~= 2.0', - 'nose ~= 1.3.7', + 'nose ~= 1.3', 'pytest ~= 3.6', 'pytest-timeout ~= 1.2', - 'pyserial ~= 3.0' -] + 'pytest-cov ~= 2.5', + 'codecov ~= 2.0' +] + extras_require['serial'] + +extras_require['test'] = tests_require setup( # Description @@ -58,11 +66,7 @@ install_requires=[ 'wrapt ~= 1.10', ], - extras_require={ - 'serial': ['pyserial >= 3.0'], - 'neovi': ['python-ics >= 2.12'], - 'test': tests_require - }, + extras_require=extras_require, # Testing test_suite="nose.collector",