44import sys
55
66from . import call_vulture , REPO , WHITELISTS
7+ from vulture .utils import ExitCode
78
89
910def test_module_with_explicit_whitelists ():
10- assert call_vulture (["vulture/" ] + WHITELISTS ) == 0
11+ assert call_vulture (["vulture/" ] + WHITELISTS ) == ExitCode . NoDeadCode
1112
1213
1314def test_module_with_implicit_whitelists ():
14- assert call_vulture (["vulture/" ]) == 0
15+ assert call_vulture (["vulture/" ]) == ExitCode . NoDeadCode
1516
1617
1718def test_module_without_whitelists ():
18- assert call_vulture (["vulture/" , "--exclude" , "whitelists" ]) == 1
19+ assert (
20+ call_vulture (["vulture/" , "--exclude" , "whitelists" ])
21+ == ExitCode .DeadCode
22+ )
1923
2024
2125def test_missing_file ():
22- assert call_vulture (["missing.py" ]) == 1
26+ assert call_vulture (["missing.py" ]) == ExitCode . InvalidInput
2327
2428
2529def test_tests ():
26- assert call_vulture (["tests/" ]) == 0
30+ assert call_vulture (["tests/" ]) == ExitCode . NoDeadCode
2731
2832
2933def test_whitelists_with_python ():
3034 for whitelist in WHITELISTS :
31- assert subprocess .call ([sys .executable , whitelist ], cwd = REPO ) == 0
35+ assert (
36+ subprocess .call ([sys .executable , whitelist ], cwd = REPO )
37+ == ExitCode .NoDeadCode
38+ )
3239
3340
3441def test_pyc ():
3542 assert call_vulture (["missing.pyc" ]) == 1
3643
3744
3845def test_sort_by_size ():
39- assert call_vulture (["vulture/utils.py" , "--sort-by-size" ]) == 1
46+ assert (
47+ call_vulture (["vulture/utils.py" , "--sort-by-size" ])
48+ == ExitCode .DeadCode
49+ )
4050
4151
4252def test_min_confidence ():
@@ -50,7 +60,7 @@ def test_min_confidence():
5060 "100" ,
5161 ]
5262 )
53- == 0
63+ == ExitCode . NoDeadCode
5464 )
5565
5666
@@ -61,15 +71,23 @@ def get_csv(paths):
6171 def call_vulture_with_excludes (excludes ):
6272 return call_vulture (["vulture/" , "--exclude" , get_csv (excludes )])
6373
64- assert call_vulture_with_excludes (["core.py" , "utils.py" ]) == 1
65- assert call_vulture_with_excludes (glob .glob ("vulture/*.py" )) == 0
74+ assert (
75+ call_vulture_with_excludes (["core.py" , "utils.py" ])
76+ == ExitCode .DeadCode
77+ )
78+ assert (
79+ call_vulture_with_excludes (glob .glob ("vulture/*.py" ))
80+ == ExitCode .NoDeadCode
81+ )
6682
6783
6884def test_make_whitelist ():
6985 assert (
7086 call_vulture (
7187 ["vulture/" , "--make-whitelist" , "--exclude" , "whitelists" ]
7288 )
73- == 1
89+ == ExitCode .DeadCode
90+ )
91+ assert (
92+ call_vulture (["vulture/" , "--make-whitelist" ]) == ExitCode .NoDeadCode
7493 )
75- assert call_vulture (["vulture/" , "--make-whitelist" ]) == 0
0 commit comments