Skip to content

Instantly share code, notes, and snippets.

@chrissimpkins
Last active August 14, 2020 16:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrissimpkins/0f6c23b8dd46e877218e9534af58ff57 to your computer and use it in GitHub Desktop.
Save chrissimpkins/0f6c23b8dd46e877218e9534af58ff57 to your computer and use it in GitHub Desktop.
Fontbakery always pass custom profile for testing
# Copyright 2020 Christopher Simpkins
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import os
import sys
from fontbakery.checkrunner import Section, PASS, FAIL
from fontbakery.callable import check
from fontbakery.fonts_profile import profile_factory
profile_imports = ()
profile = profile_factory(
default_section=Section("An always pass custom profile for testing")
)
ALWAYSPASS_PROFILE_CHECKS = [
"com.google.fonts/check/testing/alwayspass",
]
@check(
id="com.google.fonts/check/testing/alwayspass",
rationale="""
This is an always passing fontbakery check for testing purposes.
""",
)
def com_google_fonts_check_testing_alwayspass(ttFonts):
"""This is an always passing fontbakery check for testing purposes."""
try:
tests_passed = True
for tt in ttFonts:
pass
if tests_passed:
yield PASS, "This test always passes."
except Exception as e:
sys.stderr.write("[ERROR]: {}".format(str(e)))
sys.exit(1)
# ================================================
#
# End check definitions
#
# ================================================
profile.auto_register(globals())
profile.test_expected_checks(ALWAYSPASS_PROFILE_CHECKS, exclusive=True)
@chrissimpkins
Copy link
Author

Usage

$ fontbakery check-profile path/to/check-alwayspass.py [FONT PATH 1] [FONT PATH ...]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment