2020from openstackclient .tests .unit .integ import base as test_base
2121from openstackclient .tests .unit import test_shell
2222
23- # NOTE(dtroyer): Attempt the import to detect if the SDK installed is new
24- # enough to contain the os_client_config code. If so, use
25- # that path for mocks.
26- CONFIG_MOCK_BASE = "openstack.config.loader"
27- try :
28- from openstack .config import defaults # noqa
29- except ImportError :
30- # Fall back to os-client-config
31- CONFIG_MOCK_BASE = "os_client_config.config"
32-
3323
3424class TestIntegShellCliNoAuth (test_base .TestInteg ):
3525
@@ -455,8 +445,8 @@ def get_temp_file_path(self, filename):
455445 temp_dir = self .useFixture (fixtures .TempDir ())
456446 return temp_dir .join (filename )
457447
458- @mock .patch (CONFIG_MOCK_BASE + " .OpenStackConfig._load_vendor_file" )
459- @mock .patch (CONFIG_MOCK_BASE + " .OpenStackConfig._load_config_file" )
448+ @mock .patch ("openstack.config.loader .OpenStackConfig._load_vendor_file" )
449+ @mock .patch ("openstack.config.loader .OpenStackConfig._load_config_file" )
460450 def test_shell_args_precedence_1 (self , config_mock , vendor_mock ):
461451 """Precedence run 1
462452
@@ -473,7 +463,6 @@ def vendor_mock_return():
473463 return ('file.yaml' , copy .deepcopy (test_shell .PUBLIC_1 ))
474464 vendor_mock .side_effect = vendor_mock_return
475465
476- print ("CONFIG_MOCK_BASE=%s" % CONFIG_MOCK_BASE )
477466 _shell = shell .OpenStackShell ()
478467 _shell .run (
479468 "--os-password qaz extension list" .split (),
@@ -527,8 +516,8 @@ def vendor_mock_return():
527516 # +env, +cli, +occ
528517 # see test_shell_args_precedence_2()
529518
530- @mock .patch (CONFIG_MOCK_BASE + " .OpenStackConfig._load_vendor_file" )
531- @mock .patch (CONFIG_MOCK_BASE + " .OpenStackConfig._load_config_file" )
519+ @mock .patch ("openstack.config.loader .OpenStackConfig._load_vendor_file" )
520+ @mock .patch ("openstack.config.loader .OpenStackConfig._load_config_file" )
532521 def test_shell_args_precedence_2 (self , config_mock , vendor_mock ):
533522 """Precedence run 2
534523
@@ -545,7 +534,6 @@ def vendor_mock_return():
545534 return ('file.yaml' , copy .deepcopy (test_shell .PUBLIC_1 ))
546535 vendor_mock .side_effect = vendor_mock_return
547536
548- print ("CONFIG_MOCK_BASE=%s" % CONFIG_MOCK_BASE )
549537 _shell = shell .OpenStackShell ()
550538 _shell .run (
551539 "--os-username zarquon --os-password qaz "
0 commit comments