I'm afraid this shows carelessness on my part.
In adodbapi\tests\adodbapitestconfig.py you will find the lines...
doAllTests = True
doAccessTest = True or doAllTests
doSqlServerTest = False or doAllTests
doMySqlTest = False or doAllTests
doPostgresTest = False or doAllTests
Obviously, I run the test module with doAllTests set to True, and I have edited
the connection string for the SQL server several times as my test configuration
changes. At the present moment, it is set to attach to an SQLexpress instance on
my laptop. But it's a bit of a mess . MySQL and PostgreSQL are tested against
a very old Linux box which I have parked on a consumer cable Internet connection
which will sometimes actually work from a remote location. If they work at all
they are pretty slow. Also the test is run twice (three times if mxdatetime is
installed) to test both (or all three) time converters.
I intended to set doAllTests to False before publishing, in which case it will
run only the Jet database connector, for which it will happily build its own
test database if needed, using code lifted from the odbc module test suite.
That runs quickly and reliably. I shall post the correction shortly, after which
testing adodbapi should not require special case handling.
--
Vernon
From: Mark Hammond <mha...@us...>
To: pyw...@li...
Sent: Fri, February 25, 2011 7:24:31 PM
Subject: [pywin32-checkins] pywin32 pywin32_testall.py, NONE, 1.1 setup.py,
1.120, 1.121 MANIFEST.in, 1.21, 1.22
Update of /cvsroot/pywin32/pywin32
In directory vz-cvs-2.sog:/tmp/cvs-serv20404
Modified Files:
setup.py MANIFEST.in
Added Files:
pywin32_testall.py
Log Message:
add pywin32 test runner for all automated tests
Index: setup.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/setup.py,v
retrieving revision 1.120
retrieving revision 1.121
diff -C2 -d -r1.120 -r1.121
*** setup.py 26 Feb 2011 00:24:53 -0000 1.120
--- setup.py 26 Feb 2011 02:24:28 -0000 1.121
***************
*** 2188,2192 ****
},
! scripts = ["pywin32_postinstall.py"],
ext_modules = ext_modules,
--- 2188,2192 ----
},
! scripts = ["pywin32_postinstall.py", "pywin32_testall.py"],
ext_modules = ext_modules,
Index: MANIFEST.in
===================================================================
RCS file: /cvsroot/pywin32/pywin32/MANIFEST.in,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** MANIFEST.in 26 Feb 2011 00:24:53 -0000 1.21
--- MANIFEST.in 26 Feb 2011 02:24:28 -0000 1.22
***************
*** 9,12 ****
--- 9,13 ----
include setup3.py
include pywin32_postinstall.py
+ include pywin32_testall.py
# don't know how to include "Python and Extensions.dsw" - spaces upset things
# Core win32 stuff
--- NEW FILE: pywin32_testall.py ---
"""A test runner for pywin32"""
import sys
import os
import distutils.sysconfig
import win32api
# locate the dirs based on where this script is - it may be either in the
# source tree, or in an installed Python 'Scripts' tree.
this_dir = os.path.dirname(__file__)
site_packages = distutils.sysconfig.get_python_lib(plat_specific=1)
if hasattr(os, 'popen3'):
def run_test(script, cmdline_rest=""):
dirname, scriptname = os.path.split(script)
# some tests prefer to be run from their directory.
cwd = os.getcwd()
os.chdir(dirname)
try:
executable = win32api.GetShortPathName(sys.executable)
cmd = '%s "%s" %s' % (sys.executable, scriptname, cmdline_rest)
print script
stdin, stdout, stderr = os.popen3(cmd)
stdin.close()
while 1:
char = stderr.read(1)
if not char:
break
sys.stdout.write(char)
for line in stdout.readlines():
print line
stdout.close()
result = stderr.close()
if result is not None:
print "****** %s failed: %s" % (script, result)
finally:
os.chdir(cwd)
else:
# a subprocess version - but we prefer the popen one if we can as we can
# see test results as they are run (whereas this one waits until the test
# is finished...)
import subprocess
def run_test(script, cmdline_rest=""):
dirname, scriptname = os.path.split(script)
# some tests prefer to be run from their directory.
cmd = [sys.executable, "-u", scriptname] + cmdline_rest.split()
print script
popen = subprocess.Popen(cmd, shell=True, cwd=dirname,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
data = popen.communicate()[0]
sys.stdout.buffer.write(data)
if popen.returncode:
print "****** %s failed: %s" % (script, popen.returncode)
def find_and_run(possible_locations, script, cmdline_rest=""):
for maybe in possible_locations:
if os.path.isfile(os.path.join(maybe, script)):
run_test(os.path.abspath(os.path.join(maybe, script)), cmdline_rest)
break
else:
raise RuntimeError("Failed to locate the test script '%s' in one of %s"
% (script, possible_locations))
if __name__=='__main__':
# win32
maybes = [os.path.join(this_dir, "win32", "test"),
os.path.join(site_packages, "win32", "test"),
]
find_and_run(maybes, 'testall.py')
# win32com
maybes = [os.path.join(this_dir, "com", "win32com", "test"),
os.path.join(site_packages, "win32com", "test"),
]
find_and_run(maybes, 'testall.py', "2")
# adodbapi
maybes = [os.path.join(this_dir, "adodbapi", "tests"),
os.path.join(site_packages, "adodbapi", "tests"),
]
find_and_run(maybes, 'adodbapitest.py')
# This script has a hard-coded sql server name in it, (and markh typically
# doesn't have a different server to test on) so don't bother trying to
# run it...
# find_and_run(maybes, 'test_adodbapi_dbapi20.py')
if sys.version_info > (3,):
print "** The tests have some issues on py3k - not all failures are a
problem..."
------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in
Real-Time with Splunk. Collect, index and harness all the fast moving IT data
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business
insights. http://p.sf.net/sfu/splunk-dev2dev
_______________________________________________
pywin32-checkins mailing list
pyw...@li...
https://lists.sourceforge.net/lists/listinfo/pywin32-checkins
|