PlatformIO Community

Cannot specify Unity version to be used

Hi!

I’m trying to use Unity for unit testing using unity_fixture.h which is supposed to be in the “extras” folder of Unity.

Interestingly, after specifying Unity@2.5.2 in my platformio.ini, the folder contents of libdeps/Unity differ greatly from what I can see on git and it does not contain the extras folder at all.

Replacing the library version specification with lib_deps = https://github.com/ThrowTheSwitch/Unity.git does have an effect: it creates a seemingly correct clone of the repository.
However, it still does not work (“does not work” as in pio test fails because “unity_fixture.h” is not found.
I suspect this is because there is another Unity folder in the libdeps folder still containing the wrong version (the one without the extras folder). Keeps regenerating, probably upon the “test_framework = unity” setting, which cannot be avoided.

From here on, I’m lost.

  • How can the folder contents differ from the one on git despite the matching version numbers?
  • If this mismatch is expected behaviour, how can I specify the exact git version so I could use the extras? How do I keep PlatformIO from installing and using version 2.5.2 automatically?

Any useful hints would be greatly appreciated.

When using test_framework = unity, the default unity version is hardcoded.

The documentation however also tells you what to do for a custom Unity version:

https://docs.platformio.org/en/latest/advanced/unit-testing/frameworks/custom/examples/custom_unity_library.html

Thank you so much! This solves my problem, now only the desired version is installed.