def _child_process_encoding(self): # Win32 Python 2.x uses CreateProcessA rather than CreateProcessW # to launch subprocesses, so we have to encode arguments using the # current code page. if sys.platform == 'win32' and versioning.compare_version(sys, '3.0')[0] < 0: return 'mbcs' # All other platforms use UTF-8. # FIXME: Using UTF-8 on Cygwin will confuse Windows-native commands # which will expect arguments to be encoded using the current code # page. return 'utf-8'
def _child_process_encoding(self): # Win32 Python 2.x uses CreateProcessA rather than CreateProcessW # to launch subprocesses, so we have to encode arguments using the # current code page. if sys.platform == "win32" and versioning.compare_version(sys, "3.0")[0] < 0: return "mbcs" # All other platforms use UTF-8. # FIXME: Using UTF-8 on Cygwin will confuse Windows-native commands # which will expect arguments to be encoded using the current code # page. return "utf-8"
def _should_encode_child_process_arguments(self): # Cygwin's Python's os.execv doesn't support unicode command # arguments, and neither does Cygwin's execv itself. if sys.platform == "cygwin": return True # Win32 Python 2.x uses CreateProcessA rather than CreateProcessW # to launch subprocesses, so we have to encode arguments using the # current code page. if sys.platform == "win32" and versioning.compare_version(sys, "3.0")[0] < 0: return True return False
def _should_encode_child_process_arguments(self): # Cygwin's Python's os.execv doesn't support unicode command # arguments, and neither does Cygwin's execv itself. if sys.platform == 'cygwin': return True # Win32 Python 2.x uses CreateProcessA rather than CreateProcessW # to launch subprocesses, so we have to encode arguments using the # current code page. if sys.platform == 'win32' and versioning.compare_version(sys, '3.0')[0] < 0: return True return False
def test_worker_model__inline(self): self.assertTrue(passing_run(['--worker-model', 'inline'])) def test_worker_model__threads(self): self.assertTrue(passing_run(['--worker-model', 'threads'])) def test_worker_model__processes(self): self.assertRaises(ValueError, logging_run, ['--worker-model', 'processes']) def test_worker_model__unknown(self): self.assertRaises(ValueError, logging_run, ['--worker-model', 'unknown']) MainTest = skip_if(MainTest, sys.platform == 'cygwin' and compare_version(sys, '2.6')[0] < 0, 'new-run-webkit-tests tests hang on Cygwin Python 2.5.2') def _mocked_open(original_open, file_list): def _wrapper(name, mode, encoding): if name.find("-expected.") != -1 and mode.find("w") != -1: # we don't want to actually write new baselines, so stub these out name.replace('\\', '/') file_list.append(name) return original_open(os.devnull, mode, encoding) return original_open(name, mode, encoding) return _wrapper class RebaselineTest(unittest.TestCase):
def compare_version(self, target_version, current_version=None): """Call compare_version().""" if current_version is None: current_version = "2.5.3" mock_sys = self._mock_sys(current_version) return compare_version(mock_sys, target_version)
def test_default_minimum_version(self): """Test the configured minimum version that webkitpy supports.""" (comparison, current_version, min_version) = compare_version() self.assertEquals(min_version, "2.5")
flatten_batches=True) self.assertFalse( MainTest.has_test_of_type(batch_tests_run_no_http, 'http')) self.assertFalse( MainTest.has_test_of_type(batch_tests_run_no_http, 'websocket')) batch_tests_run_http = get_tests_run( ['--http', 'LayoutTests/http', 'websocket/'], flatten_batches=True) self.assertTrue(MainTest.has_test_of_type(batch_tests_run_http, 'http')) self.assertTrue( MainTest.has_test_of_type(batch_tests_run_http, 'websocket')) MainTest = skip_if( MainTest, sys.platform == 'cygwin' and compare_version(sys, '2.6')[0] < 0, 'new-run-webkit-tests tests hang on Cygwin Python 2.5.2') class EndToEndTest(unittest.TestCase): def parse_full_results(self, full_results_text): json_to_eval = full_results_text.replace("ADD_RESULTS(", "").replace(");", "") compressed_results = json.loads(json_to_eval) return compressed_results def test_end_to_end(self): fs = unit_test_filesystem() res, out, err, user = logging_run(record_results=True, tests_included=True, filesystem=fs)
batch_tests_dryrun = get_tests_run(["LayoutTests/http", "websocket/"], flatten_batches=True) self.assertTrue(MainTest.has_test_of_type(batch_tests_dryrun, "http")) self.assertTrue(MainTest.has_test_of_type(batch_tests_dryrun, "websocket")) batch_tests_run_no_http = get_tests_run(["--no-http", "LayoutTests/http", "websocket/"], flatten_batches=True) self.assertFalse(MainTest.has_test_of_type(batch_tests_run_no_http, "http")) self.assertFalse(MainTest.has_test_of_type(batch_tests_run_no_http, "websocket")) batch_tests_run_http = get_tests_run(["--http", "LayoutTests/http", "websocket/"], flatten_batches=True) self.assertTrue(MainTest.has_test_of_type(batch_tests_run_http, "http")) self.assertTrue(MainTest.has_test_of_type(batch_tests_run_http, "websocket")) MainTest = skip_if( MainTest, sys.platform == "cygwin" and compare_version(sys, "2.6")[0] < 0, "new-run-webkit-tests tests hang on Cygwin Python 2.5.2", ) class EndToEndTest(unittest.TestCase): def parse_full_results(self, full_results_text): json_to_eval = full_results_text.replace("ADD_RESULTS(", "").replace(");", "") compressed_results = json.loads(json_to_eval) return compressed_results def test_end_to_end(self): fs = unit_test_filesystem() res, out, err, user = logging_run(record_results=True, tests_included=True, filesystem=fs) self.assertEquals(res, unexpected_tests_count)