self.make_snapshot({fp: "// python code" for fp in original_files}),
sources_stripped=sources_stripped,
)
result = self.request_single_product(
InitInjectedSnapshot,
Params(
request, create_options_bootstrapper(args=["--source-root-patterns=["src/python"]"])
),
).snapshot
assert list(result.files) == sorted(
[*original_files, *expected_added, *expected_discovered]
)
// Ensure all original `__init__.py` are preserved with their original content.
materialized_original_inits = [
fc
for fc in self.request_single_product(FilesContent, result.digest)
if fc.path.endswith("__init__.py")
and (fc.path in original_files or fc.path in expected_discovered)
]
After Change
materialized_result = self.request_single_product(FilesContent, result.digest)
for file_content in materialized_result:
path = file_content.path
if not path.endswith("__init__.py"):
continue
assert path in original_declared_files or path in expected_discovered
expected = b"// declared" if path in original_declared_files else b"// undeclared"
assert file_content.content == expected