MCPcopy Index your code
hub / github.com/nodejs/node / assert_file

Function assert_file

tools/gyp/test/integration_test.py:23–42  ·  view source on GitHub ↗
(test, actual, expected)

Source from the content-addressed store, hash-verified

21
22
23def assert_file(test, actual, expected) -> None:
24 actual_filepath = os.path.join(fixture_dir, actual)
25 expected_filepath = os.path.join(expected_dir, expected)
26
27 with open(expected_filepath) as in_file:
28 in_bytes = in_file.read()
29 in_bytes = in_bytes.strip()
30 expected_bytes = re.escape(in_bytes)
31 expected_bytes = expected_bytes.replace("\\*", ".*")
32 expected_re = re.compile(expected_bytes)
33
34 with open(actual_filepath) as in_file:
35 actual_bytes = in_file.read()
36 actual_bytes = actual_bytes.strip()
37
38 try:
39 test.assertRegex(actual_bytes, expected_re)
40 except Exception:
41 shutil.copyfile(actual_filepath, f"{expected_filepath}.actual")
42 raise
43
44
45class TestGypUnix(unittest.TestCase):

Callers 4

test_ninjaMethod · 0.85
test_makeMethod · 0.85
test_cmakeMethod · 0.85
test_msvsMethod · 0.85

Calls 5

openFunction · 0.50
joinMethod · 0.45
readMethod · 0.45
escapeMethod · 0.45
compileMethod · 0.45

Tested by

no test coverage detected