Hello! I just had a couple of questions about plug...
# plugins
a
Hello! I just had a couple of questions about plugin development (and pants dev in general). When it comes to tests, how much integration testing do you typically do? I'm writing a plugin to handle some things in Docker builds to try to streamline things a bit for our devs. One of which is using pants to run a smoke test on a built container as if you'd called
pants run ...
and bind-mounted some scripts to run on the container. I realise I could script this, but I wanted to get my head around pants development (I want snapshot tests for python and a backend for AWS CDK 😄) I've got good unit testing, but I'm wondering how much you test things like compatibility with advanced target selection, or end to end processes like
pants package my-smoke-test-goal publish some_target
? Can you give any examples of cases where you definitely needed an integration test? Edit: Also, what about environment compatibility i.e. does my plugin work in a container environment as well as just local?
h
In the Pants repo we do a lot of integration testing, especially for plugins. It tends to be the easiest way to get functionality tested without setting up a ton of mocking. I'm not necessarily happy about this, but if you find yourself writing ITs then you're in good company...
a
Thanks Benjy. I found there were some test cases that needed a lot of mocking, so I've used a combination of helpers in the plugins test utils and a fixture that can give me a workspace/git repo. I agree, I'd prefer not to be writing integration tests, but the fact that you're doing it in the Pants repo puts my mind at ease 😄
h
It reflects a weakness in our testing infrastructure, frankly, but that's not on you to fix...
a
Ah, fair enough. Just for my education, if you could wave a magic wand, how would you have things set up instead?