~ubuntu-branches/ubuntu/trusty/python-eventlet/trusty-proposed

« back to all changes in this revision

Viewing changes to tests/subprocess_test.py

  • Committer: Bazaar Package Importer
  • Author(s): Soren Hansen
  • Date: 2010-09-28 21:20:32 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20100928212032-c4n67olxdoqzygmt
Tags: 0.9.12-0ubuntu1
New upstream release. (FFe: LP: #645899)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import os
 
2
import sys
 
3
from tests.patcher_test import ProcessBase
 
4
from tests import skip_with_pyevent
 
5
from eventlet.green import subprocess
 
6
 
 
7
class Subprocess(ProcessBase):
 
8
    def test_longoutput(self):
 
9
        new_mod = """
 
10
import time
 
11
for i in xrange(2):
 
12
    print "*" * 10000,
 
13
    time.sleep(0.2)
 
14
"""
 
15
        modname = "newmod"
 
16
        filename = modname + ".py"
 
17
        self.write_to_tempfile(modname, new_mod)
 
18
        python_path = os.pathsep.join(sys.path + [self.tempdir])
 
19
        new_env = os.environ.copy()
 
20
        new_env['PYTHONPATH'] = python_path
 
21
        p = subprocess.Popen([sys.executable, 
 
22
                              os.path.join(self.tempdir, filename)],
 
23
                stdout=subprocess.PIPE, stderr=subprocess.STDOUT, env=new_env)
 
24
        output, _ = p.communicate()
 
25
        self.assertEqual(output, "*"*10000 + " " + "*"*10000 + "\n")