Debian Codegraph @

test_non_regression/__init__.py

raw
1 """
2 Cairo test suite.
3
4 """
5
6 import importlib.util
7 import os
8 import sys
9 from pathlib import Path
10
11 import cairosvg
12
13 CURRENT_FOLDER = Path(__file__).parent
14 TEST_FOLDER = CURRENT_FOLDER / 'svg'
15
16 reference_spec = importlib.util.spec_from_file_location(
17 'cairosvg_reference',
18 CURRENT_FOLDER / 'cairosvg_reference' / 'cairosvg' / '__init__.py')
19 reference_cairosvg = importlib.util.module_from_spec(reference_spec)
20 sys.modules['cairosvg_reference'] = reference_cairosvg
21 reference_spec.loader.exec_module(reference_cairosvg)
22
23 cairosvg.features.LOCALE = reference_cairosvg.features.LOCALE = 'en_US'
24 os.chdir(TEST_FOLDER) # relative image urls
25
26 if os.environ.get('CAIROSVG_TEST_FILES'): # pragma: no cover
27 FILES = [
28 str(CURRENT_FOLDER / filename) for filename in
29 os.environ['CAIROSVG_TEST_FILES'].split(',')]
30 else:
31 FILES = [str(path) for path in TEST_FOLDER.iterdir()]
32 FILES.sort(key=lambda path: path.lower())