Pio test fails: UnityTestRunner object has no attribute 'verbose'

I’m attempting to run a Unity test for my platformio AVR project in VSCODE.
When I run pio test from the command line, I get the following error after successful test upload to my hardware. I also note that adding -vvv does not enable any unity test runner verbosity.

‘UnityTestRunner’ object has no attribute ‘verbose’

Is this a Unity python error? I can’t seem to find the source of the error.

Thanks!
PlatformIO 6.1.1rc1

What’s your exact platformio.ini?

Can you try to get the most recent core version? (CLI + pio upgrade --dev)

Thanks for having a look!

%  ~/.platformio/penv/bin/pio upgrade --dev                
Please wait while upgrading PlatformIO ...
PlatformIO has been successfully upgraded to 6.1.1rc1
Release notes: https://docs.platformio.org/en/latest/history.html```

Here is my platformio.ini

[platformio]
; Default build target
default_envs = run_main_on_hw

[env]
board_build.f_cpu = 1000000L
board_hardware.oscillator = internal
build_unflags =
build_flags =
monitor_speed = 9600

;; ~/.platformio/penv/bin/pio run -e run_main_on_hw -t upload
[env:run_main_on_hw]
platform = atmelmegaavr
board = ATtiny3224
framework = arduino
upload_protocol = custom  ; --fuses 2:0x02 6:0x04 8:0x00 ; 2:0x01 - 16Mhz, 2:0x02 - 20 Mhz. 
upload_port = /dev/tty.usbserial-14230
upload_speed = 115200
upload_command = python3 ~/.platformio/packages/framework-arduino-megaavr-megatinycore/tools/prog.py -t uart -u $UPLOAD_PORT -b $UPLOAD_SPEED -d $BOARD_MCU --fuses 2:0x01 6:0x04 8:0x00 -f$SOURCE -a write

;; ~/.platformio/penv/bin/pio test -e test_on_real_hw
[env:test_on_real_hw]
platform = atmelmegaavr
board = ATtiny3224
framework = arduino
build_flags = -DUNITY_CONFIG_HW_TEST
upload_protocol = custom 
upload_port = /dev/tty.usbserial-14230
upload_speed = 115200
upload_command = python3 ~/.platformio/packages/framework-arduino-megaavr-megatinycore/tools/prog.py -t uart -u $UPLOAD_PORT -b $UPLOAD_SPEED -d $BOARD_MCU  -f$SOURCE -a write
test_port = /dev/tty.usbserial-14220
test_speed = 115200

This is reproducable for me too with the simplest possible Arduino Uno + Unity test example.

[env:uno]
platform = atmelavr
board = uno
framework = arduino

test\test_simple\test.cpp

#include <unity.h>

void test_calculator_addition(void) {
    TEST_ASSERT_EQUAL(32, 25 + 7);
}

void RUN_UNITY_TESTS() {
    UNITY_BEGIN();
    RUN_TEST(test_calculator_addition);
    UNITY_END();
}

#ifdef ARDUINO
#include <Arduino.h>
void setup() {
    // NOTE!!! Wait for >2 secs
    // if board doesn't support software reset via Serial.DTR/RTS
    delay(2000);

    RUN_UNITY_TESTS();
}

void loop() {
    digitalWrite(13, HIGH);
    delay(100);
    digitalWrite(13, LOW);
    delay(500);
}
#endif

Output of project task “Verbose Test”

 *  Executing task: C:\Users\Max\AppData\Local\Programs\Python\Python38\Scripts\platformio.exe test --verbose --environment uno 

Collected 1 tests (test_simple)

Processing test_simple in uno environment
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Building & Uploading...

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: reading input file ".pio\build\uno\firmware.hex"
avrdude: writing flash (3446 bytes):

Writing | ################################################## | 100% 0.55s

avrdude: 3446 bytes of flash written
avrdude: verifying flash memory against .pio\build\uno\firmware.hex:
avrdude: load data flash data from input file .pio\build\uno\firmware.hex:
avrdude: input file .pio\build\uno\firmware.hex contains 3446 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.44s

avrdude: verifying ...
avrdude: 3446 bytes of flash verified

avrdude: safemode: Fuses OK (E:00, H:00, L:00)

avrdude done.  Thank you.


Testing...
If you don't see any output for the first 10 secs, please reset board (press reset button)

'UnityTestRunner' object has no attribute 'verbose'
--------------------------------------------------------------------------------------- uno:test_simple [ERRORED] Took 5.84 seconds ---------------------------------------------------------------------------------------
============================== SUMMARY ==============================
Environment    Test         Status    Duration
-------------  -----------  --------  ------------
uno            test_simple  ERRORED   00:00:05.839
============= 1 test cases: 0 succeeded in 00:00:05.839 =============

CC @ivankravets

Sorry for the issue, fixed in the latest PIO Core-dev version. Please re-run pio upgrade --dev.

Confirmed fixed after doing pio upgrade --dev again.

Testing...
If you don't see any output for the first 10 secs, please reset board (press reset button)

test\test_simple\test.cpp:9:test_calculator_addition:PASS

-----------------------
1 Tests 0 Failures 0 Ignored
OK

------------------------------------------------------------------------------ uno:test_simple [PASSED] Took 8.73 seconds ------------------------------------------------------------------------------

Many thanks!

1 Like

There are some critical issues in PIO Core 6.1.0. We fixed all of them platformio-core/HISTORY.rst at develop · platformio/platformio-core · GitHub

The PIO Core 6.1.1 is planned for release tomorrow.

The upgrade works for me, too.

Many thanks!