예제 #1
0
def test_run_tests():
    """
    Test all the thingers.
    """
    ws = TestSuite(workspace)
    test = ws.get_test('cruft-empty-diff')
    test.run()
예제 #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'
예제 #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))
예제 #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 == []
예제 #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
예제 #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
예제 #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))
예제 #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 == {}
예제 #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
예제 #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)
예제 #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)
예제 #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]