Beispiel #1
0
def test_loading():
    model_file = distribution().locate_file("tests/test-model.gaphor")
    outfile = PseudoFile()

    generate(model_file, outfile)

    assert outfile.data == GENERATED, f'"""{outfile.data}"""'
Beispiel #2
0
def test_loading():
    dist = importlib_metadata.distribution("gaphor")
    model_file = dist.locate_file("tests/test-model.gaphor")
    outfile = PseudoFile()

    generate(model_file, outfile)

    assert outfile.data == GENERATED, '"""%s"""' % outfile.data
Beispiel #3
0
def generate_uml2(force=False):
    """
    Generate gaphor/UML/uml2.py in the source directory.
    """
    gen = os.path.join("utils", "model", "gen_uml.py")
    overrides = os.path.join("gaphor", "UML", "uml2.override")
    model = os.path.join("gaphor", "UML", "uml2.gaphor")
    py_model = os.path.join("gaphor", "UML", "uml2.py")
    outfile = py_model
    mkpath(os.path.dirname(outfile))
    if (force or newer(model, outfile) or newer(overrides, outfile)
            or newer(gen, outfile)):
        print(f"generating {py_model} from {model}...")
        print("  (warnings can be ignored)")

        gen_uml.generate(model, outfile, overrides)
    else:
        print(f"not generating {py_model} (up-to-date)")
    byte_compile([outfile])