From 1f3c573b8870c4753a00996222e784852b9d993f Mon Sep 17 00:00:00 2001 From: Avasam Date: Mon, 22 Jul 2024 17:05:43 -0400 Subject: [PATCH 1/4] remove lib2to3 --- adodbapi/test/setuptestframework.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/adodbapi/test/setuptestframework.py b/adodbapi/test/setuptestframework.py index 53dda825c..65b99e990 100644 --- a/adodbapi/test/setuptestframework.py +++ b/adodbapi/test/setuptestframework.py @@ -3,7 +3,6 @@ "setuptestframework.py v 2.6.0.8" import os import shutil -import sys import tempfile @@ -46,7 +45,7 @@ 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?" @@ -54,13 +53,6 @@ def makeadopackage(testfolder): 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.") From 26a1ec44c9ed0b539c22e7cf4e23d6cf79542e15 Mon Sep 17 00:00:00 2001 From: Avasam Date: Sat, 27 Jul 2024 04:12:48 -0400 Subject: [PATCH 2/4] Remove from doc --- adodbapi/quick_reference.md | 5 ++--- adodbapi/test/adodbapitestconfig.py | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/adodbapi/quick_reference.md b/adodbapi/quick_reference.md index 67ab2bfc8..3ee9867ba 100644 --- a/adodbapi/quick_reference.md +++ b/adodbapi/quick_reference.md @@ -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. diff --git a/adodbapi/test/adodbapitestconfig.py b/adodbapi/test/adodbapitestconfig.py index 9ff2521c0..25872f815 100644 --- a/adodbapi/test/adodbapitestconfig.py +++ b/adodbapi/test/adodbapitestconfig.py @@ -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 @@ -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 From 152ea1a7435116d4a34a50980cda1ffd4d9317cc Mon Sep 17 00:00:00 2001 From: Avasam Date: Mon, 29 Jul 2024 16:12:25 -0400 Subject: [PATCH 3/4] Remove redundant try-except --- adodbapi/test/adodbapitestconfig.py | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/adodbapi/test/adodbapitestconfig.py b/adodbapi/test/adodbapitestconfig.py index 25872f815..03fb9a23c 100644 --- a/adodbapi/test/adodbapitestconfig.py +++ b/adodbapi/test/adodbapitestconfig.py @@ -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 @@ -183,7 +176,7 @@ _password, _computername, _databasename, - **kws + **kws, ) assert ( From 58da6256a0fb85afc5871993d483a6a52dede208 Mon Sep 17 00:00:00 2001 From: Avasam Date: Mon, 29 Jul 2024 16:24:23 -0400 Subject: [PATCH 4/4] Test suite not for Python 2 --- adodbapi/quick_reference.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adodbapi/quick_reference.md b/adodbapi/quick_reference.md index 3ee9867ba..5a30dd7bf 100644 --- a/adodbapi/quick_reference.md +++ b/adodbapi/quick_reference.md @@ -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