rapid-bird-79300
08/20/2021, 11:03 PMfind_needle
plugin in the testing docs and pushed an example here: https://github.com/njgrisafi/pants-example/tree/find-needle
getting a test error:
request = HydrateSourcesRequest(field=<class 'pants.engine.target.Sources'>(alias='sources', address=//:t1, value={repr(self.value)}, default={repr(self.default)}), for_sources_types=(<class 'pants.engine.target.Sources'>,), enable_codegen=False)
def mock_hydrate_sources(request: HydrateSourcesRequest) -> HydratedSources:
# Our rule only looks at `HydratedSources.snapshot.files`, so we mock all other fields. We
# include the file `needle.txt` for the target `:t2`, but no other targets.
files = (
("needle.txt", "foo.txt")
if request.field.address.target_name == "t2"
else ("foo.txt", "bar.txt")
)
> mock_snapshot = Snapshot(EMPTY_DIGEST, files=files, dirs=())
E TypeError: PySnapshot.__new__()() takes at most 0 arguments (3 given)
Any ideas why this is?fast-nail-55400
08/21/2021, 12:02 AM_create_for_testing
class method that you can use.fast-nail-55400
08/21/2021, 12:03 AMhundreds-father-404
08/21/2021, 12:06 AM