[Distutils] zope.testrunner behavior change

Barry Warsaw barry at python.org
Mon Aug 30 13:09:42 CEST 2010


I'm just back from a mini-vacation.  Before I left, I upgrade the Mailman 3
branch to use buildout 1.5, but I experienced a build failure [1] and a bunch
of test failures.  Gary fixed all the build problems (thanks!) and I think
released a new zope.testrunner package that got my branch back into working
state.

Mostly.  I had one test failure that was fairly easy to fix, but it pointed to
a change in zope.testrunner.  This may be a question better suited to the TIP
list, but well, I'll send it here as a follow up to my buildout issues. ;)

The diff should illustrate the behavior change in z.t that broke the test:

% bzr diff -c 6934
=== modified file 'src/mailman/app/docs/hooks.txt'
--- src/mailman/app/docs/hooks.txt	2010-01-12 13:27:38 +0000
+++ src/mailman/app/docs/hooks.txt	2010-08-30 01:00:26 +0000
@@ -51,7 +51,8 @@
     >>> def call():
     ...     proc = subprocess.Popen(
     ...         'bin/mailman lists --domain ignore -q'.split(),
-    ...         cwd='../..',  # testrunner runs from ./parts/test
+    ...         # testrunner runs from ./parts/test/working-directory
+    ...         cwd='../../..',
     ...         env=dict(MAILMAN_CONFIG_FILE=config_path,
     ...                  PYTHONPATH=config_directory),
     ...         stdout=subprocess.PIPE, stderr=subprocess.PIPE)


The test is trying to run a script that gets built into the bin directory of
the built-out tree.  I had to set cwd in order to find the bin directory.  I
probably could have used other landmarks to more dynamically find the bin
directory, but this seemed expedient... until z.t changed the cwd in the new
version.

So my question is: would it make sense to be able to ask zope.testrunner where
it's running from, so that I don't have to hard code cwd?  Better still would
be a function in z.t that I could call that would get me back to root
directory.  E.g. something like:

    ...         cwd=zope.testrunner.root_directory()

Thoughts?  It's not that big of a deal, but I don't like that my test relies
on undocumented zope.testrunner behavior.

Cheers,
-Barry

[1] https://bugs.edge.launchpad.net/zc.buildout/+bug/623590
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20100830/31ee34c0/attachment.pgp>


More information about the Distutils-SIG mailing list