summaryrefslogtreecommitdiff
path: root/src/leap/common/testing
diff options
context:
space:
mode:
authorMicah Anderson <micah@riseup.net>2015-11-10 17:34:54 -0500
committerMicah Anderson <micah@riseup.net>2015-11-10 17:34:54 -0500
commit93ac9288e301643a4b9c31e2750a231f4e7bc8d8 (patch)
tree92d7ea2d18f288cd7dfd852ee6af8787c722c87c /src/leap/common/testing
parent42814b5bf836a83724d2c74d6bb32bc168b7a81c (diff)
parente074eac10c6e08757857c770cb190cdb9d3a4583 (diff)
Merge branch 'debian/experimental' into debian/platform-0.8
Diffstat (limited to 'src/leap/common/testing')
-rw-r--r--src/leap/common/testing/basetest.py21
-rw-r--r--src/leap/common/testing/test_basetest.py6
2 files changed, 15 insertions, 12 deletions
diff --git a/src/leap/common/testing/basetest.py b/src/leap/common/testing/basetest.py
index 3fbcf33..3d3cee0 100644
--- a/src/leap/common/testing/basetest.py
+++ b/src/leap/common/testing/basetest.py
@@ -30,8 +30,11 @@ except ImportError:
from leap.common.check import leap_assert
from leap.common.events import server as events_server
from leap.common.events import client as events_client
+from leap.common.events import flags, set_events_enabled
from leap.common.files import mkdir_p, check_and_fix_urw_only
+set_events_enabled(False)
+
class BaseLeapTest(unittest.TestCase):
"""
@@ -73,12 +76,13 @@ class BaseLeapTest(unittest.TestCase):
@classmethod
def _init_events(cls):
- cls._server = events_server.ensure_server(
- emit_addr="tcp://127.0.0.1:0",
- reg_addr="tcp://127.0.0.1:0")
- events_client.configure_client(
- emit_addr="tcp://127.0.0.1:%d" % cls._server.pull_port,
- reg_addr="tcp://127.0.0.1:%d" % cls._server.pub_port)
+ if flags.EVENTS_ENABLED:
+ cls._server = events_server.ensure_server(
+ emit_addr="tcp://127.0.0.1:0",
+ reg_addr="tcp://127.0.0.1:0")
+ events_client.configure_client(
+ emit_addr="tcp://127.0.0.1:%d" % cls._server.pull_port,
+ reg_addr="tcp://127.0.0.1:%d" % cls._server.pub_port)
@classmethod
def tearDownEnv(cls):
@@ -87,8 +91,9 @@ class BaseLeapTest(unittest.TestCase):
- restores the default PATH and HOME variables
- removes the temporal folder
"""
- events_client.shutdown()
- cls._server.shutdown()
+ if flags.EVENTS_ENABLED:
+ events_client.shutdown()
+ cls._server.shutdown()
os.environ["PATH"] = cls.old_path
os.environ["HOME"] = cls.old_home
diff --git a/src/leap/common/testing/test_basetest.py b/src/leap/common/testing/test_basetest.py
index cf0962d..ec42a62 100644
--- a/src/leap/common/testing/test_basetest.py
+++ b/src/leap/common/testing/test_basetest.py
@@ -83,12 +83,10 @@ class TestInitBaseLeapTest(BaseLeapTest):
"""
def setUp(self):
- """nuke it"""
- pass
+ self.setUpEnv()
def tearDown(self):
- """nuke it"""
- pass
+ self.tearDownEnv()
def test_path_is_changed(self):
"""tests whether we have changed the PATH env var"""