Fix stacktrace when exiting with Ctrl + C

Fix #547
This commit is contained in:
Julien Duponchelle committed 2016-06-02 13:44:52 +02:00
1 parent f47eb326c7
commit 4afa5994e8
5 files changed
+31 -1

No files matched your search

+6
View File
@@ -205,6 +205,12 @@ def test_streamFile(project, async_run, compute):
mock.assert_called_with("GET", "https://example.com:84/v2/compute/projects/{}/stream/test/titi".format(project.id), auth=None)
def test_close(compute, async_run):
assert compute.connected is True
async_run(compute.close())
assert compute.connected is False
def test_update(compute, controller, async_run):
compute._controller._notification = MagicMock()
compute.name = "Test"
+9
View File
@@ -91,12 +91,14 @@ def test_deleteCompute(controller, controller_config_path, async_run):
c = async_run(controller.add_compute(compute_id="test1"))
assert len(controller.computes) == 1
controller._notification = MagicMock()
c._connected = True
async_run(controller.delete_compute("test1"))
assert len(controller.computes) == 0
controller._notification.emit.assert_called_with("compute.deleted", c.__json__())
with open(controller_config_path) as f:
data = json.load(f)
assert len(data["computes"]) == 0
assert c.connected is False
def test_addComputeConfigFile(controller, controller_config_path, async_run):
@@ -174,3 +176,10 @@ def test_getProject(controller, async_run):
assert controller.get_project(uuid1) == project
with pytest.raises(aiohttp.web.HTTPNotFound):
assert controller.get_project("dsdssd")
def test_close(controller, async_run):
c = async_run(controller.add_compute(compute_id="test1"))
c._connected = True
async_run(controller.close())
assert c.connected is False