Skip to content

Commit 7177f33

Browse files
committed
more robust test xfail
1 parent f163d83 commit 7177f33

File tree

3 files changed

+30
-29
lines changed

3 files changed

+30
-29
lines changed

.coveragerc

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[run]
2+
cover_pylib = false
3+
omit =
4+
/home/travis/virtualenv/*
5+
*/site-packages/*
6+
*/bin/*
7+
8+
[report]
9+
exclude_lines =
10+
pragma: no cover
11+
def __repr__
12+
except RuntimeError
13+
except NotImplementedError
14+
except ImportError
15+
except FileNotFoundError
16+
except CalledProcessError
17+
logging.warning
18+
logging.error
19+
logging.critical
20+
if __name__ == .__main__.:

setup.cfg

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ cov =
4141
coveralls
4242
flake8
4343
mypy
44-
io =
44+
io =
4545
simplekml
4646

4747
[options.entry_points]
@@ -53,24 +53,3 @@ console_scripts =
5353
[flake8]
5454
max-line-length = 132
5555
exclude = .git,__pycache__,.eggs/,doc/,docs/,build/,dist/,archive/
56-
57-
[coverage:run]
58-
cover_pylib = false
59-
omit =
60-
/home/travis/virtualenv/*
61-
*/site-packages/*
62-
*/bin/*
63-
64-
[coverage:report]
65-
exclude_lines =
66-
pragma: no cover
67-
def __repr__
68-
except RuntimeError
69-
except NotImplementedError
70-
except ImportError
71-
except FileNotFoundError
72-
except CalledProcessError
73-
logging.warning
74-
logging.error
75-
logging.critical
76-
if __name__ == .__main__.:

tests/test_all.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,23 @@
22
import pytest
33
import mozloc
44
import datetime
5-
import os
5+
import subprocess
66

7-
CI = bool(os.environ['CI']) if 'CI' in os.environ else False
87

9-
10-
@pytest.mark.skipif(CI, reason="CI doesn't have WiFi")
118
def test_nm_loc():
12-
loc = mozloc.get_nmcli()
9+
try:
10+
loc = mozloc.get_nmcli()
11+
except subprocess.CalledProcessError as e:
12+
pytest.xfail(f'problem with NMCLI API--old NMCLI version? {e}')
1313
assert isinstance(loc, dict)
1414
assert isinstance(loc['t'], datetime.datetime)
1515

1616

17-
@pytest.mark.skipif(CI, reason="CI doesn't have WiFi")
1817
def test_nm_connection():
19-
mozloc.nm_config_check()
18+
try:
19+
mozloc.nm_config_check()
20+
except subprocess.CalledProcessError as e:
21+
pytest.xfail(f'problem with NMCLI WiFi API--do you have WiFi? {e}')
2022

2123

2224
if __name__ == '__main__':

0 commit comments

Comments
 (0)