Example #1
0
    def test_report_raw_sql(self):
        """ Ensure that reporting works when raw SQL queries were emitted. """
        profiler = sqltap.start(self.engine)

        sess = self.Session()
        sql = 'SELECT * FROM %s' % self.A.__tablename__
        sess.connection().execute(sql)

        stats = profiler.collect()
        report = sqltap.report(stats, report_format="html")
        assert REPORT_TITLE in report
        assert sqltap.format_sql(sql) in report
        report = sqltap.report(stats, report_format="text")
        assert REPORT_TITLE in report
        assert sqlparse.format(sql, reindent=True) in report
        profiler.stop()
Example #2
0
    def test_report_raw_sql(self):
        """ Ensure that reporting works when raw SQL queries were emitted. """
        profiler = sqltap.start(self.engine)

        sess = self.Session()
        sql = 'SELECT * FROM %s' % self.A.__tablename__
        sess.connection().execute(sql)

        stats = profiler.collect()
        report = sqltap.report(stats, report_format="html")
        assert REPORT_TITLE in report
        assert sqltap.format_sql(sql) in report
        report = sqltap.report(stats, report_format="text")
        assert REPORT_TITLE in report
        assert sqlparse.format(sql, reindent=True) in report
        profiler.stop()
Example #3
0
    def test_report(self):
        profiler = sqltap.start(self.engine)

        sess = self.Session()
        q = sess.query(self.A)
        qtext = sqltap.format_sql(str(q))
        q.all()

        stats = profiler.collect()
        report = sqltap.report(stats, report_format="html")
        assert REPORT_TITLE in report
        assert qtext in report
        report = sqltap.report(stats, report_format="text")
        assert REPORT_TITLE in report
        assert sqlparse.format(qtext, reindent=True) in report
        profiler.stop()
Example #4
0
    def test_report(self):
        profiler = sqltap.start(self.engine)

        sess = self.Session()
        q = sess.query(self.A)
        qtext = sqltap.format_sql(str(q))
        q.all()

        stats = profiler.collect()
        report = sqltap.report(stats, report_format="html")
        assert REPORT_TITLE in report
        assert qtext in report
        report = sqltap.report(stats, report_format="text")
        assert REPORT_TITLE in report
        assert sqlparse.format(qtext, reindent=True) in report
        profiler.stop()