Пример #1
0
 def test_name_error(self):
     with py.test.raises(NameError) as exc_info:
         with reentry.in_process_context([]) as proc:
             not_present
     assert proc.returncode == 1
     msg = "global name 'not_present' is not defined"
     assert str(exc_info.value) == msg
Пример #2
0
	def test_name_error(self):
		with py.test.raises(NameError) as exc_info:
			with reentry.in_process_context([]) as proc:
				not_present
		assert proc.returncode == 1
		msg = "global name 'not_present' is not defined"
		assert str(exc_info.value) == msg
Пример #3
0
	def test_keyboard_interrupt(self):
		with py.test.raises(KeyboardInterrupt):
			with reentry.in_process_context([]) as proc:
				raise KeyboardInterrupt()
		assert proc.returncode == 1
Пример #4
0
	def test_echo_args(self):
		with reentry.in_process_context(['echo', 'foo', 'bar']) as proc:
			echo()
		assert proc.returncode == 0
		out = "args are ['echo', 'foo', 'bar']\n"
		assert proc.stdio.stdout.getvalue() == out
Пример #5
0
	def test_main_with_system_exit_string(self):
		with reentry.in_process_context(['exit-string']) as proc:
			exit_string()
		assert proc.returncode == 1
		assert proc.stdio.stdout.getvalue() == ''
Пример #6
0
	def test_main_with_system_exit(self):
		with reentry.in_process_context(['exit-zero']) as proc:
			exit_zero()
		assert proc.returncode == 0
		assert proc.stdio.stdout.getvalue() == ''
Пример #7
0
	def test_hello_world_unicode(self):
		with reentry.in_process_context(['hello-world.py']) as proc:
			hello_unicode_world()
		assert proc.returncode == 0
		assert proc.stdio.stdout.getvalue() == 'hello world\n'
Пример #8
0
 def test_keyboard_interrupt(self):
     with py.test.raises(KeyboardInterrupt):
         with reentry.in_process_context([]) as proc:
             raise KeyboardInterrupt()
     assert proc.returncode == 1
Пример #9
0
 def test_echo_args(self):
     with reentry.in_process_context(['echo', 'foo', 'bar']) as proc:
         echo()
     assert proc.returncode == 0
     out = "args are ['echo', 'foo', 'bar']\n"
     assert proc.stdio.stdout.getvalue() == out
Пример #10
0
 def test_main_with_system_exit_string(self):
     with reentry.in_process_context(['exit-string']) as proc:
         exit_string()
     assert proc.returncode == 1
     assert proc.stdio.stdout.getvalue() == ''
Пример #11
0
 def test_main_with_system_exit(self):
     with reentry.in_process_context(['exit-zero']) as proc:
         exit_zero()
     assert proc.returncode == 0
     assert proc.stdio.stdout.getvalue() == ''
Пример #12
0
 def test_hello_world_unicode(self):
     with reentry.in_process_context(['hello-world.py']) as proc:
         hello_unicode_world()
     assert proc.returncode == 0
     assert proc.stdio.stdout.getvalue() == 'hello world\n'