def test_check_call(self): cmd = [sys.executable, '-u', '-c', 'import sys; sys.exit(0)'] self.assertEqual(0, subprocess42.check_call(cmd)) cmd = [sys.executable, '-u', '-c', 'import sys; sys.exit(1)'] try: self.assertEqual(1, subprocess42.check_call(cmd)) self.fail() except subprocess42.CalledProcessError as e: self.assertEqual(None, e.output)
def test_containment_none(self): # Minimal test case. Starts two processes. cmd = self._cmd_print_good() containment = subprocess42.Containment( containment_type=subprocess42.Containment.NONE) self.assertEqual(0, subprocess42.check_call(cmd, containment=containment))
def test_containment_auto(self): # Minimal test case. Starts two processes. cmd = self._cmd_print_good() containment = subprocess42.Containment( containment_type=subprocess42.Containment.AUTO, limit_processes=2, limit_total_committed_memory=1024*1024*1024) self.assertEqual(0, subprocess42.check_call(cmd, containment=containment))