From: Mike Bayer Date: Wed, 3 Feb 2021 21:47:53 +0000 (-0500) Subject: Repair tests for older SQLite, timing, pypy X-Git-Tag: rel_1_4_0b2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8fc36f3b56e574d7019de55b4c3b86aeec81472f;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git Repair tests for older SQLite, timing, pypy Change-Id: I9e425d2415d18a893342244755c7748b546fb20d --- diff --git a/doc/build/tutorial/data.rst b/doc/build/tutorial/data.rst index 1b9d946b29..5da8b8667b 100644 --- a/doc/build/tutorial/data.rst +++ b/doc/build/tutorial/data.rst @@ -1520,7 +1520,7 @@ number the email addresses of individual users: ... user_table.c.name, ... address_table.c.email_address ... ).select_from(user_table).join(address_table) - >>> with engine.connect() as conn: + >>> with engine.connect() as conn: # doctest:+SKIP ... result = conn.execute(stmt) ... print(result.all()) {opensql}BEGIN (implicit) @@ -1541,7 +1541,7 @@ We also may make use of the ``ORDER BY`` clause using :paramref:`_functions.Func ... func.count().over(order_by=user_table.c.name), ... user_table.c.name, ... address_table.c.email_address).select_from(user_table).join(address_table) - >>> with engine.connect() as conn: + >>> with engine.connect() as conn: # doctest:+SKIP ... result = conn.execute(stmt) ... print(result.all()) {opensql}BEGIN (implicit) @@ -1592,7 +1592,7 @@ using the :meth:`_functions.FunctionElement.filter` method:: ... func.count(address_table.c.email_address).filter(user_table.c.name == 'sandy'), ... func.count(address_table.c.email_address).filter(user_table.c.name == 'spongebob') ... ).select_from(user_table).join(address_table) - >>> with engine.connect() as conn: + >>> with engine.connect() as conn: # doctest:+SKIP ... result = conn.execute(stmt) ... print(result.all()) {opensql}BEGIN (implicit) @@ -1637,7 +1637,7 @@ modern versions of SQLite:: >>> onetwothree = func.json_each('["one", "two", "three"]').table_valued("value") >>> stmt = select(onetwothree).where(onetwothree.c.value.in_(["two", "three"])) - >>> with engine.connect() as conn: + >>> with engine.connect() as conn: # doctest:+SKIP ... result = conn.execute(stmt) ... print(result.all()) {opensql}BEGIN (implicit) diff --git a/test/dialect/test_sqlite.py b/test/dialect/test_sqlite.py index 23ceb88b3c..ad169eebf9 100644 --- a/test/dialect/test_sqlite.py +++ b/test/dialect/test_sqlite.py @@ -536,17 +536,15 @@ class DefaultsTest(fixtures.TestBase, AssertsCompiledSQL): "t", self.metadata, Column("id", Integer, primary_key=True), - Column("x", DateTime(), server_default=func.now()), + Column("x", String(), server_default=func.lower("UPPERCASE")), ) t.create(testing.db) with testing.db.begin() as conn: - now = conn.scalar(func.now()) - today = datetime.datetime.today() conn.execute(t.insert()) - conn.execute(t.insert().values(x=today)) + conn.execute(t.insert().values(x="foobar")) eq_( conn.execute(select(t.c.x).order_by(t.c.id)).fetchall(), - [(now,), (today,)], + [("uppercase",), ("foobar",)], ) @testing.provide_metadata diff --git a/test/orm/test_deprecations.py b/test/orm/test_deprecations.py index e15bb4674d..34e3a48312 100644 --- a/test/orm/test_deprecations.py +++ b/test/orm/test_deprecations.py @@ -3017,7 +3017,7 @@ class NonPrimaryMapperTest(_fixtures.FixtureTest, AssertsCompiledSQL): with testing.expect_deprecated( "The mapper.non_primary parameter is deprecated" ): - mapper( + m = mapper( # noqa F841 User, users, non_primary=True,