-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathtest_piman.py
31 lines (26 loc) · 1.07 KB
/
test_piman.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import unittest
import subprocess
import socket
import piman
from multiprocessing import Process
from subprocess import PIPE, Popen
class piman_tests(unittest.TestCase):
def test_makezipapp(self):
try:
out = subprocess.check_output(['./make_zipapp.sh'])
except ModuleNotFoundError as e:
self.fail("Module not Found")
except subprocess.CalledProcessError as e:
self.fail("Errors occured")
except Exception as e:
self.fail("Unexcpected exception")
print("make_zipapp.sh ran successfully\ntesting pyz file...")
try:
piman = Popen(['python3', 'build/piman.pyz', 'restart' , '127.0.0.1', '30'], stdin=PIPE, stdout=PIPE, stderr=PIPE)
print("Doing an SNPM walk to turn off and on a non-existing pi. Please wait a few seconds")
temp = piman.communicate()
except Exception as e:
print(e)
self.assertIn("Setting pi at port", str(temp), "piman.pyz method restart did not run successfully")
if __name__ == '__main__':
unittest.main()