[vtk-developers] Update: Making Tests Python 3/2 compatible.

David Gobbi david.gobbi at gmail.com
Tue Aug 11 09:40:43 EDT 2015


Hi Andrew,

I've looked at TestTemplates.py, and it is going to require that I give it
some special attention in order for it to provide the same coverage under
Python 3 as it provides with Python 2.

For proper coverage, that test needs a string that cannot be expressed in
ASCII, so I'll just build such a string at the top of the program:

    # create a unicode string for python 2 and python 3
    if sys.hexversion >= 0x03000000:
        francois = 'Fran\xe7ois'
    else:
        francois = unicode('Fran\xe7ois', 'latin1')

On Python 3.2, only TestTemplates and the Tk tests failed.  I'll fix the
former and take a look at the latter.

Also, if you don't mind, I'd like to cherry-pick your commit onto my
python-py3k branch and submit as a new merge request.  That will allow us
to keep all the Python 3 commits as a contiguous set.

 - David


On Tue, Aug 11, 2015 at 6:19 AM, Andrew Maclean <andrew.amaclean at gmail.com>
wrote:

> Hi All,
>    Git and I had an argument about rebasing ... I lost the argument. [git
> +1, Andrew -1]
>
> Consequently I have had to create a new merge request:
> https://gitlab.kitware.com/vtk/vtk/merge_requests/518
>
> I have picked up all of David's comments from the old merge request and
> the results (on my machine) are:
> 99% tests passed, 4 tests failed out of 489
>
> Total Test time (real) = 990.25 sec
>
> The following tests FAILED:
>         1935 - vtkRenderingTkPython-cursor3D (Failed)
>         1936 - vtkRenderingTkPython-TestTextActor3D (Failed)
>         1937 - vtkRenderingTkPython-TestTkRenderWidget (Failed)
>         1938 - vtkRenderingTkPython-TestTkRenderWindowInteractor (Failed)
> Errors while running CTest
>
> If no one objects, would like to defer these fails to a later merge
> request.
>
> David, I have a question about Python 3.2:
> In reading the documentation, this version of python accepted strings like
> unicode('The Zen of VTK') but not u'The Zen of VTK' which is accepted in
> Python 2.7/3.3+.
>
> Is it safe to use:
> from __future__ import unicode_literals
>
> and will Python 3.2 then accept statements like:
> zen =  u'The Zen of VTK'
>
> Can someone test this on Python 3.2, it works on Python 3.4 and Python 2.7.
>
> If it doesn't work, are there any alternatives?
>
>
> Regards
>     Andrew
>
>
>
>
>
>
> On Tue, Aug 11, 2015 at 5:53 AM, David Gobbi <david.gobbi at gmail.com>
> wrote:
>
>> On Mon, Aug 10, 2015 at 3:00 AM, Andrew Maclean <
>> andrew.amaclean at gmail.com> wrote:
>>
>>>
>>>         655 - vtkFiltersGeneralPython-TestMultiBlockStreamer (Failed)
>>>         676 - vtkFiltersGeneralPython-splitVectors (Failed)
>>>         677 - vtkFiltersGeneralPython-streamTracer (Failed)
>>>         1263 - vtkIONetCDFPython-NetCDFCF2DBounds (Failed)
>>>         1264 - vtkIONetCDFPython-NetCDFCFSetOutputType (Failed)
>>>         1265 - vtkIONetCDFPython-NetCDFCFSphericalCoords (Failed)
>>>         1266 - vtkIONetCDFPython-NetCDFCFUnstructured (Failed)
>>>         1267 - vtkIONetCDFPython-NetCDFReader (Failed)
>>>
>>
>> For the above tests, it looks like the failure was due to a typo in my
>> wrapper code.
>> I mistyped PY_VERSION_HEX in two locations.  After I've merged this fix,
>> you can
>> rebase.
>>
>>  - David
>>
>>
>
>
>
> --
> ___________________________________________
> Andrew J. P. Maclean
>
> ___________________________________________
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20150811/b571b469/attachment-0001.html>


More information about the vtk-developers mailing list