[PATCH 2 of 2] test-url: skip test when ssl module is unavailable

Augie Fackler durin42 at gmail.com
Tue Oct 12 17:57:46 CDT 2010


On Oct 12, 2010, at 2:05 PM, Gilles Moris wrote:

> On Tuesday 12 October 2010 09:49:04 pm Augie Fackler wrote:
>> test-url: skip test when ssl module is unavailable
>>
>> diff --git a/tests/test-url.py b/tests/test-url.py
>> --- a/tests/test-url.py
>> +++ b/tests/test-url.py
>> @@ -1,4 +1,9 @@
>>  #!/usr/bin/env python
>> +import sys
>> +try:
>> +    import ssl
>> +except ImportError:
>> +    sys.exit(80)
>
> With my py2.5, I have this error in test-url.py:
>
> ERROR: /home/morisgi/Documents/hg.crew/tests/test-url.py output  
> changed and
> returned error code 1
> --- /home/morisgi/Documents/hg.crew/tests/test-url.py.out
> +++ /home/morisgi/Documents/hg.crew/tests/test-url.py.err
> @@ -1,0 +1,6 @@
> +Traceback (most recent call last):
> +  File "/home/morisgi/Documents/hg.crew/tests/test-url.py", line  
> 38, in
> <module>
> +    'example.com'),
> +  File "/tmp/hgtests.RgXoC3/install/lib/python/mercurial/url.py",  
> line 498,
> in _verifycert
> +    if notafter and time.time() > ssl.cert_time_to_seconds(notafter):
> +NameError: global name 'ssl' is not defined
>
>
> Is this error you mention ?
> Does this mean that url._verifycert() cannot be called for py < 2.6 ?
> Is that the reason why this test failure is eluded ?

Yeah. Presumably url._verifycert() needs some fallback path (I guess  
we can't do any checking in that case? :/) if the ssl module isn't  
available (which it might be on old Pythons via the backport on PyPI.)

Mads, can you do that or should someone else plan to look at it?

>
> Regards.
> Gilles.



More information about the Mercurial-devel mailing list