Debian Codegraph @

scripts/update_contrasts.py

raw
1 #!/usr/bin/env python3
2 """
3 Updates tests/contrast/min_contrasts.json
4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5
6 Whenever you have improved the minimum contrast of a style you should run
7 this script, so that the test_contrasts.py test prevents future degredations.
8 """
9
10 import os
11 import sys
12
13 # always prefer Pygments from source if exists
14 srcpath = os.path.join(os.path.dirname(__file__), "..")
15 if os.path.isdir(os.path.join(srcpath, "pygments")):
16 sys.path.insert(0, srcpath)
17
18 import tests.contrast.test_contrasts # noqa: E402
19
20 tests.contrast.test_contrasts.test_contrasts(fail_if_improved=False)
21 tests.contrast.test_contrasts.update_json()