示例#1
0
 def test__make_process_with_space(self):
     logger = logging.getLogger("pytest")
     filename = "this file name has space.py:q:"
     pytest_case = pytest.PyTestCase(logger, filename)
     self.assertEqual(pytest_case.test_name, filename)
     self.assertEqual(pytest_case.logger, logger)
     proc = pytest_case._make_process()
     self.assertIn(" -m unittest", proc.as_command())
     self.assertIn(pytest_case.test_module_name, proc.as_command())
     self.assertEqual(proc.logger, logger)
示例#2
0
 def test__make_process_windows_file(self):
     logger = logging.getLogger("pytest")
     filename = "dir1\\dir2\\myfile.py"
     pytest_case = pytest.PyTestCase(logger, filename)
     self.assertEqual(pytest_case.test_name, filename)
     self.assertEqual(pytest_case.logger, logger)
     proc = pytest_case._make_process()
     self.assertIn(" -m unittest", proc.as_command())
     self.assertIn(pytest_case.test_module_name, proc.as_command())
     self.assertEqual(proc.logger, logger)
示例#3
0
 def test__make_process_dir(self):
     logger = logging.getLogger("pytest")
     filename = "dir1/dir2/myfile.py"
     pytest_case = pytest.PyTestCase(logger, filename)
     self.assertEqual(pytest_case.test_name, filename)
     self.assertEqual(pytest_case.logger, logger)
     proc = pytest_case._make_process()
     self.assertIn(sys.executable + " -m unittest", proc.as_command())
     self.assertIn(pytest_case.test_module_name, proc.as_command())
     self.assertEqual(proc.logger, logger)
示例#4
0
 def test_test_module_name_no_dir(self):
     logger = logging.getLogger("pytest")
     filename = "myfile.py"
     pytest_case = pytest.PyTestCase(logger, filename)
     self.assertEqual(pytest_case.test_module_name, "myfile")
示例#5
0
 def test_test_module_name_absolute_dir(self):
     logger = logging.getLogger("pytest")
     filename = get_filename("/dir1/dir2/dir3/myfile.py")
     pytest_case = pytest.PyTestCase(logger, filename)
     self.assertEqual(pytest_case.test_module_name,
                      ".dir1.dir2.dir3.myfile")