[py-dev] execnet py.test teardown issue

Gordon Wrigley py-dev at tolomea.com
Wed Jul 15 11:05:28 CEST 2009


Hi Holger

I have produced a minimal reproduction for my one remaining issue.

To reproduce put the following into a file and run it with py.test

import py
a = None
def test_function():
    global a
    a = py.execnet.SshGateway("localhost").remote_exec("pass")

As before the problem only reproduces on my test machine not on my
development machine. On my test machine it produces:
Exception AttributeError: "'NoneType' object has no attribute
'CHANNEL_CLOSE'" in <bound method Channel.__del__ of <Channel id=1
open>> ignored

Additionally it only reproduces inside py.test.

Now that I know what it is it can be trivially fixed by del'ing the
global variable at the end of the test. I am however curious about the
difference in behavior on the two machines and I would also like to
know if you consider this a problem or if it is just that pushing a
channel into the global namespace is a bad idea. It is probably worth
noting that in the full system what I pushed into the global namespace
wasn't a channel but a utility class that happened to have a reference
to a channel, so it wasn't quite as braindead as it looks.

Gordon

> development machine:
>
> gordonw at gohma:~$ uname -a
> Linux gohma 2.6.28-13-generic #45-Ubuntu SMP Tue Jun 30 19:49:51 UTC
> 2009 i686 GNU/Linux
> gordonw at gohma:~$ python
> Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41)
> [GCC 4.3.3] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import py
>>>> py.version
> '1.0.0b7'

> test machine:
>
> lab at okum:~$ uname -a
> Linux okum 2.6.28-11-generic #42-Ubuntu SMP Fri Apr 17 01:57:59 UTC
> 2009 i686 GNU/Linux
> lab at okum:~$ python
> Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41)
> [GCC 4.3.3] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import py
>>>> py.version
> '1.0.0b1'



More information about the Pytest-dev mailing list