Speed up tests.

Load scheme and shape extractor just once for a test group.
This commit is contained in:
Sergey Vartanov 2021-05-21 04:22:12 +03:00
parent 1b40087b18
commit c5bb1529f5
2 changed files with 9 additions and 7 deletions

View file

@ -11,6 +11,11 @@ from roentgen.grid import draw_all_icons
from roentgen.icon import ShapeExtractor
from roentgen.scheme import Scheme
SCHEME: Scheme = Scheme("scheme/default.yml")
ICON_EXTRACTOR: ShapeExtractor = ShapeExtractor(
"icons/icons.svg", Path("icons/config.json")
)
def test_icons() -> None:
""" Test grid drawing. """
@ -19,11 +24,7 @@ def test_icons() -> None:
def get_icon(tags: Dict[str, str]):
scheme = Scheme("scheme/default.yml")
icon_extractor = ShapeExtractor(
"icons/icons.svg", Path("icons/config.json")
)
icon, _ = scheme.get_icon(icon_extractor, tags)
icon, _ = SCHEME.get_icon(ICON_EXTRACTOR, tags)
return icon