Skip to content
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

Remove lib2to3 #2311

Merged
merged 4 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions adodbapi/quick_reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,7 @@ Running the tests
The test folder contains a set of unittest programs. Setting them up can
be a bit complex, because you need several database servers to do a
complete test, and each one has a different configuration. Scripts in
this folder try to work in Python 2.7 or Python 3.5(+)
this folder try to work in Python 3.7(+)

- dbapi20.py

Expand Down Expand Up @@ -846,9 +846,8 @@ the database servers are distant, this can take a while.
It does some lightweight command line processing (actually the config
does it).

"\--package" tries to build a proper Python package in a temporary
location and adds it to sys.path so it can import a test version of the
code. It will run 2to3 when it does this, if needed.
"\--package" tries to build a proper Python package in a temporary location
and adds it to sys.path so it can import a test version of the code.

"\--all" run as many of the 12 passes as possible.

Expand Down
21 changes: 7 additions & 14 deletions adodbapi/test/adodbapitestconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
if "--help" in sys.argv:
print(
"""Valid command-line switches are:
--package - create a temporary test package, run 2to3 if needed.
--package - create a temporary test package
--all - run all possible tests
--time - do time format test
--nojet - do not test against an ACCESS database file
Expand All @@ -56,7 +56,7 @@
testfolder = setuptestframework.maketemp()

if "--package" in sys.argv:
# create a new adodbapi module -- running 2to3 if needed.
# create a new adodbapi module
pth = setuptestframework.makeadopackage(testfolder)
else:
# use the adodbapi module in which this file appears
Expand All @@ -67,17 +67,10 @@

# function to clean up the temporary folder -- calling program must run this function before exit.
cleanup = setuptestframework.getcleanupfunction()
try:
import adodbapi # will (hopefully) be imported using the "pth" discovered above
except SyntaxError:
print(
'\n* * * Are you trying to run Python2 code using Python3? Re-run this test using the "--package" switch.'
)
sys.exit(11)
try:
print(adodbapi.version) # show version
except:
print('"adodbapi.version" not present or not working.')

import adodbapi # will (hopefully) be imported using the "pth" discovered above

print(adodbapi.version) # show version
print(__doc__)

verbose = False
Expand Down Expand Up @@ -183,7 +176,7 @@
_password,
_computername,
_databasename,
**kws
**kws,
)

assert (
Expand Down
10 changes: 1 addition & 9 deletions adodbapi/test/setuptestframework.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"setuptestframework.py v 2.6.0.8"
import os
import shutil
import sys
import tempfile


Expand Down Expand Up @@ -46,21 +45,14 @@ def makeadopackage(testfolder):
if os.path.exists(adoName):
newpackage = os.path.join(testfolder, "adodbapi")
try:
os.mkdir(newpackage)
os.makedirs(newpackage)
except OSError:
print(
"*Note: temporary adodbapi package already exists: may be two versions running?"
)
for f in os.listdir(adoPath):
if f.endswith(".py"):
shutil.copy(os.path.join(adoPath, f), newpackage)
if sys.version_info >= (3, 0): # only when running Py3.n
save = sys.stdout
sys.stdout = None
from lib2to3.main import main # use 2to3 to make test package

main("lib2to3.fixes", args=["-n", "-w", newpackage])
sys.stdout = save
return testfolder
else:
raise OSError("Connot find source of adodbapi to test.")
Expand Down
Loading