File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change 99
1010import pytest
1111
12+ import pip ._vendor .platformdirs .windows as platformdirs_windows
13+
1214from pip ._internal .cli .status_codes import ERROR
1315from pip ._internal .configuration import CONFIG_BASENAME , get_configuration_files
16+ from pip ._internal .utils .compat import WINDOWS
1417
1518from tests .lib import PipTestEnvironment
1619from tests .lib .configuration_helpers import ConfigurationMixin , kinds
@@ -24,13 +27,12 @@ def test_no_options_passed_should_error(script: PipTestEnvironment) -> None:
2427
2528class TestBasicLoading (ConfigurationMixin ):
2629 @pytest .fixture (autouse = True )
27- def cleanup_files (self ) -> Generator [None ]:
28- """Avoid state leaking for tests reusing config files."""
30+ def clear_platformdirs_cache (self ) -> Generator [None ]:
31+ # This is ugly, but platformdirs caches the user config directory on
32+ # Windows which breaks our test assertions.
2933 yield
30- for variant in get_configuration_files ():
31- for path in variant :
32- if os .path .exists (path ):
33- os .remove (path )
34+ if WINDOWS :
35+ platformdirs_windows .get_win_folder .cache_clear ()
3436
3537 def test_basic_modification_pipeline (self , script : PipTestEnvironment ) -> None :
3638 script .pip ("config" , "get" , "test.blah" , expect_error = True )
You can’t perform that action at this time.
0 commit comments