示例#1
0
    def test_from_datafile_comment(self):
        try:
            fd, output = tempfile.mkstemp()
            os.close(fd)

            datafile = os.path.join(os.path.dirname(__file__),
                                    'yaml/mysql_comments.yaml')
            graph.main(['-d', datafile, '-o', output])
            self.assertEqual(self.readfile('rst/mysql_comments_graph.rst'),
                             io.open(output, encoding='utf-8').read())
        finally:
            os.unlink(output)
示例#2
0
    def test_with_comments(self):
        engine = sqlalchemy.create_engine(self.mysqld.url(charset='utf8'))
        engine.execute(self.readfile('schema/mysql_comments.sql'))

        try:
            fd, output = tempfile.mkstemp()
            os.close(fd)

            rst.main(['-c', self.config.name, '-o', output])
            self.assertEqual(self.readfile('rst/mysql_comments.rst'),
                             io.open(output, encoding='utf-8').read())

            graph.main(['-c', self.config.name, '-o', output])
            self.assertEqual(self.readfile('rst/mysql_comments_graph.rst'),
                             io.open(output, encoding='utf-8').read())
        finally:
            os.unlink(output)
示例#3
0
    def test_basic(self):
        try:
            engine = sqlalchemy.create_engine(self.pgsql.url())
            engine.execute(self.readfile('schema/pgsql_basic.sql'))
        finally:
            engine.dispose()

        try:
            fd, output = tempfile.mkstemp()
            os.close(fd)

            rst.main(['-c', self.config.name, '-o', output])
            self.assertEqual(self.readfile('rst/pgsql_basic.rst'),
                             io.open(output, encoding='utf-8').read())

            graph.main(['-c', self.config.name, '-o', output])
            self.assertEqual(self.readfile('rst/pgsql_basic_graph.rst'),
                             io.open(output, encoding='utf-8').read())
        finally:
            os.unlink(output)