Skip to content

Commit c69bfe8

Browse files
committed
add valid case
1 parent 0607235 commit c69bfe8

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

test/test_exit_code.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import sys
33
import tempfile
44

5+
56
class TestExitCode(unittest.TestCase):
67

78
def setUp(self):
@@ -28,6 +29,14 @@ def test_exit_code_fail(self):
2829
sys.argv = ['<ignored>', '--exit-code', tmpfile.name]
2930
self.assertRaisesRegex(SystemExit, '1', self.run_action)
3031

32+
def test_no_exit_code_success(self):
33+
s = "raise RuntimeError('I am not working nicely')"
34+
tmpfile = tempfile.NamedTemporaryFile('w', suffix='.py')
35+
with tmpfile as ofile:
36+
ofile.write(s)
37+
ofile.flush()
38+
sys.argv = ['<ignored>', tmpfile.name]
39+
self.run_action()
3140

3241
if __name__ == '__main__':
3342
unittest.main()

0 commit comments

Comments
 (0)