breezy-mouse-20493
11/21/2023, 5:54 PMpython_tests(
name="tests",
resolve="reqs",
dependencies=[
":fetch_test_data_adhoc", <-- A python script to fetch
":test_dataset", <-- The tarball that gets fetched
...
]
)
adhoc_tool(
name="fetch_test_data_adhoc",
runnable=":fetch_test_data_py",
output_files=[
"results_dataset.tar",
],
)
resource(
name="test_dataset",
source="test_dataset.tar",
)
python_source(
name="fetch_test_data_py",
source="fetch_test_data.py",
)
This is incorrect because :test_dataset, if included as a dependency to tests, shows up as an empty file:
Engine traceback:
in `test` goal
InvalidFieldException: The 'source' field in target test/python/mytest:test_dataset must have 1 file, but it had 0 files.
However if I remove the :test_dataset from the test dependencies, Pants is able to add the actual files into the sandbox, via adhoc_tool's output_files.
Which seems to obviate the need for a resource target, and a test dependency... Thoughts? Am I doing this right?broad-processor-92400
11/21/2023, 6:45 PMtest_dataset.tar doesn’t exist as a file on disk adjacent to that BUILD file. Is that the case? Is that what you expect?breezy-mouse-20493
11/21/2023, 7:10 PMpython_source runs a script that fetches test data from another repository... The reason I do this is to set a custom header on the request. It's for authentication.breezy-mouse-20493
11/21/2023, 7:15 PMbroad-processor-92400
11/21/2023, 7:30 PMresource is required for files on disk, it’s not required for ones generated by other targets that aren’t on disk.