black/tests
Perry Vargas 10677baa40
Allow setting custom cache directory on all platforms (#2739)
Fixes #2506

``XDG_CACHE_HOME`` does not work on Windows. To allow for users to set a custom cache directory on all systems I added a new environment variable ``BLACK_CACHE_DIR`` to set the cache directory. The default remains the same so users will only notice a change if that environment variable is set.

The specific use case I have for this is I need to run black on in different processes at the same time. There is a race condition with the cache pickle file that made this rather difficult. A custom cache directory will remove the race condition.

I created ``get_cache_dir`` function in order to test the logic. This is only used to set the ``CACHE_DIR`` constant.
2022-01-21 22:00:33 -08:00
..
data Normalise string prefix order (#2297) 2022-01-13 09:59:43 -08:00
__init__.py Remove deprecated use of 'setup.py test' (#1275) 2020-05-08 06:23:50 -07:00
conftest.py Use optional tests for "no_python2" to simplify local testing (#2203) 2021-05-07 15:03:13 +02:00
empty.toml Add --target-version option to allow users to choose targeted Python versions (#618) 2019-02-06 18:43:50 -08:00
optional.py Support pytest 7 by fixing broken imports (GH-2705) 2021-12-24 22:28:43 -05:00
test_black.py Allow setting custom cache directory on all platforms (#2739) 2022-01-21 22:00:33 -08:00
test_blackd.py Remove Python 2 support (#2740) 2022-01-10 04:16:30 -08:00
test_format.py Deprecate ESP and move the functionality under --preview (#2789) 2022-01-20 15:42:07 -08:00
test_ipynb.py Add support for custom python cell magics (#2744) 2022-01-20 16:45:28 -08:00
test_no_ipynb.py Support pytest 7 by fixing broken imports (GH-2705) 2021-12-24 22:28:43 -05:00
test_primer.py [trivial] Use proper test cases on unittest (#2775) 2022-01-15 14:19:37 -08:00
test_trans.py Fix determination of f-string expression spans (#2654) 2021-12-01 09:52:24 -08:00
test.toml Add support for custom python cell magics (#2744) 2022-01-20 16:45:28 -08:00
util.py Print out line diff on test failure (#2552) 2021-10-27 07:37:20 -07:00