zope-testrunner -j99 fails when run from tox #6

Closed
mgedmin opened this Issue May 29, 2013 · 4 comments

Comments

Projects
None yet
1 participant
Owner

mgedmin commented May 29, 2013

ZEO has a test suite with multiple layers. The tests are hooked up with bin/test and with tox. Both use zope.testrunner. bin/test -j99 works great, but if you configure tox to run zope-testrunner -j99, you get a bunch of errors like this:

**********************************************************************
Could not communicate with subprocess!
Child stderr was:
      /full/path/to/.tox/py27/bin/python: can't open file '.tox/py27/bin/zope-testrunner': [Errno 2] No such file or directory
**********************************************************************
Owner

mgedmin commented May 29, 2013

strace tells me that bin/test -j99 does

execve(absolute_path_to_python, [absolute_path_to_python, absolute_path_to_script, ...])

while .tox/py27/bin/zope-testrunner -j99

execve(absolute_path_to_python, [absolute_path_to_python, relative_path_to_script, ...])

I see that zc.recipe.testrunner modifies bin/test and adds

sys.argv[0] = os.path.abspath(sys.argv[0])

@mgedmin mgedmin added a commit that referenced this issue May 29, 2013

@mgedmin mgedmin Fix subprocess execution when tests change the working directory
Fixes issue #6.

Note that most people use zope.testrunner via zc.buildout and
zc.recipe.testrunner.  That recipe changes the wrapper script to do two
things:

  sys.argv[0] = os.path.abspath(sys.argv[0])
  os.chdir('/top/of/the/source/tree')

which are exactly what is needed to make test runner subprocesses work
correctly.

Now the standalone zope-testrunner script (what you get when you pip
install zope.testrunner) will do that by itself, and people who use tox
or travis-ci will not be sad.

Note: this change needs unit tests -- I only tested it manually.
d26f86f
Owner

mgedmin commented May 29, 2013

This is fixed in my fix-issue-6 branch. The fixes could use some unit tests.

@mgedmin mgedmin added a commit to zopefoundation/ZODB that referenced this issue May 29, 2013

@mgedmin mgedmin Don't use zope-testrunner -j99 from tox or travis
That doesn't work, just causes all but one of the functional test layers
to be silently skipped (thanks to zopefoundation/zope.testrunner#5 and
zopefoundation/zope.testrunner#6).
58b0554

@mgedmin mgedmin added a commit that referenced this issue Jun 4, 2013

@mgedmin mgedmin Add regression test for issue #6 3709e07

mgedmin closed this Jun 4, 2013

Owner

mgedmin commented Jun 4, 2013

Fixed in master (with automated tests).

Owner

mgedmin commented Jun 6, 2013

Fixed in zope.testrunner 4.4.0.

@mgedmin mgedmin added a commit that referenced this issue Jan 14, 2015

@mgedmin mgedmin Restore support for instance-based layers
Commit 3a68ee9 improved layer sorting
but accidentally dropped support for instance-based layers.  These turn
out to be rather widely used (in ZODB, in zope.app.testing, in
plone.testing etc).

This change fixes the above problem in a different way from PR #6: it
replacing inspect.getmro(layer) with a recursive sort key computation
that traverses layer.__bases__.

It doesn't actually use the C3 algorithm for MRO computation.  I tried
to find an example where that would matter and couldn't.

This commit also adds tests to prevent this from regressing in the future.
2cb3f1c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment