예제 #1
0
파일: loading.py 프로젝트: duthils/greglink
def load_test(path, filepath):
    with open(filepath) as testfile:
        header, markup = load_testfile(testfile)

    if not header:
        raise NoHeaderInTestFile("Test file %s has no header" % filepath)

    return TestCase(path, header, markup)
예제 #2
0
    def test_load_testfile_small_file(self):
        mockfile = StringIO(textwrap.dedent("""
        ---
        foo: bar
        ---

        Hello World
        ===========

        content
        """))

        expected = ({'foo': 'bar'}, u"Hello World\n===========\n\ncontent")

        result = testfile.load_testfile(mockfile)
        self.assertEquals(result, expected)
예제 #3
0
    def test_load_testfile_only_header(self):
        mockfile = StringIO("---\nfoo: bar\n---\n")
        expected = ({'foo': 'bar'}, "")

        result = testfile.load_testfile(mockfile)
        self.assertEquals(result, expected)
예제 #4
0
    def test_load_testfile_incomplete_header(self):
        mockfile = StringIO("---\nfoo: bar\n\n")
        expected = (None, "")

        result = testfile.load_testfile(mockfile)
        self.assertEquals(result, expected)
예제 #5
0
    def test_load_testfile_empty_file(self):
        mockfile = StringIO("")
        expected = (None, "")

        result = testfile.load_testfile(mockfile)
        self.assertEquals(result, expected)