@@ -29,7 +29,7 @@ def test_pylint_config_without_setup(self):
2929 self .assertTrue (r [1 ].endswith ("/config_files/ext_pylintrc" ))
3030
3131 def test_pylint_config_with_partially_setup (self ):
32- cli_repo_path = "~/Azure /azure-cli"
32+ cli_repo_path = "/mnt/vss/_work/1/s /azure-cli"
3333 mocked_config = configparser .ConfigParser ()
3434 mocked_config .add_section ("cli" )
3535 mocked_config .set ("cli" , "repo_path" , cli_repo_path )
@@ -42,8 +42,8 @@ def test_pylint_config_with_partially_setup(self):
4242 self .assertTrue (r [1 ].endswith ("/config_files/ext_pylintrc" ))
4343
4444 def test_pylint_config_with_all_setup (self ):
45- cli_repo_path = "~/Azure /azure-cli"
46- ext_repo_path = "~/Azure /azure-cli-extensions"
45+ cli_repo_path = "/mnt/vss/_work/1/s /azure-cli"
46+ ext_repo_path = "/mnt/vss/_work/1/s /azure-cli-extensions"
4747 mocked_config = configparser .ConfigParser ()
4848 mocked_config .add_section ("cli" )
4949 mocked_config .set ("cli" , "repo_path" , cli_repo_path )
@@ -53,7 +53,7 @@ def test_pylint_config_with_all_setup(self):
5353 with mock .patch ("azdev.operations.style.get_azdev_config" , return_value = mocked_config ):
5454 r = _config_file_path ()
5555 self .assertEqual (r [0 ], cli_repo_path + "/pylintrc" )
56- self .assertTrue (r [1 ], "/pylintrc" )
56+ self .assertEqual (r [1 ], ext_repo_path + "/pylintrc" )
5757
5858 def test_flake8_config_wihtout_setup (self ):
5959 mocked_config = configparser .ConfigParser ()
@@ -68,7 +68,7 @@ def test_flake8_config_wihtout_setup(self):
6868 self .assertTrue (r [1 ].endswith ("/config_files/ext.flake8" ))
6969
7070 def test_flake8_config_with_partially_setup (self ):
71- ext_repo_path = "~/Azure /azure-cli-extensions"
71+ ext_repo_path = "/mnt/vss/_work/1/s /azure-cli-extensions"
7272
7373 mocked_config = configparser .ConfigParser ()
7474 mocked_config .add_section ("cli" )
@@ -81,9 +81,9 @@ def test_flake8_config_with_partially_setup(self):
8181 self .assertTrue (r [0 ].endswith ("/config_files/cli.flake8" ))
8282 self .assertTrue (r [1 ].endswith (ext_repo_path + "/.flake8" ))
8383
84- def test_flake9_config_with_all_setup (self ):
85- cli_repo_path = "~/Azure /azure-cli"
86- ext_repo_path = "~/Azure /azure-cli-extensions"
84+ def test_flake8_config_with_all_setup (self ):
85+ cli_repo_path = "/mnt/vss/_work/1/s /azure-cli"
86+ ext_repo_path = "/mnt/vss/_work/1/s /azure-cli-extensions"
8787
8888 mocked_config = configparser .ConfigParser ()
8989 mocked_config .add_section ("cli" )
@@ -95,3 +95,20 @@ def test_flake9_config_with_all_setup(self):
9595 r = _config_file_path (style_type = "flake8" )
9696 self .assertTrue (r [0 ].endswith (cli_repo_path + "/.flake8" ))
9797 self .assertTrue (r [1 ].endswith (ext_repo_path + "/.flake8" ))
98+
99+ def test_style_with_all_setup_but_not_exist (self ):
100+ cli_repo_path = "/fake/azure-cli"
101+ ext_repo_path = "/fake/azure-cli-extensions"
102+ mocked_config = configparser .ConfigParser ()
103+ mocked_config .add_section ("cli" )
104+ mocked_config .set ("cli" , "repo_path" , cli_repo_path )
105+ mocked_config .add_section ("ext" )
106+ mocked_config .set ("ext" , "repo_paths" , ext_repo_path )
107+
108+ with mock .patch ("azdev.operations.style.get_azdev_config" , return_value = mocked_config ):
109+ r1 = _config_file_path (style_type = "flake8" )
110+ r2 = _config_file_path (style_type = "pylint" )
111+ self .assertTrue (r1 [0 ].endswith ("/config_files/cli.flake8" ))
112+ self .assertTrue (r1 [1 ].endswith ("/config_files/ext.flake8" ))
113+ self .assertTrue (r2 [0 ].endswith ("/config_files/cli_pylintrc" ))
114+ self .assertTrue (r2 [1 ].endswith ("/config_files/ext_pylintrc" ))
0 commit comments