Skip to content

Commit 805e4c5

Browse files
committed
Merge pull request #94 from twisted/94-func-test-exit
Fix functional tests after twistedchecker exit with non-zero code.
2 parents b9935c3 + ac4bcbb commit 805e4c5

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

twistedchecker/test/test_functionaltests.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,7 @@ def _partial2(wrapped, *partialArgs, **partialKwargs):
4747
def wrapper(*args, **kwargs):
4848
args = args + partialArgs[len(args):]
4949
kwargs.update(partialKwargs)
50-
try:
51-
wrapped(*args, **kwargs)
52-
except SystemExit:
53-
# Each run of the functional tests will exit at the end.
54-
pass
50+
wrapped(*args, **kwargs)
5551
return update_wrapper(wrapper, wrapped)
5652

5753

@@ -181,7 +177,11 @@ def _runTest(testCase, testFilePath):
181177

182178
_enablePEP8Checker(runner.linter)
183179

184-
runner.run([moduleName])
180+
exitCode = None
181+
try:
182+
runner.run([moduleName])
183+
except SystemExit as error:
184+
exitCode = error.code
185185

186186
# Check the results
187187
expectedResult = open(pathResultFile).read().strip()
@@ -192,6 +192,11 @@ def _runTest(testCase, testFilePath):
192192
except unittest.FailTest:
193193
testCase.fail(_formatResults(moduleName, expectedResult, outputResult))
194194

195+
if not expectedResult:
196+
testCase.assertEqual(0, exitCode)
197+
else:
198+
testCase.assertNotEqual(0, exitCode)
199+
195200

196201

197202
def _testNameFromModuleName(moduleName):

0 commit comments

Comments
 (0)