Skip to content

Commit 85b67a3

Browse files
pombredannesbs2001
authored andcommitted
Display failed command in test failure trace
This makes it easy to reproduce errors by copy/pasting the faulty command. Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
1 parent ce09746 commit 85b67a3

1 file changed

Lines changed: 12 additions & 9 deletions

File tree

vulnerabilities/tests/test_basics.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,22 @@
2626
import sys
2727
import unittest
2828

29-
3029
root_dir = dirname(dirname(dirname(__file__)))
3130
bin_dir = dirname(sys.executable)
3231

3332

3433
class BaseTests(unittest.TestCase):
3534

3635
def test_codestyle(self):
37-
subprocess.check_output(
38-
(
39-
join(bin_dir, "pycodestyle") +
40-
" --exclude=migrations,settings.py,venv,lib_oval.py,test_ubuntu.py,"
41-
"test_suse.py,test_data_source.py "
42-
"--max-line-length=100 "
43-
"vulnerablecode vulnerabilities"
44-
).split(), cwd=root_dir)
36+
args = (
37+
join(bin_dir, "pycodestyle") +
38+
" --exclude=migrations,settings.py,venv,lib_oval.py,test_ubuntu.py,"
39+
"test_suse.py,test_data_source.py "
40+
"--max-line-length=100 "
41+
"vulnerablecode vulnerabilities"
42+
)
43+
try:
44+
45+
subprocess.check_output(args.split(), cwd=root_dir)
46+
except Exception as e:
47+
raise Exception(f'failed to run:\n{args}') from e

0 commit comments

Comments
 (0)