Hi Team, Trying to use vcrpy with pytest and pants...
# general
l
Hi Team, Trying to use vcrpy with pytest and pants to have HTTP interactions recorded and replayed in my tests. I can see the cassette output in the pants test directory - but I need it to be output in the current dir to be commited to repo + I need the cassette when running the tests to prevent network hit when the tests are played on the CI. I have a feeling I need to write a plugin for that
h
Hello! You need to write it to
extra-output/
, and then it will be preserved for you in
dist/
automatically
🙏 1
For example:
./pants test <target> -- --html=extra-output/report.html
Thanks to Benjy for that nifty feature 🙂
l
So this is bidirectional? Everything that is in dists/test is copied back into the extra-output/ at test time?
or maybe I just move it manually and set it as a resource
e
Yeah, the latter.
l
cool - thx
is there a restriction on file names? somehow the file isn't getting picked up
has
[
and
]
in it
h
By not picked up, are you getting an error from Pants?
l
I was getting a no file matching the target source
then it disapeared but I don't know why
When I use
files
I don't get the error when I use
file
I do:
Copy code
10:58:26.81 [ERROR] 1 Exception encountered:

  InvalidFieldException: The 'source' field in target ede_ops_backend/cassettes:cassettes must have 1 file, but it had 0 files.
the file name was: test_full_cost_scenario[4.3.7-community].yaml that did not get picked up
I renamed to test_full_cost_scenario.yaml
and that worked