def setUpClass(cls): """ We have to launch three ports in order to test this plugin. """ def run_app(port, app): test_app = APPS[app] test_app.run(host='localhost', port=port) _kill_ports(cls.PORTS) cls.server1 = Process(target=run_app, args=(1234, 'test_app',)) cls.server2 = Process(target=run_app, args=(1235, 'test2_app',)) cls.server3 = Process(target=run_app, args=(1443, 'test3_app',)) cls.server1.daemon = True cls.server2.daemon = True cls.server3.daemon = True cls.server1.start() cls.server2.start() cls.server3.start() cls.pname = "RobotsPlugin"
def setUpClass(cls): def run_app(port): test_app.run(port=port) def run_stunnel(): p = Popen(['stunnel4', 'stunnel-data/minion-test.ini'], stdout=PIPE,\ stderr=PIPE) p.communicate() _kill_ports(cls.PORTS) cls.stunnel = Process(target=run_stunnel) cls.stunnel.daemon = True cls.stunnel.start() # server1 will be HTTP and one can access https through 1443 cls.server1 = Process(target=run_app, args=(1235,)) cls.server1.daemon = True cls.server1.start() cls.pname = 'HSTSPlugin'
def tearDownClass(cls): cls.server1.terminate() cls.stunnel.terminate() # only kills multiprocess instance # actually kills stunnel process _kill_ports(cls.PORTS)