[ZCM] [ZC] 489/ 5 Reject "INSTANCE_HOME support for testrunner.py"
Collector: Zope Bugs, Features,
and Patches ...
zope-coders-admin at zope.org
Fri May 28 08:34:02 EDT 2004
Issue #489 Update (Reject) "INSTANCE_HOME support for testrunner.py"
Status Rejected, Zope/feature+solution medium
To followup, visit:
http://collector.zope.org/Zope/489
==============================================================
= Reject - Entry #5 by ajung on May 28, 2004 8:34 am
Status: Pending => Rejected
testrunner.py has been removed in Zope 2.7.1....so this issue is out-of-date.
________________________________________
= Comment - Entry #4 by ShaneH on May 28, 2003 12:46 pm
It is not necessary for testrunner to be aware of INSTANCE_HOME. The only reason Testing/__init__.py sets INSTANCE_HOME is to force Zope to use Testing/custom_zodb.py instead of the normal database. Instead of patching testrunner, we should make the Testing package select the special database through some mechanism other than setting INSTANCE_HOME.
So let's change Testing/__init__.py and the Zope package instead of testrunner.
________________________________________
= Comment - Entry #3 by shh on May 23, 2003 4:46 am
There has recently been some interest on zope-dev for having INSTANCE_HOME support in testrunner.py by Zope 2.6.2.
The lack of INSTANCE_HOME support in the stock testrunner has been previously noted, e.g. here: <http://www.zope.org/Wikis/DevSite/Proposals/CleanUpAndUnifyCoreUnitTests>
The current implementation is based on the Zope 2.5.1 testrunner: <http://www.zope.org/Members/shh/TestRunner>
The testrunners of 2.5.1 and Zope-2_6-branch mainly differ in the addition of remove_stale_bytecode(). See the snippet below:
def remove_stale_bytecode(arg, dirname, names):
names = map(os.path.normcase, names)
for name in names:
if name.endswith(".pyc") or name.endswith(".pyo"):
srcname = name[:-1]
if srcname not in names:
fullname = os.path.join(dirname, name)
print "Removing stale bytecode file", fullname
os.unlink(fullname)
os.path.walk(os.curdir, remove_stale_bytecode, None)
- In light of INSTANCE_HOME support the testrunner can no longer expect to be run from ZOPE_HOME.
- When not testing Zope core, it is unlikely that os.curdir is a good starting point. In fact, *any* directory may be the current directory. Running remove_stale_bytecode() on both ZOPE_HOME and INSTANCE_HOME may be a way to address this.
- Note that instances often contain symbolic links (typically Products linked from a CVS sandbox) and os.path.walk() does not follow these links. This could be solved by documentation but weakens the "automagic" quality of the feature.
- The testrunner from the CVS trunk has seen some work that has not been backported to Zope-2_6-branch. It might make sense to start from there.
That said, I am volunteering to write the code but would appreciate a comment by ZC wrt to the above issues and the general direction of the testrunner utility. Thanks.
________________________________________
= Comment - Entry #2 by shh on Jul 26, 2002 1:58 pm
Please use the second URL displayed below. The first one only *looks* like it was working; it doesn't.
I guess I need to file a collector bug as well :-)
________________________________________
= Request - Entry #1 by shh on Jul 26, 2002 1:52 pm
I have implemented INSTANCE_HOME support for the Zope 2.5.1 testrunner. Find it here: <a href="http://www.zope.org/Members/shh/TestRunner">http://www.zope.org/Members/shh/TestRunner</a>
My modifications rid the testrunner from its "Zope core only" and "must be run from Zope root" limitations.
Note that Zope 2.6 adds some code to testrunner.py that removes stale bytecode before running tests. I propose this feature be moved to a separate utility because it (IMHO) has no business in a general purpose testrunner and conflicts with my intention to make the testrunner "run everything everywhere". Thanks.
Stefan
==============================================================
More information about the Zope-Collector-Monitor
mailing list