Based on the documentation it is unclear to me what the test_ignore build option (and pio test CLI flag) is looking at.
Is it file name, or is it maybe the unit test (test case to be precise) name? I was hoping it will work for file names but it doesn’t seem to work that way.
Use case: I can’t have common unit tests for native and other arduino-based platforms (arduino, esp32) - that’s because native platform expects main() function whereas arduino expects setup().
Based on my testing it doesn’t work for file names, as I have following layout:
tests/
integration_foo.cpp
test_foo.cpp
For native I want to run files starting with test_ (these include only my libraries) and for real microcontrollers I want to run integration_ files - there will be a code that will use real arduino dependency libraries.
The tests are defined as in the docs void functions, registered with RUN_TEST() macro - i believe this is the only format supported by unity.h.
Thank you for clarifying. I believe it might be a good idea to use some more explicit wording in the docs like test case name. Test alone might refer to test file, test suite (although in case of unity.h i believe it’s the same with file name?) or test case.
This means that I’ll have to resort to some macro magic to run test suites (integration on esp32, unit tests on native) only in proper environments. Does PIO automatically create a preprocessor constant where it stores environment name? (I know that I could do a workaround and use build_flags to specify constant for each build, but that’s an configuration extra step for each project).
The formerly accepted solution is no longer correct. test_ignore refers to test folders, not individual test functions inside your test code. The documentation is pretty inconsistent and vague about this and other topics, but at least this page is clear about this topic: Test Hierarchy — PlatformIO latest documentation