Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

erlend-aasland
Copy link
Contributor

@erlend-aasland erlend-aasland commented Feb 14, 2024

@erlend-aasland

This comment was marked as outdated.

@bedevere-bot

This comment was marked as outdated.

@erlend-aasland

This comment was marked as outdated.

@bedevere-bot

This comment was marked as outdated.

Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

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

LGTM, assuming it fixes the buildbots

@erlend-aasland
Copy link
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
 

@AlexWaygood
Copy link
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!

@erlend-aasland
Copy link
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 :)

@erlend-aasland
Copy link
Contributor Author

Closed in favour of #115449.

@erlend-aasland erlend-aasland deleted the dbm/fix-sqlite3-backend branch February 14, 2024 12:28
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