Skip to content

Commit 63d57e2

Browse files
authored
Add coverage reports to repo and CI tests (hardbyte#346)
1 parent 0b7de38 commit 63d57e2

4 files changed

Lines changed: 29 additions & 16 deletions

File tree

.appveyor.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@ install:
2323
- set PATH=%PYTHON_INSTALL%\\Scripts;%PATH%
2424

2525
# We need to install the python-can library itself
26-
- "python -m pip install .[test]"
26+
- "python -m pip install .[test,neovi]"
2727

2828
build: off
2929

3030
test_script:
31-
- "pytest -v --timeout=300"
31+
- "pytest -v --timeout=300 --cov=can"
32+
- "codecov"

.travis.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ matrix:
4545

4646
install:
4747
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo bash test/open_vcan.sh ; fi
48-
- travis_retry pip install .[test]
4948
- travis_retry pip install sphinx
49+
- travis_retry pip install .[test]
5050

5151
script:
52-
- pytest -v --timeout=300
52+
- pytest -v --timeout=300 --cov=can
53+
- codecov
5354
# Build Docs with Sphinx
54-
#
5555
# -a Write all files
56-
- if [[ "$TRAVIS_PYTHON_VERSION" == "3.6" ]]; then python -m sphinx -an doc build; fi
56+
- if [[ "$TRAVIS_PYTHON_VERSION" == "3.6" ]]; then python -m sphinx -an doc build; fi

can/interfaces/ics_neovi/neovi_bus.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def get_serial_number(device):
136136
def shutdown(self):
137137
super(NeoViBus, self).shutdown()
138138
ics.close_device(self.dev)
139-
139+
140140
@staticmethod
141141
def _detect_available_configs():
142142
"""Detect all configurations/channels that this interface could
@@ -148,10 +148,18 @@ def _detect_available_configs():
148148
"""
149149
if ics is None:
150150
return []
151+
152+
try:
153+
devices = ics.find_devices()
154+
except Exception as e:
155+
logger.debug("Failed to detect configs: %s", e)
156+
return []
157+
151158
# TODO: add the channel(s)
152159
return [{
160+
'interface': 'neovi',
153161
'serial': NeoViBus.get_serial_number(device)
154-
} for device in ics.find_devices()]
162+
} for device in devices]
155163

156164
def _find_device(self, type_filter=None, serial=None):
157165
if type_filter is not None:

setup.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,21 @@
2020
long_description = f.read()
2121

2222
# Dependencies
23+
extras_require = {
24+
'serial': ['pyserial ~= 3.0'],
25+
'neovi': ['python-ics >= 2.12']
26+
}
27+
2328
tests_require = [
2429
'mock ~= 2.0',
25-
'nose ~= 1.3.7',
30+
'nose ~= 1.3',
2631
'pytest ~= 3.6',
2732
'pytest-timeout ~= 1.2',
28-
'pyserial ~= 3.0'
29-
]
33+
'pytest-cov ~= 2.5',
34+
'codecov ~= 2.0'
35+
] + extras_require['serial']
36+
37+
extras_require['test'] = tests_require
3038

3139
setup(
3240
# Description
@@ -58,11 +66,7 @@
5866
install_requires=[
5967
'wrapt ~= 1.10',
6068
],
61-
extras_require={
62-
'serial': ['pyserial >= 3.0'],
63-
'neovi': ['python-ics >= 2.12'],
64-
'test': tests_require
65-
},
69+
extras_require=extras_require,
6670

6771
# Testing
6872
test_suite="nose.collector",

0 commit comments

Comments
 (0)