April 9, 2023, 7:52pm
When I press build, I don’t want the native testing environment to be built, because obviously it will fail.
When I press test, I don’t want the Arduino environments to be tested, because obviously they will fail
This is impossible apparently?
default_envs applies to both
Are you sure you have the correct environment selected in the
the project enviornment selector? When you press test or build, it should only do that for the currently selected environment.
Unless you’re using the project task “Default->Build All” / “Default → Advanced → Test all”.
April 9, 2023, 8:02pm
The environment is set to “Default” which builds all environments by default. Do I have to manually switch every time I want to run tests and build?
You can keep the selected environment as
uno and use the testing sidebar to run tests for
native without switching.
You can also disable tests in the uno environment using test_filter per
April 9, 2023, 8:14pm
The testing sidebar doesn’t work
Testing passes when clicking the small “test” button
But fails when using the sidebar
Works for me in my projects.
Are you sure you have the PlatformIO extension up-to-date and no conflicting extensions installed?
April 9, 2023, 8:26pm
I’m using the latest version 3.1.1
As for conflicting extensions, if I disable every extension except for the required ones, it still fails
Does this maybe have something to do with the python version it is using? Since the error seems to complain about something python related
Can you post a minimal project with Uno + Native environments that fails build for native and fails test for Uno like yours?
April 9, 2023, 8:44pm
If you create an empty project with this main.cpp
this test file
and this platform.ini
It fails to build for Native because it can’t find Arduino.h
I don’t actually know why testing fails on the uno for my other project, it works fine in the empty project, but either way the testing sidebar still fails
Please, instead of screenshots, could you upload the project as a .zip file somewhere?
April 9, 2023, 8:50pm
You’re not using the right folder structure at all, so tests are not correctly recognized.
reference project and documentation.
When I order the project files as
And, same as the reference project, use
test_ignore to not make uni environment execute the native tests, using the
platform = native
test_ignore = test_embedded ; if there were some in the future
platform = atmelavr
board = uno
framework = arduino
test_ignore = test_native
and reload the VSCode window (Ctrl+Shift-P → Reload Window), I get a nice
I.e…, no tests executed for Uno, and tests for native passed.
April 9, 2023, 9:17pm
I see, thank you for the clean solution
I was following
which didn’t really specify the location for the test file so I assumed it was fine
The tutorial is outdated since Testing got
majorly refactored in PIO core 6 version. Seems like it wasn’t updated since then.