@@ -71,16 +71,12 @@ def working_tests():
71
71
for working_test in working_tests ():
72
72
def make_test_func (working_test ):
73
73
def fun ():
74
- if not working_test [1 ]: # no selectors, run entire test module
75
- # TODO: remove branch
76
- subprocess .check_call ([sys .executable , "-m" , "test." + working_test [0 ]])
77
- else :
78
- cmd = [sys .executable , "-m" , "unittest" ]
79
- for testpattern in working_test [1 ]:
80
- cmd .extend (["-k" , testpattern ])
81
- testmod = working_test [0 ].rpartition ("." )[2 ]
82
- cmd .append (os .path .join (os .path .dirname (test .__file__ ), "%s.py" % testmod ))
83
- subprocess .check_call (cmd )
74
+ cmd = [sys .executable , "-m" , "unittest" ]
75
+ for testpattern in working_test [1 ]:
76
+ cmd .extend (["-k" , testpattern ])
77
+ testmod = working_test [0 ].rpartition ("." )[2 ]
78
+ cmd .append (os .path .join (os .path .dirname (test .__file__ ), "%s.py" % testmod ))
79
+ subprocess .check_call (cmd )
84
80
85
81
fun .__name__ = working_test [0 ]
86
82
return fun
@@ -110,24 +106,21 @@ def fun():
110
106
tagfile = os .path .join (TAGS_DIR , testfile_stem + ".txt" )
111
107
test_selectors = working_selectors (tagfile )
112
108
113
- if not test_selectors :
114
- # TODO: remove branch
115
- print ("Testing" , testmod )
116
- cmd += [testmod , "-v" ]
117
- else :
118
- print ("Testing tagged subset of" , testmod )
119
- cmd += ["unittest" , "-v" ]
120
- for selector in test_selectors :
121
- cmd += ["-k" , selector ]
122
- cmd .append (testfile )
109
+ print ("Testing " , testmod )
110
+ cmd += ["unittest" , "-v" ]
111
+ for selector in test_selectors :
112
+ cmd += ["-k" , selector ]
113
+ cmd .append (testfile )
123
114
115
+ print (" " .join (cmd ))
124
116
p = subprocess .run (cmd , ** kwargs )
125
117
print ("*stdout*" )
126
118
print (p .stdout )
127
119
print ("*stderr*" )
128
120
print (p .stderr )
129
121
130
- if p .returncode == 0 :
122
+ if p .returncode == 0 and not os .path .exists (tagfile ):
123
+ # if we're re-tagging a test without tags, all passed
131
124
with open (tagfile , "w" ) as f :
132
125
pass
133
126
else :
0 commit comments