diff options
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 |