3
|
1 #!/usr/bin/env python
|
|
2 # -*- coding: utf-8 -*-
|
|
3
|
|
4 """
|
|
5 unit tests for fail
|
|
6 """
|
|
7
|
|
8 # imports
|
|
9 import os
|
|
10 import subprocess
|
|
11 import sys
|
|
12 import tempfile
|
|
13 import unittest
|
|
14
|
|
15 # module globals
|
|
16 here = os.path.dirname(os.path.abspath(__file__))
|
|
17 fail_command = 'fail'
|
|
18
|
|
19 class FailUnitTest(unittest.TestCase):
|
|
20
|
|
21 def test_subprocess(self):
|
|
22 """test fail invocation"""
|
|
23 process = subprocess.Popen([fail_command, 'false'])
|
|
24 process.communicate()
|
|
25 self.assertEqual(process.returncode, 1)
|
|
26
|
|
27 if __name__ == '__main__':
|
|
28 unittest.main()
|
|
29
|