1414
1515"""Test the abstract Parser class."""
1616
17- import importlib .metadata # noqa: F401
1817from unittest .mock import patch
1918import warnings # noqa: F401
2019
20+ from launch .frontend .parser import importlib_metadata
2121from launch .frontend .parser import Parser
2222
2323
@@ -30,7 +30,8 @@ def load(self):
3030
3131
3232def test_invalid_launch_extension ():
33- with patch ('warnings.warn' ) as mock_warn , patch ('importlib.metadata.entry_points' ) as mock_ep :
33+ with patch ('warnings.warn' ) as mock_warn , \
34+ patch (importlib_metadata .__name__ + '.entry_points' ) as mock_ep :
3435 mock_ep .return_value = {
3536 'launch.frontend.launch_extension' : [InvalidEntryPoint ()]
3637 }
@@ -39,11 +40,12 @@ def test_invalid_launch_extension():
3940
4041 assert mock_ep .called
4142 assert mock_warn .call_args
42- assert mock_warn .call_args . args [0 ].startswith ('Failed to load' )
43+ assert mock_warn .call_args [ 0 ] [0 ].startswith ('Failed to load' )
4344
4445
4546def test_invalid_parser_implementations ():
46- with patch ('warnings.warn' ) as mock_warn , patch ('importlib.metadata.entry_points' ) as mock_ep :
47+ with patch ('warnings.warn' ) as mock_warn , \
48+ patch (importlib_metadata .__name__ + '.entry_points' ) as mock_ep :
4749 mock_ep .return_value = {
4850 'launch.frontend.parser' : [InvalidEntryPoint ()]
4951 }
@@ -52,4 +54,4 @@ def test_invalid_parser_implementations():
5254
5355 assert mock_ep .called
5456 assert mock_warn .call_args
55- assert mock_warn .call_args . args [0 ].startswith ('Failed to load' )
57+ assert mock_warn .call_args [ 0 ] [0 ].startswith ('Failed to load' )
0 commit comments