55from io import StringIO
66from random import sample
77from unittest import TestCase
8- from unittest .mock import call , patch
8+ from unittest .mock import patch
99
1010from opentelemetry .instrumentation import bootstrap
1111from opentelemetry .instrumentation .bootstrap_gen import (
@@ -31,7 +31,6 @@ def setUpClass(cls):
3131 [lib ["instrumentation" ] for lib in libraries ], 0.6
3232 )
3333
34- # treat 50% of sampled packages as pre-installed
3534 cls .installed_instrumentations = sample_packages (
3635 cls .installed_libraries , 0.5
3736 )
@@ -78,19 +77,17 @@ def test_run_cmd_print(self):
7877 def test_run_cmd_install (self ):
7978 self .pkg_patcher .start ()
8079 bootstrap .run ()
81- self .mock_pip_install .assert_has_calls (
82- [call (i ) for i in self .installed_libraries ],
83- any_order = True ,
80+ self .mock_pip_install .assert_called_once_with (
81+ self .installed_libraries ,
8482 )
8583 self .mock_pip_check .assert_called_once ()
8684 self .pkg_patcher .stop ()
8785
8886 @patch ("sys.argv" , ["bootstrap" , "-a" , "install" ])
8987 def test_can_override_available_libraries (self ):
9088 bootstrap .run (libraries = [])
91- self .mock_pip_install .assert_has_calls (
92- [call (i ) for i in default_instrumentations ],
93- any_order = True ,
89+ self .mock_pip_install .assert_called_once_with (
90+ list (default_instrumentations ),
9491 )
9592 self .mock_pip_check .assert_called_once ()
9693
@@ -101,8 +98,5 @@ def test_can_override_available_default_instrumentations(self):
10198 return_value = True ,
10299 ):
103100 bootstrap .run (default_instrumentations = [])
104- self .mock_pip_install .assert_has_calls (
105- [call (i ) for i in self .installed_libraries ],
106- any_order = True ,
107- )
101+ self .mock_pip_install .assert_called_once ()
108102 self .mock_pip_check .assert_called_once ()
0 commit comments