PlatformIO Community

Don't run extra_scripts when unit testing

I have the following output script that gets run when I build my code (the script just does a couple of things like copying the binaries into a more friendly directory and renaming it).

However, I don’t want this to happen to run if I’m unit testing. I have used print(env.Dump()) to try and see if there’s anything that identifies it as a unit test but it doesn’t seem to work.

Any suggestions?

When looking at the code

PIO defines the UNIT_TEST in env["CPPDEFINES"] for you, so you can differentiate it by that.

Ahh cool, thanks for that! It was hard to dig through all the defines