Completely bypass an entire test class in the test suite?

24 views
Skip to first unread message

gordon.d...@gmail.com

unread,
Nov 9, 2022, 2:34:35 PM11/9/22
to sqlalchemy-devel
3rd-party dialects can bypass individual tests in the test suite by overriding the test in our local copy of "test_suite.py". For example,

from sqlalchemy.testing.suite import SimpleUpdateDeleteTest as _SimpleUpdateDeleteTest

class SimpleUpdateDeleteTest(_SimpleUpdateDeleteTest):
    @testing.skip("firebird")
    def test_update(self):
        # hangs tests (Gord, Windows, FB3)
        return

In this particular case that was not sufficient because Firebird does not support transactional DDL. (For example, CREATE TABLE t immediately followed by INSERT INTO t in the same transaction fails with "table t does not exist". It's actually not the test that's failing, it's the fixture (setup or teardown) that messes things up.

In this particular case I was able to do

class SimpleUpdateDeleteTest(_SimpleUpdateDeleteTest):
    @classmethod
    def define_tables(cls, metadata):
        pass

    @classmethod
    def insert_data(cls, connection):
        pass

    @testing.skip("firebird")
    def test_delete(self):
        # hangs tests (Gord, Windows, FB3)
        return

    @testing.skip("firebird")
    def test_update(self):
        # hangs tests (Gord, Windows, FB3)
        return

However, there are other tests that are far more convoluted and it would be nice just to completely ignore the entire class (setup, tests, teardown, everything).

Is there a way to do that?

Mike Bayer

unread,
Nov 9, 2022, 3:23:53 PM11/9/22
to sqlalche...@googlegroups.com
Yeah I think you just dont import that test into your suite, or import it and then replace it with an empty class.





--
You received this message because you are subscribed to the Google Groups "sqlalchemy-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy-dev...@googlegroups.com.

gordon.d...@gmail.com

unread,
Nov 10, 2022, 6:56:28 PM11/10/22
to sqlalchemy-devel
> or import it and then replace it with an empty class

That was the ticket, thanks. The dialect's test_suite.py already did

from sqlalchemy.testing.suite import *

so I guess "not importing that one test" would imply "explicitly import all tests except that one", which would be a nuisance.

Thanks again.

Reply all
Reply to author
Forward
0 new messages