@@ -88,27 +88,22 @@ def test_metadata_download_file(cli_runner):
8888 assert re .search (r"ISIC_0000000.*Foo.*CC-0.*melanoma.*male" , output ), output
8989
9090
91- @pytest .mark .skipif (
92- sys .platform in ["win32" , "darwin" ], reason = "Windows and macOS don't support this test"
93- )
9491@pytest .mark .usefixtures ("_mock_image_metadata" , "_isolated_filesystem" )
95- def test_metadata_download_file_no_write (cli_run ):
96- result = cli_run (["metadata" , "download" , "-o" , "/metadata.csv" ])
92+ @pytest .mark .parametrize (
93+ "output_file" , ["/metadata.csv" , f"{ '1' * 255 } .csv" ], ids = ["no_permissions" , "bad_filename" ]
94+ )
95+ def test_metadata_download_permission_denied (cli_run , output_file ):
96+ if sys .platform == "win32" and output_file == "/metadata.csv" :
97+ pytest .skip ("Windows doesn't support this test" )
98+
99+ result = cli_run (["metadata" , "download" , "-o" , output_file ])
97100 # it's important that the exit code is 2 and not 1, because the key constraint of this
98101 # functionality is that the user gets the error message before spending their time
99102 # downloading the data. exit code 2 is for usage errors with click.
100103 assert result .exit_code == 2 , result .exception
101104 assert re .search (r"Permission denied" , result .output ), result .output
102105
103106
104- @pytest .mark .usefixtures ("_mock_image_metadata" , "_isolated_filesystem" )
105- def test_metadata_download_file_bad_filename (cli_run ):
106- result = cli_run (["metadata" , "download" , "-o" , f"{ '1' * 255 } .csv" ])
107- # see comment in test_metadata_download_file_no_write for why exit code is 2
108- assert result .exit_code == 2 , result .exception
109- assert re .search (r"Cannot write to" , result .output ), result .output
110-
111-
112107@pytest .mark .usefixtures ("_mock_image_metadata" )
113108@pytest .mark .parametrize (
114109 "cli_runner" ,
0 commit comments