[Zope-dev] [Checkins] SVN: z3c.recipe.compattest/trunk/src/z3c/recipe/compattest/runner.py Don't import site on initialization, as this mitigates the buildout 1.5 way of setting sys.path

Jan-Jaap Driessen jdriessen at thehealthagency.com
Mon Dec 13 16:09:15 EST 2010


Hi Michael,

On 12 December 2010 21:49, Jan-Jaap Driessen
<jdriessen at thehealthagency.com> wrote:
> Hi Michael,
>
> On 26 November 2010 08:37, Michael Howitz <mh at gocept.com> wrote:
>> Hi,
>>
>> currently the ZTK tests on the trunk do not run successfully in a virtualenv.
>>
>> The errors look like:
>>
>> atom:trunk mac$ bin/test-ztk
>> Running test-ztk-zope.securitypolicy
>> test-ztk-zope.securitypolicy failed with:
>> Traceback (most recent call last):
>>  File "/Users/mac/Documents/tmp/zopetoolkit/trunk/bin/test-ztk-zope.securitypolicy", line 35, in <module>
>>    import zope.testrunner
>>  File "/Users/mac/Documents/eggs/zope.securitypolicy-3.7.0-py2.5.egg/zope/__init__.py", line 1, in <module>
>>    __import__('pkg_resources').declare_namespace(__name__)
>>  File "/Users/mac/Documents/eggs/distribute-0.6.14-py2.5.egg/pkg_resources.py", line 17, in <module>
>>    from urlparse import urlparse, urlunparse
>> ImportError: No module named urlparse
>> ...
>>
>> When I revert the following change, only the test for zope.testing fails (and all zope.app-tests pass):
>>
>> Am 06.10.2010 um 08:40 schrieb Jan-Jaap Driessen:
>>> Log message for revision 117268:
>>>  Don't import site on initialization, as this mitigates the buildout 1.5 way of setting sys.path
>>>
>>> Changed:
>>>  U   z3c.recipe.compattest/trunk/src/z3c/recipe/compattest/runner.py
>>>
>>> -=-
>>> Modified: z3c.recipe.compattest/trunk/src/z3c/recipe/compattest/runner.py
>>> ===================================================================
>>> --- z3c.recipe.compattest/trunk/src/z3c/recipe/compattest/runner.py   2010-10-06 06:30:44 UTC (rev 117267)
>>> +++ z3c.recipe.compattest/trunk/src/z3c/recipe/compattest/runner.py   2010-10-06 06:40:43 UTC (rev 117268)
>>> @@ -31,7 +31,7 @@
>>>     def start(self):
>>>         self.start = time.time()
>>>         self.process = subprocess.Popen(
>>> -            [sys.executable, self.script, '--exit-with-status'] + self.args,
>>> +            [sys.executable, '-S', self.script, '--exit-with-status'] + self.args,
>>>             stdin=subprocess.PIPE,
>>>             stdout=subprocess.PIPE,
>>>             stderr=subprocess.STDOUT,
>>
>> But reverting this change does not help to get the tests of z3c.recipe.compattest itself running again. There are the same errors like before.
>>
>> Is it intensional that ZTK tests fail in virtualenv?
>> What needs be done to get the tests running again in virtualenv?
>
> It took a while for me to react to your email, my apologies. I
> remember now that I added the '-S' to z3c.recipe.compattest in order
> to make compattest run on windows machines. It was not my intention to
> break running from inside a virtualenv. I'll look into the issue some
> more this week.

It looks like this patch to z3c.recipe.compattest fixes the virtualenv issue:

http://pastie.org/1374124

With this patch I successfully ran the ZTK trunk tests on Windows and
OSX machines inside and outside a virtualenv.

If nobody objects, I'll release this as z3c.recipe.compattest 0.13.1.

-- 
Jan-Jaap Driessen


More information about the Zope-Dev mailing list