Changeset 1146e21 for protocols/skype


Ignore:
Timestamp:
2013-02-11T12:56:03Z (11 years ago)
Author:
Miklos Vajna <vmiklos@…>
Branches:
master
Children:
ee3bccd
Parents:
65a5d15
git-author:
Mike Kazantsev <mk.fraggod@…> (11-02-13 12:56:03)
git-committer:
Miklos Vajna <vmiklos@…> (11-02-13 12:56:03)
Message:

skype.test: do proper cleanup of skyped process despite possible exceptions, keep pexpect.log

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/skype/test.py

    r65a5d15 r1146e21  
    1818                        proc.communicate()
    1919        def mock(self, name):
    20                 skyped_log = open("t/skyped.log", "w")
    21                 skyped = subprocess.Popen([sys.executable, "skyped.py", "-c", "t/skyped/skyped.conf", "-n", "-d", "-m", "t/%s-skyped.mock" % name],
     20                with open("t/skyped.log", "w") as skyped_log,\
     21                                open("t/pexpect.log", "w") as pexpect_log:
     22                        skyped = subprocess.Popen([sys.executable, "skyped.py",
     23                                "-c", "t/skyped/skyped.conf", "-n", "-d", "-m", "t/%s-skyped.mock" % name],
    2224                                stdout=skyped_log, stderr=subprocess.STDOUT)
    23 
    24                 try:
    25                         bitlbee = pexpect.spawn('../../bitlbee', ['-d', 't/bitlbee'])
    26                         bitlbee_mock = open("t/%s-bitlbee.mock" % name)
    27                         for i in bitlbee_mock.readlines():
    28                                 line = i.strip()
    29                                 if line.startswith(">> "):
    30                                         bitlbee.expect_exact(line[3:], timeout=10)
    31                                 elif line.startswith("<< "):
    32                                         bitlbee.sendline(line[3:])
    33                         bitlbee_mock.close()
    34                         bitlbee.close()
    35                 finally:
    36                         skyped.terminate()
    37                         skyped.communicate()
    38                         skyped_log.close()
     25                        try:
     26                                bitlbee = pexpect.spawn('../../bitlbee', ['-d', 't/bitlbee'], logfile=pexpect_log)
     27                                bitlbee_mock = open("t/%s-bitlbee.mock" % name)
     28                                for i in bitlbee_mock.readlines():
     29                                        line = i.strip()
     30                                        if line.startswith(">> "):
     31                                                bitlbee.expect_exact(line[3:], timeout=10)
     32                                        elif line.startswith("<< "):
     33                                                bitlbee.sendline(line[3:])
     34                                bitlbee_mock.close()
     35                                bitlbee.close()
     36                        finally:
     37                                skyped.terminate()
     38                                skyped.communicate()
    3939
    4040        def setUp(self):
Note: See TracChangeset for help on using the changeset viewer.