[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [stem/master] Make tests cross-platform & fix things that broke during a rebase
commit 7d8b1fdef6e6b2cd38a7c2f3aa09a957b03af1a5
Author: Ravi Chandra Padmala <neenaoffline@xxxxxxxxx>
Date: Wed Jun 27 01:28:39 2012 +0530
Make tests cross-platform & fix things that broke during a rebase
---
test/integ/control/controller.py | 20 ++++++++++++++------
1 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/test/integ/control/controller.py b/test/integ/control/controller.py
index a407904..eb2386c 100644
--- a/test/integ/control/controller.py
+++ b/test/integ/control/controller.py
@@ -5,6 +5,8 @@ Integration tests for the stem.control.Controller class.
from __future__ import with_statement
import unittest
+import tempfile
+import shutil
import stem.control
import stem.socket
@@ -193,13 +195,15 @@ class TestController(unittest.TestCase):
self.assertEqual({}, controller.get_conf_map([], "la-di-dah"))
# context-sensitive keys
+ tmpdir = tempfile.mkdtemp()
keys = [
- ("HiddenServiceDir", "/tmp/stemtestdir"),
+ ("HiddenServiceDir", tmpdir),
("HiddenServicePort", "17234 127.0.0.1:17235")
]
controller.set_conf(keys)
- self.assertEqual("/tmp/stemtestdir", controller.get_conf("HiddenServiceDir"))
+ self.assertEqual(tmpdir, controller.get_conf("HiddenServiceDir"))
self.assertEqual("17234 127.0.0.1:17235", controller.get_conf("HiddenServicePort"))
+ shutil.rmtree(tmpdir)
def test_setconf(self):
"""
@@ -232,13 +236,15 @@ class TestController(unittest.TestCase):
except stem.socket.InvalidArguments, exc:
self.assertEqual(["bombay"], exc.arguments)
+ tmpdir = tempfile.mkdtemp()
settings = [
- ("HiddenServiceDir", "/tmp/stemtestdir"),
+ ("HiddenServiceDir", tmpdir),
("HiddenServicePort", "17234 127.0.0.1:17235")
]
controller.set_conf(settings)
self.assertEqual("17234 127.0.0.1:17235", controller.get_conf("hiddenserviceport"))
- self.assertEqual("/tmp/stemtestdir", controller.get_conf("hiddenservicedir"))
+ self.assertEqual(tmpdir, controller.get_conf("hiddenservicedir"))
+ shutil.rmtree(tmpdir)
def test_resetconf(self):
"""
@@ -278,11 +284,13 @@ class TestController(unittest.TestCase):
self.assertEqual("stem testing", controller.get_conf("contactinfo"))
# context-sensitive keys
+ tmpdir = tempfile.mkdtemp()
settings = [
- ("HiddenServiceDir", "/tmp/stemtestdir"),
+ ("HiddenServiceDir", tmpdir),
("HiddenServicePort", "17234 127.0.0.1:17235")
]
controller.reset_conf(settings)
self.assertEqual("17234 127.0.0.1:17235", controller.get_conf("hiddenserviceport"))
- self.assertEqual("/tmp/stemtestdir", controller.get_conf("hiddenservicedir"))
+ self.assertEqual(tmpdir, controller.get_conf("hiddenservicedir"))
+ shutil.rmtree(tmpdir)
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits