Opened 8 years ago

Closed 8 years ago

#3900 defect closed duplicate (duplicate)

Deprecation warnings in Python 2.6 when importing test_process

Reported by: Jonathan Lange Owned by:
Priority: normal Milestone: Python-2.6
Component: core Keywords:
Cc: Thijs Triemstra, khorn Branch:
Author:

Description

Python 2.6 rasies a deprecation warning when importing twisted.test.test_process. This happens pretty much every time I run any subset of tests in Twisted.

/home/jml/src/twisted/trunk/twisted/test/test_process.py:10: DeprecationWarning: The popen2 module is deprecated.  Use the subprocess module.

Attachments (1)

test-process-warning.patch (1.9 KB) - added by kelly 8 years ago.
Door number three. Calls an inline python script that writes a fixed value to stderr.

Download all attachments as: .zip

Change History (8)

comment:1 Changed 8 years ago by Jonathan Lange

Status: newassigned

If you are running the tests on a POSIX platform that supports IReactorProcess, then popen2 is used to assign the global lsOut variable.

# do this before running the tests: it uses SIGCHLD and stuff internally
lsOut = popen2.popen3("/bin/ls ZZXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")[2].read()

This variable is used only in PosixProcessTestCase.testStderr.

I gather the purpose of the test is to confirm that the process protocol gets the same information on stderr as is got by using a Python standard library module, thus demonstrating that stderr handling is correct.

To fix the bug, we could change the module to use subprocess, falling back to popen2 when subprocess is unavailable.

We could instead tweak the test so that it doesn't need to use a stdlib process function at all. Instead, testStderr could run a process that is known to print a certain value to stderr, and then check that value. It would be simple to write such a process.

comment:2 Changed 8 years ago by Jean-Paul Calderone

I like the last option proposed (and have thought about implementing it before, but obviously never gotten around to it).

comment:3 Changed 8 years ago by Thijs Triemstra

Cc: Thijs Triemstra added
Milestone: Python-2.6

Changed 8 years ago by kelly

Attachment: test-process-warning.patch added

Door number three. Calls an inline python script that writes a fixed value to stderr.

comment:4 in reply to:  3 Changed 8 years ago by kelly

Keywords: review added

Replying to thijs:

comment:5 Changed 8 years ago by khorn

Cc: khorn added

this is a duplicate of #3431

comment:6 Changed 8 years ago by Thijs Triemstra

Keywords: review removed
Resolution: duplicate
Status: assignedclosed

Thanks for the patch kelly, and good spot khorn, this seems to be a duplicate. Kelly, can you attach your patch to #3431 and put that ticket on review? Thanks.

comment:7 Changed 7 years ago by <automation>

Owner: Jonathan Lange deleted
Note: See TracTickets for help on using tickets.