https://pantsbuild.org/ logo
#general
Title
# general
w

white-jordan-40851

07/17/2022, 8:26 PM
I'm using
python_tests
, but some of my unittests require assets from s3. I'm seeking for advice on how this should be implemented. For instance, could I use a target such as
experimental_shell_command
to run shell
aws s3 sync <s3://bucket/> ./test_assets/
prior to my tests ? Then how can I make the content of
./test_assets
available to my unittests ? Would be
./test_assets
cached somewhere or entirely re-fetched for every execution ?
h

hundreds-father-404

07/17/2022, 9:28 PM
w

white-jordan-40851

07/17/2022, 10:14 PM
sounds like an option, but in that case (using aws s3 as a storage unit) I would need to make all my assets publicly available to be accessible via https. Alternatively I could implement a pytest fixture to download all my assets using boto3, but I was wondering if there would be an easy way to do it with Pants. Ideally I’d like to download my assets once and re-use it across different projects in same repo.
b

bitter-ability-32190

07/18/2022, 1:19 AM
I think your approach is sound. AFAIK The result would be cached locally and would be invalidated if the command or underlying binary changed.
To make the files appear in the sandbox, declare a dependency between the test target and your command target
6 Views