calling flutter from Python with --name
14:10 30 Mar 2026

I use this in a bash script:

flutter test --coverage --branch-coverage ut --name tp001

And it works when I invoke the script: do_ut tp001 It only runs tests in the group "tp001". Great, This is what I want.

But I would like to run that command from a python script:

cmd = ['flutter', 'test', '--coverage', '--branch-coverage', 'ut', '--name', 'tp001']
print('HERE0', cmd2)
result = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True)

And I get ALL the test cases not just the tests in group tp001:

HERE0 ['flutter', 'test', '--coverage', '--branch-coverage', 'ut', '--name', 'tp001']
DBG  result: 
00:00 +0: loading languages/test_flutter/ut/tp010_model_test.dart                                                                                                           
00:01 +0: loading languages/test_flutter/ut/tp010_model_test.dart
         

Why is it doing this and how do I fix it?

flutter unit-testing