-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #761 from akaihola/git-test-cache
Speed up parameterized tests which use Git
- Loading branch information
Showing
14 changed files
with
560 additions
and
305 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
"""Configuration and fixtures for the Pytest based test suite.""" | ||
|
||
import pytest | ||
|
||
try: | ||
from black.files import _load_toml | ||
except ImportError: | ||
# Black 24.1.1 and earlier don't have `_load_toml`. | ||
_load_toml = None # type: ignore[assignment] | ||
|
||
|
||
@pytest.fixture | ||
def load_toml_cache_clear() -> None: | ||
"""Clear LRU caching in `black.files._load_toml` before each test. | ||
To use this on all test cases in a test module, add this to the top:: | ||
pytestmark = pytest.mark.usefixtures("load_toml_cache_clear") | ||
""" | ||
if _load_toml: | ||
# Black 24.1.1 and earlier don't have `_load_toml`, so no LRU cache to clear. | ||
_load_toml.cache_clear() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.