Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@

def test(codeql, java_full, cwd: pathlib.Path, expected_files):
codeql.database.create(command=["kotlinc test.kt"])
expected_files.add("logs.actual")

with open("logs.actual", "w") as f_out:
with expected_files.add("logs.actual") as f_out:
log_dir = cwd / "test-db" / "log"
for file_index, log_file in enumerate(log_dir.glob("kotlin-extractor*.log"), 1):
f_out.write(f"Log file {file_index}\n")
Expand Down
8 changes: 4 additions & 4 deletions misc/pytest/lib/query_suites.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ def ret(query_suite):
actual = sorted(actual.splitlines())
actual = [os.path.relpath(q, semmle_code_dir) for q in actual]
actual_file_name = query_suite + '.actual'
expected_files.add(actual_file_name)
(cwd / actual_file_name).write_text('\n'.join(actual) + '\n')
with expected_files.add(actual_file_name) as f:
f.write('\n'.join(actual) + '\n')
return ret

@pytest.fixture
Expand All @@ -25,6 +25,6 @@ def ret(lang_folder_name, query_suites):
not_included = sorted(set(all_queries) - included_in_qls)
not_included = [os.path.relpath(q, semmle_code_dir) for q in not_included]
not_included_file_name = 'not_included_in_qls.actual'
expected_files.add(not_included_file_name)
(cwd / not_included_file_name).write_text('\n'.join(not_included) + '\n')
with expected_files.add(not_included_file_name) as f:
f.write('\n'.join(not_included) + '\n')
return ret
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@ def test(codeql, swift, expected_files):
with open(f, "rb") as module:
print(f.name, sha256(module.read()).hexdigest(), file=expected)

with open("hashes.actual", "w") as actual:
with expected_files.add("hashes.actual") as actual:
hashes = [
(s.name, s.resolve().name)
for s in Path("test-db/working/swift-extraction-artifacts/store").iterdir()
]
hashes.sort()
for module, hash in hashes:
print(module, hash, file=actual)
expected_files.add("hashes.actual")
Loading