File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2424
2525<!-- Changes to how Black can be configured -->
2626
27+ - Fix cache versioning logic when ` BLACK_CACHE_DIR ` is set (#3937 )
28+
2729### Packaging
2830
2931<!-- Changes to how Black is packaged, such as dependency requirements -->
Original file line number Diff line number Diff line change @@ -36,8 +36,9 @@ def get_cache_dir() -> Path:
3636 repeated calls.
3737 """
3838 # NOTE: Function mostly exists as a clean way to test getting the cache directory.
39- default_cache_dir = user_cache_dir ("black" , version = __version__ )
39+ default_cache_dir = user_cache_dir ("black" )
4040 cache_dir = Path (os .environ .get ("BLACK_CACHE_DIR" , default_cache_dir ))
41+ cache_dir = cache_dir / __version__
4142 return cache_dir
4243
4344
Original file line number Diff line number Diff line change @@ -1963,11 +1963,11 @@ def test_get_cache_dir(
19631963 # If BLACK_CACHE_DIR is not set, use user_cache_dir
19641964 monkeypatch .delenv ("BLACK_CACHE_DIR" , raising = False )
19651965 with patch_user_cache_dir :
1966- assert get_cache_dir () == workspace1
1966+ assert get_cache_dir (). parent == workspace1
19671967
19681968 # If it is set, use the path provided in the env var.
19691969 monkeypatch .setenv ("BLACK_CACHE_DIR" , str (workspace2 ))
1970- assert get_cache_dir () == workspace2
1970+ assert get_cache_dir (). parent == workspace2
19711971
19721972 def test_cache_broken_file (self ) -> None :
19731973 mode = DEFAULT_MODE
You can’t perform that action at this time.
0 commit comments