예제 #1
0
def test_crate_to_yaml():
    name = "mycrate"
    version = "0.0.1"
    author = "me"
    build_steps = ["apt install foo", "apt install bar"]
    bundles = ["mybundle", "foobundle"]
    includes = ["src/", "tests/"]
    run_command = "/bin/sh"

    c = crate.new(name,
                  version,
                  author=author,
                  build_steps=build_steps,
                  bundles=bundles,
                  includes=includes,
                  run_command=run_command)
    actual = c.to_yaml()

    items = [s.strip() for s in actual.splitlines()]
    assert "name: {}".format(name) in items
    assert "version: {}".format(version) in items
    assert "author: {}".format(author) in items
    assert "build_steps:" in items
    assert "- apt install foo" in items
    assert "- apt install bar" in items
    assert "bundles:" in items
    assert "- mybundle" in items
    assert "- foobundle" in items
    assert "includes:" in items
    assert "- src/" in items
    assert "- tests/" in items
    assert "run_command: {}".format(run_command) in items
예제 #2
0
 def load(self, name):
     return crate.new(
         name,
         "0.0.1",
         build_steps=[
             "bar",
             "baz",
         ],
         includes=["foobar.txt"],
         run_command="/bin/sh",
     )
예제 #3
0
def test_crate_equality():
    crate1 = crate.new("mycrate",
                       "0.0.1",
                       author="me",
                       build_steps=["this", "is", "a", "test"],
                       bundles=["foo", "bar", "baz"],
                       includes=["myfile"],
                       run_command="gogogo")
    crate2 = deepcopy(crate1)

    assert crate1 == crate2
예제 #4
0
def crate_obj():
    return crate.new(
        "mycrate",
        "0.0.1",
        author="me",
        build_steps=[
            "make",
            "make install",
        ],
        bundles=["python"],
        includes=["myapp/", "tests/"],
        run_command="/bin/sh",
    )
예제 #5
0
def test_crate_creation_with_run_command():
    name = "mycrate"
    version = "0.0.1"
    run_command = "/bin/sh"

    actual = crate.new(name, version, run_command=run_command)

    assert actual.name == name
    assert actual.run_command == run_command
    assert actual.version == version
    assert actual.author == ""
    assert actual.build_steps == []
    assert actual.bundles == []
    assert actual.includes == []
예제 #6
0
def test_crate_creation_minimal():
    name = "mycrate"
    version = "0.0.1"

    actual = crate.new(name, version)
    assert isinstance(actual, crate.Crate)

    assert actual.name == name
    assert actual.version == version
    assert actual.author == ""
    assert actual.build_steps == []
    assert actual.bundles == []
    assert actual.includes == []
    assert actual.run_command == ""
예제 #7
0
def test_crate_creation_with_includes():
    name = "mycrate"
    version = "0.0.1"
    includes = ["src/", "tests/"]

    actual = crate.new(name, version, includes=includes)

    assert actual.includes == includes
    assert actual.name == name
    assert actual.version == version
    assert actual.author == ""
    assert actual.build_steps == []
    assert actual.bundles == []
    assert actual.run_command == ""
예제 #8
0
def test_crate_creation_with_build_steps():
    name = "mycrate"
    version = "0.0.1"
    build_steps = ["apt install python" "apt install foo"]

    actual = crate.new(name, version, build_steps=build_steps)

    assert actual.build_steps == build_steps
    assert actual.name == name
    assert actual.version == version
    assert actual.author == ""
    assert actual.bundles == []
    assert actual.includes == []
    assert actual.run_command == ""
예제 #9
0
def test_crate_creation_with_bundles():
    name = "mycrate"
    version = "0.0.1"
    bundles = ["mybundle", "foobundle"]

    actual = crate.new(name, version, bundles=bundles)
    assert isinstance(actual, crate.Crate)

    assert actual.bundles == bundles
    assert actual.name == name
    assert actual.version == version
    assert actual.author == ""
    assert actual.build_steps == []
    assert actual.includes == []
    assert actual.run_command == ""