FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-100414: Skip test_dbm_sqlite3 if sqlite3 is unavailable by erlend-aasland · Pull Request #115448 · python/cpython · GitHub

/ cpython Public

gh-100414: Skip test_dbm_sqlite3 if sqlite3 is unavailable - #115448

Closed
erlend-aasland wants to merge 1 commit into
python:mainfrom
erlend-aasland:dbm/fix-sqlite3-backend
Closed

gh-100414: Skip test_dbm_sqlite3 if sqlite3 is unavailable#115448
erlend-aasland wants to merge 1 commit into
python:mainfrom
erlend-aasland:dbm/fix-sqlite3-backend

Conversation

erlend-aasland commented Feb 14, 2024
edited by bedevere-app Bot
Loading

Copy link
Copy Markdown
Contributor

This comment was marked as outdated.

This comment was marked as outdated.

This comment was marked as outdated.

This comment was marked as outdated.

AlexWaygood left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM, assuming it fixes the buildbots

Copy link
Copy Markdown
Contributor Author

LGTM, assuming it fixes the buildbots

We can also do this:

diff --git a/Lib/test/test_dbm_sqlite3.py b/Lib/test/test_dbm_sqlite3.py
index 0eda8da4ab..7136b54016 100644
--- a/Lib/test/test_dbm_sqlite3.py
+++ b/Lib/test/test_dbm_sqlite3.py
@@ -6,9 +6,8 @@
 from pathlib import Path
 from test.support import cpython_only, import_helper, os_helper
 
-
-sqlite3 = import_helper.import_module("sqlite3")
 dbm_sqlite3 = import_helper.import_module("dbm.sqlite3")
+import sqlite3
 from dbm.sqlite3 import _normalize_uri
 

Copy link
Copy Markdown
Member

LGTM, assuming it fixes the buildbots

We can also do this:

diff --git a/Lib/test/test_dbm_sqlite3.py b/Lib/test/test_dbm_sqlite3.py
index 0eda8da4ab..7136b54016 100644
--- a/Lib/test/test_dbm_sqlite3.py
+++ b/Lib/test/test_dbm_sqlite3.py
@@ -6,9 +6,8 @@
 from pathlib import Path
 from test.support import cpython_only, import_helper, os_helper
 
-
-sqlite3 = import_helper.import_module("sqlite3")
 dbm_sqlite3 = import_helper.import_module("dbm.sqlite3")
+import sqlite3
 from dbm.sqlite3 import _normalize_uri
 

Not much difference between the two :)

The advantage of #115449 is that the test will fail if dbm.sqlite3 is available but sqlite3 is unavailable. That would be pretty weird, but also seems very unlikely to actually happen. The advantage of this PR is that the test will continue to pass no matter which order the imports are in, which is more robust against the test file potentially being refactored in the future.

As I say, very marginal, but I'd probably go for this one!

Copy link
Copy Markdown
Contributor Author

The advantage of #115449 is that the test will fail if dbm.sqlite3 is available but sqlite3 is unavailable.

Well, that should never be allowed to happen, which is why I prefer that PR :)

Copy link
Copy Markdown
Contributor Author

Closed in favour of #115449.

erlend-aasland deleted the dbm/fix-sqlite3-backend branch February 14, 2024 12:28
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting merge skip news tests Tests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL