def test_ufolint_runner_ufo3_data_empty_data_dir_fail(capsys): test_path = os.path.join(ufo_fail_dir_basepath, 'data', 'UFO3-EmptyData.ufo') mr = MainRunner(test_path) mr.run() out, err = capsys.readouterr() assert '[data] empty' in out
def main(): c = Command() if c.does_not_validate_missing_args(): sys.stderr.write( f"[ufolint] ERROR: Please include one or more UFO directory arguments " f"with your command.{os.linesep}") sys.exit(1) if c.is_help_request(): print(HELP) sys.exit(0) elif c.is_version_request(): print(VERSION) sys.exit(0) elif c.is_usage_request(): print(USAGE) sys.exit(0) for argument in sys.argv: if argument[-4:] == ".ufo": hh = MainRunner(argument) hh.run() # if the script completes without status code 1 SystemExit # being raised, then all tests passed sys.exit(0)
def test_ufolint_runner_ufo3_run_success(): mr = MainRunner(ufo3_test_success_path) mr.run() assert mr.ufoversion == 3 assert isinstance(mr.failures_list, list) assert len(mr.failures_list) == 0 # nothing failed during the run of a valid UFO directory
def test_ufolint_runner_ufo3_data_missing_data_dir_fail(capsys): test_path = os.path.join(ufo_fail_dir_basepath, 'data', 'UFO3-DataDirNotPresent.ufo') mr = MainRunner(test_path) mr.run() out, err = capsys.readouterr() assert '[data] not present' in out
def test_ufolint_runner_ufo3_featuresfea_missing(capsys): test_path = os.path.join(ufo_fail_dir_basepath, 'featuresfea', 'UFO3-FeaturesFeaMissing.ufo') mr = MainRunner(test_path) mr.run() out, err = capsys.readouterr() assert '[features.fea] not present' in out
def test_ufolint_runner_glif_validation_fail_test(): testpath = os.path.join(ufo_fail_dir_basepath, 'glif', 'UFO3-UFOlibError.ufo') mr = MainRunner(testpath) with pytest.raises(SystemExit) as pytest_wrapped_e: mr.run() assert pytest_wrapped_e.type == SystemExit assert pytest_wrapped_e.value.code == 1
def test_ufolint_runner_ufo3_images_fail_test(capsys): test_path = os.path.join(ufo_fail_dir_basepath, 'images', 'UFO3-NonPNGImage.ufo') with pytest.raises(SystemExit) as pytest_wrapped_e: mr = MainRunner(test_path) mr.run() assert pytest_wrapped_e.type == SystemExit assert pytest_wrapped_e.value.code == 1
def test_ufolint_runner_xml_validation_fail_test(): testpath = os.path.join(ufo_fail_dir_basepath, 'fontinfoPL', 'UFO3-XMLfi.ufo') mr = MainRunner(testpath) with pytest.raises(SystemExit) as pytest_wrapped_e: mr.run() assert pytest_wrapped_e.type == SystemExit assert pytest_wrapped_e.value.code == 1
def test_ufolint_runner_mandatory_file_missing_test(): testpath = os.path.join(ufo_fail_dir_basepath, 'contentsPL', 'UFO2-MissingCont.ufo') mr = MainRunner(testpath) with pytest.raises(SystemExit) as pytest_wrapped_e: mr.run() assert pytest_wrapped_e.type == SystemExit assert pytest_wrapped_e.value.code == 1
def test_ufolint_runner_missing_layercontents_plist_defined_glyphs_dir(): testpath = os.path.join(ufo_fail_dir_basepath, 'layercontentsPL', 'UFO3-MissingGlyphsDir.ufo') mr = MainRunner(testpath) with pytest.raises(SystemExit) as pytest_wrapped_e: mr.run() assert pytest_wrapped_e.type == SystemExit assert pytest_wrapped_e.value.code == 1
def test_ufolint_runner_unsupported_version(): testpath = os.path.join(ufo_fail_dir_basepath, 'metainfoPL', 'UFO2-VersionFail.ufo') mr = MainRunner(testpath) with pytest.raises(SystemExit) as pytest_wrapped_e: mr.run() assert pytest_wrapped_e.type == SystemExit assert pytest_wrapped_e.value.code == 1
def test_ufolint_runner_ufo3_data_success(capsys): mr = MainRunner(ufo3_test_success_path) mr.run() out, err = capsys.readouterr() assert '[data] 2 data files' in out
def test_ufolint_runner_ufo3_featuresfea_success(capsys): mr = MainRunner(ufo3_test_success_path) mr.run() out, err = capsys.readouterr() assert '[features.fea] .' in out