diff options
author | Aarni Koskela <akx@iki.fi> | 2023-02-07 16:00:41 +0200 |
---|---|---|
committer | Aarni Koskela <akx@iki.fi> | 2023-02-07 16:17:10 +0200 |
commit | 08af5e2bab184c1b5d357ebde8c0efdbe6288e2c (patch) | |
tree | 90740322872ed87ff345719b2cf815fbbd14bfee /tests | |
parent | 221c937af65e6691a0958ec9bbc29a9bbbd77383 (diff) | |
download | babel-08af5e2bab184c1b5d357ebde8c0efdbe6288e2c.tar.gz |
Replace babel.localedata.locale_identifiers cache with LRU cache
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_localedata.py | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/tests/test_localedata.py b/tests/test_localedata.py index 913922e..75c34b1 100644 --- a/tests/test_localedata.py +++ b/tests/test_localedata.py @@ -110,18 +110,15 @@ def test_locale_identifiers_cache(monkeypatch): rv = original_listdir(*args) listdir_calls.append((args, rv)) return rv - monkeypatch.setattr(localedata.os, 'listdir', listdir_spy) - - # In case we've already run some tests... - if hasattr(localedata.locale_identifiers, 'cache'): - del localedata.locale_identifiers.cache + monkeypatch.setattr(localedata.os, 'listdir', listdir_spy) + localedata.locale_identifiers.cache_clear() assert not listdir_calls - assert localedata.locale_identifiers() + l = localedata.locale_identifiers() assert len(listdir_calls) == 1 - assert localedata.locale_identifiers() is localedata.locale_identifiers.cache + assert localedata.locale_identifiers() is l assert len(listdir_calls) == 1 - localedata.locale_identifiers.cache = None + localedata.locale_identifiers.cache_clear() assert localedata.locale_identifiers() assert len(listdir_calls) == 2 |