Hello, I am implementing ament_black as a pytest to run on all my ROS packages when colcon test is called. It works wonderfully well - except for one package which contains a file with python 3.10 code. This file causes ament_black to fail with the message, "The invocation of 'black' failed with error code 123".
When I run black on the same file, its output is a little more descriptive:
error: cannot format driver.py: Cannot parse: 189:18: match request.operation: Consider using --target-version py310 to parse Python 3.10 code. Oh no! 💥 💔 💥 1 file failed to reformat.
The suggested --target-version flag works with black, but ament_black accepts no such flag. I've dug through your documentation and code and can't seem to find any option to configure the target version.
Your ament_black/main.py seems to suggest that a --config flag can be passed in to set the path to a config file, however, ament_black doesn't seem to accept this flag.
my test_black.py configuration is below:
`from ament_black.main import main
def test_black():
rc = main(
argv=[
"--xunit-file",
"black.xunit.xml",
"."
]
)
assert rc == 0, "black failed with error code %d" % rc`
Is there a way to configure ament_black to understand this file, or at least skip it (without having to manually set the path to every other .py file in the package)?
Any help would be appreciated - I'm new at this, but ament_black has already been incredibly useful especially alongside other ament_lint packages. Thank you!
Hello, I am implementing
ament_blackas a pytest to run on all my ROS packages whencolcon testis called. It works wonderfully well - except for one package which contains a file with python 3.10 code. This file causesament_blackto fail with the message, "The invocation of 'black' failed with error code 123".When I run
blackon the same file, its output is a little more descriptive:error: cannot format driver.py: Cannot parse: 189:18: match request.operation: Consider using --target-version py310 to parse Python 3.10 code. Oh no! 💥 💔 💥 1 file failed to reformat.The suggested
--target-versionflag works withblack, butament_blackaccepts no such flag. I've dug through your documentation and code and can't seem to find any option to configure the target version.Your
ament_black/main.pyseems to suggest that a--configflag can be passed in to set the path to a config file, however,ament_blackdoesn't seem to accept this flag.my
test_black.pyconfiguration is below:`from ament_black.main import main
def test_black():
rc = main(
argv=[
"--xunit-file",
"black.xunit.xml",
"."
]
)
assert rc == 0, "black failed with error code %d" % rc`
Is there a way to configure
ament_blackto understand this file, or at least skip it (without having to manually set the path to every other .py file in the package)?Any help would be appreciated - I'm new at this, but
ament_blackhas already been incredibly useful especially alongside otherament_lintpackages. Thank you!