Skip to content

Commit

Permalink
Clear cache before testing that foramtters are only loaded once
Browse files Browse the repository at this point in the history
  • Loading branch information
rlskoeser committed Oct 27, 2023
1 parent e017a49 commit 1094d01
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tests/test_dateformat/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,12 @@ def test_parse_to_string(self):
BaseDateFormat().to_string(1991)


@pytest.mark.first
def test_import_formatters_import_only_once(caplog):
# run first so we can confirm it runs once
# clear the cache, since any instantiation of an Undate
# object anywhere in the test suite will populate it
BaseDateFormat.import_formatters.cache_clear()

# run first, and confirm it runs and loads formatters
with caplog.at_level(logging.DEBUG):
import_count = BaseDateFormat.import_formatters()
# should import at least one thing (iso8601)
Expand Down

0 comments on commit 1094d01

Please sign in to comment.