diff options
author | Mike Kazantsev <mk.fraggod@gmail.com> | 2013-02-11 13:56:03 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@suse.cz> | 2013-02-11 13:56:03 +0100 |
commit | ee3bccddcc2c197444be1bb685aa893e0ae2f910 (patch) | |
tree | 5ce62cdd22a1938b705579770161c2be04ccc79f /protocols/skype/test.py | |
parent | 1146e216e8cf8c6fca77f3b5325ccd86078f827a (diff) |
skype: make chdirs work more reliably between tests
Diffstat (limited to 'protocols/skype/test.py')
-rwxr-xr-x | protocols/skype/test.py | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/protocols/skype/test.py b/protocols/skype/test.py index 6d4e9daf..f20039e2 100755 --- a/protocols/skype/test.py +++ b/protocols/skype/test.py @@ -51,16 +51,18 @@ class Test(unittest.TestCase): os.makedirs("t/skyped") cwd = os.getcwd() os.chdir("t/skyped") - shutil.copyfile("../../skyped.cnf", "skyped.cnf") - self.openssl(['req', '-new', '-x509', '-days', '365', '-nodes', '-config', 'skyped.cnf', '-out', 'skyped.cert.pem', '-keyout', 'skyped.key.pem']) - with open("skyped.conf", "w") as sock: - sock.write("[skyped]\n") - sock.write("username = alice\n") - sock.write("password = %s\n" % hashlib.sha1("foo").hexdigest()) - sock.write("cert = %s/skyped.cert.pem\n" % os.getcwd()) - sock.write("key = %s/skyped.key.pem\n" % os.getcwd()) - sock.write("port = 2727\n") - os.chdir(cwd) + try: + shutil.copyfile("../../skyped.cnf", "skyped.cnf") + self.openssl(['req', '-new', '-x509', '-days', '365', '-nodes', '-config', 'skyped.cnf', '-out', 'skyped.cert.pem', '-keyout', 'skyped.key.pem']) + with open("skyped.conf", "w") as sock: + sock.write("[skyped]\n") + sock.write("username = alice\n") + sock.write("password = %s\n" % hashlib.sha1("foo").hexdigest()) + sock.write("cert = %s/skyped.cert.pem\n" % os.getcwd()) + sock.write("key = %s/skyped.key.pem\n" % os.getcwd()) + sock.write("port = 2727\n") + finally: + os.chdir(cwd) def testMsg(self): @@ -71,13 +73,13 @@ class Test(unittest.TestCase): def testInfo(self): self.mock("info") - + def testCall(self): self.mock("call") - + def testCallFailed(self): self.mock("call-failed") - + def testAddYes(self): self.mock("add-yes") @@ -89,7 +91,7 @@ class Test(unittest.TestCase): def testGroupchatInvite(self): self.mock("groupchat-invite") - + def testCalledYes(self): self.mock("called-yes") |