GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Make 3.10 sqlite3 tests run · Issue #94998 · python/cpython

Make 3.10 sqlite3 tests run #94998

New issue
Copy link
New issue
Copy link
Closed
Closed
Make 3.10 sqlite3 tests run#94998
Copy link
Assignees
erlend-aasland
Labels
3.10 (EOL)end of lifeend of lifetopic-sqlite3type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@terryjreedy
terryjreedy
opened on Jul 19, 2022
Issue body actions

On my Windows 10, after fresh repository update and debug build, 3.10 sqlite3 tests do not run.
(3.11 and 3.12 are fine.) In 3.10, test_sqlite/ only contains test_dbapi.py

python -m test test_sqlite3 is OK after no tests run. (I though we made this an error.)
python -m test.test_sqlite3 fails because test_sqlite3/ is missing __main__.py, as well as __init__.py

In 3.11, test_sqlite3.__main__.py is

from test.test_sqlite3 import load_tests  # Needed for the "load tests" protocol.
import unittest

if __name__ == "__main__":
    unittest.main()

The comment seems not needed. The other 3.10 test.test_x directories all run and have variations of this. Some have from . import load_tests. Some have unittest.main('test.test_x') instead of a load_tests import. Most omit the redundant if-clause.

After adding __main__.py, tests still do not run because __init__.py is needed. I may try to do a PR tomorrow.

Activity

  1. terryjreedy
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    3.10 (EOL)end of lifeend of life
    topic-sqlite3
    on Jul 19, 2022
  2. erlend-aasland
    self-assigned this
    on Jul 19, 2022
  3. terryjreedy commented on Jul 19, 2022

    @terryjreedy
    terryjreedy
    on Jul 19, 2022
    MemberAuthor
    More actions

    I copied 3.11 test_sqlite3/__init__.py into the 3.10 directory.
    With python -m test -v test_sqlite3, the loader runs but fails on line 47
    def cx_limit(cx, category=sqlite.SQLITE_LIMIT_SQL_LENGTH, limit=128):
    with an attribute error for SQLITE_LIMIT_SQL_LENGTH.

    With the function commented out, python crashes with Windows fatal exception: access violation in test_connection_bad_reinit at line 572 , self.assertRaisesRegex(...) line 572. Before that, multiple tests failed, far more than need the commented out function.

    (Reminder to self: changes on branch sql310.)

  4. terryjreedy
    added a commit that references this issue on Jul 19, 2022

    pythongh-94998: Make 3.10 sqlite3 tests run

    b42b4ee
  5. erlend-aasland commented on Jul 19, 2022

    @erlend-aasland
    erlend-aasland
    on Jul 19, 2022
    Contributor
    More actions

    On my Windows 10, after fresh repository update and debug build, 3.10 sqlite3 tests do not run. (3.11 and 3.12 are fine.) In 3.10, test_sqlite/ only contains test_dbapi.py

    There is no Lib/test/test_sqlite/ directory in the 3.10 branch. However, due to a backport failure (2229d34), there is a partial Lib/test/test_sqlite3/ directory. This needs to be removed from the 3.10 branch; the sqlite3 tests are found in Lib/sqlite3/test/ for the 3.10 branch and older.

    In 3.11, test_sqlite3.__main__.py is [...]

    The comment seems not needed.

    It was added by Brett's request. I'd like to keep it there, as it explains the otherwise apparently unused import.

    Most omit the redundant if-clause.

    Tests can be run directly (./<test-path> on *nix) or via ./python -m test <test-name>, so please leave it as it is; it is needed.

  6. erlend-aasland commented on Jul 19, 2022

    @erlend-aasland
    erlend-aasland
    on Jul 19, 2022
    Contributor
    More actions

    FTR, sqlite3 tests run as they should in 3.10:

    $ ./python.exe -m test test_sqlite -v | wc -l 
         369
  7. erlend-aasland
    added a commit that references this issue on Jul 19, 2022

    [3.10] pythongh-94998: Remove incorrectly backported Lib/test/test_sq…

    d2363a2
  8. erlend-aasland commented on Jul 19, 2022

    @erlend-aasland
    erlend-aasland
    on Jul 19, 2022
    Contributor
    More actions

    Sorry, this may not be obvious, but the sqlite3 tests were moved in 3.11. For 3.10 and older, they all lived in Lib/sqlite3/test, and were invoked via Lib/test/test_sqlite.py (for example, python -m test test_sqlite). For 3.11, they live in Lib/test/test_sqlite3/, and they are now invoked using the correct module name (python -m test test_sqlite3).

    Perhaps we should add an entry to the 3.11 What's New.

  9. erlend-aasland
    added a commit that references this issue on Jul 19, 2022

    [3.10] gh-94998: Remove incorrectly backported Lib/test/test_sqlite3 …

    374afb4
  10. erlend-aasland
    closed this as completedon Jul 19, 2022
  11. erlend-aasland commented on Jul 19, 2022

    @erlend-aasland
    erlend-aasland
    on Jul 19, 2022
    Contributor
    More actions

    Fixed with gh-95016; thanks for the report!

  12. terryjreedy commented on Jul 19, 2022

    @terryjreedy
    terryjreedy
    on Jul 19, 2022
    MemberAuthor
    More actions

    I wondered whether deleting test_sqlite3/ might be a reasonable alternative. But was not aware that it was a partial duplicate.

    The purpose of conditionalizing unittest.main() in x.py is to not call it when x is imported. But main.py is normally only run with __name__ '__main__', when the call is wanted. python -m test test_xyz' only *imports* test_xyz and when it is a directory, only runs its init, not main. This is why the current omission in most such 3.10 main`s is not a problem. (But I have no intention of changing anything.)

    I think all the test directory movements should be mentioned in the corresponding What's New.

    Reacted by Erlend E. Aasland
  13. erlend-aasland commented on Jul 19, 2022

    @erlend-aasland
    erlend-aasland
    on Jul 19, 2022
    Contributor
    More actions

    Yeah, I think you're right about the __main__ conditional; it is redundant.

  14. erlend-aasland
    added 2 commits that reference this issue on Jul 20, 2022

    pythongh-94998: Remove redundant condition in test_sqlite3/__main__.py

    60859df

    gh-94998: Remove redundant condition in test_sqlite3/__main__.py (#95052

    9d09e7b
  15. miss-islington
    added 2 commits that reference this issue on Jul 20, 2022

    pythongh-94998: Remove redundant condition in test_sqlite3/__main__.py (

    73b5a9e

    gh-94998: Remove redundant condition in test_sqlite3/__main__.py (GH-…

    2ac1096
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @erlend-aasland
    erlend-aasland

Labels

3.10 (EOL)end of lifeend of lifetopic-sqlite3type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.