This repository has been archived on 2024-06-20. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
coffee.pygments/scripts/update_contrasts.py
2023-11-20 20:36:01 +01:00

21 lines
648 B
Python
Executable file

#!/usr/bin/env python3
"""
Updates tests/contrast/min_contrasts.json
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Whenever you have improved the minimum contrast of a style you should run
this script, so that the test_contrasts.py test prevents future degredations.
"""
import os
import sys
# always prefer Pygments from source if exists
srcpath = os.path.join(os.path.dirname(__file__), "..")
if os.path.isdir(os.path.join(srcpath, "pygments")):
sys.path.insert(0, srcpath)
import tests.contrast.test_contrasts # noqa: E402
tests.contrast.test_contrasts.test_contrasts(fail_if_improved=False)
tests.contrast.test_contrasts.update_json()