Ejemplo n.º 1
0
def test_run_tests():
    """
    Test all the thingers.
    """
    ws = TestSuite(workspace)
    test = ws.get_test('cruft-empty-diff')
    test.run()
Ejemplo n.º 2
0
def test_test_context():
    """
    Make sure the context overloader works correctly
    """
    ws = TestSuite(workspace)
    for test in ws.tests():
        assert test._context['foo'] != 'foo'
        assert test._context['bar'] == 'bar'
Ejemplo n.º 3
0
def test_hooks():
    """
    Test all the thingers.
    """
    ws = TestSuite(workspace)
    test = ws.get_test("hook-basics")
    with tmpdir() as tmp:
        test._run_hook("pre-build", tmp)
        assert os.path.exists("%s/pre-build" % (tmp))
Ejemplo n.º 4
0
def test_test_finder():
    """
    Make sure we can resolve test folders correctly.
    """
    tests = os.listdir("%s/tests" % (workspace))
    ws = TestSuite(workspace)
    for test in ws.tests():
        tests.remove(test.test_id)
    assert tests == []
Ejemplo n.º 5
0
def test_invalid_template():
    ws = TestSuite(workspace)
    test = ws.get_test("invalid-template-call")
    source, version = test.get_source_and_version()
    version = version['upstream']
    try:
        test.get_template_stack()
    except InvalidTemplate:
        return
    assert True is False
Ejemplo n.º 6
0
def test_upstream_shim():
    ws = TestSuite(workspace)
    test = ws.get_test("native-calls-upstream-shim")
    source, version = test.get_source_and_version()
    version = version['upstream']
    try:
        test.get_template_stack()
    except InvalidTemplate:
        return
    assert True is False
Ejemplo n.º 7
0
def test_render_nested():
    ws = TestSuite(workspace)
    test = ws.get_test("nested-thing")
    source, version = test.get_source_and_version()
    version = version['upstream']
    tm = test.get_template_stack()
    with tmpdir() as tmp:
        path = "%s/%s-%s" % (tmp, source, version)
        mkdir(path)
        tm.render(path)
        assert os.path.exists("%s/kruft" % (path))
Ejemplo n.º 8
0
def test_todo():
    ws = TestSuite(workspace)
    test = ws.get_test("todo-test")
    source, version = test.get_source_and_version()
    version = version['upstream']
    tm = test.get_template_stack()
    with tmpdir() as tmp:
        path = "%s/%s-%s" % (tmp, source, version)
        mkdir(path)
        tm.render(path)
        ret = test.run()
        assert ret == {}
Ejemplo n.º 9
0
def test_crazy_things():
    """
    Make sure we can resolve test folders correctly.
    """
    ws = TestSuite(workspace)
    test = ws.get_test("cruft-empty-diff")
    assert test._template_search("hello") is not None
    assert test._template_search("generic") is not None
    try:
        test._template_search("hello-brainfuck")
        assert False is True
    except Exception:
        pass
Ejemplo n.º 10
0
def test_run_all_the_things():
    """
    Test all the thingers.
    """
    ws = TestSuite(workspace)
    test = ws.get_test("cruft-empty-diff")
    source, version = test.get_source_and_version()
    version = version['upstream']

    tm = test.get_template_stack()
    with tmpdir() as tmp:
        path = "%s/%s-%s" % (tmp, source, version)
        mkdir(path)
        tm.render(path)
Ejemplo n.º 11
0
def test_templater():
    """
    Make sure we can render out templates correctly
    """
    ws = TestSuite(workspace)
    test = ws.get_test("cruft-empty-diff")
    source, version = test.get_source_and_version()
    version = version['upstream']

    tm = test.get_template_stack()
    with tmpdir() as tmp:
        path = "%s/%s-%s" % (tmp, source, version)
        mkdir(path)
        tm.render(path)
Ejemplo n.º 12
0
def test_failure():
    ws = TestSuite(workspace)
    test = ws.get_test('fields-maintainer-arno')
    results = test.run()
    assert "failed" in [results[x] for x in results]