mirror of
https://github.com/GNS3/gns3-server
synced 2024-12-24 15:58:08 +00:00
parent
b1ef49672e
commit
986ab649d7
@ -153,7 +153,7 @@ class ProjectHandler:
|
|||||||
|
|
||||||
pm = ProjectManager.instance()
|
pm = ProjectManager.instance()
|
||||||
project = pm.get_project(request.match_info["project_id"])
|
project = pm.get_project(request.match_info["project_id"])
|
||||||
if ProjectHandler._notifications_listening == 0:
|
if ProjectHandler._notifications_listening <= 1:
|
||||||
yield from project.close()
|
yield from project.close()
|
||||||
pm.remove_project(project.id)
|
pm.remove_project(project.id)
|
||||||
else:
|
else:
|
||||||
|
@ -137,13 +137,14 @@ def ethernet_device():
|
|||||||
|
|
||||||
|
|
||||||
@pytest.yield_fixture(autouse=True)
|
@pytest.yield_fixture(autouse=True)
|
||||||
def run_around_tests(monkeypatch):
|
def run_around_tests(monkeypatch, port_manager):
|
||||||
"""
|
"""
|
||||||
This setup a temporay project file environnement around tests
|
This setup a temporay project file environnement around tests
|
||||||
"""
|
"""
|
||||||
|
|
||||||
tmppath = tempfile.mkdtemp()
|
tmppath = tempfile.mkdtemp()
|
||||||
|
|
||||||
|
port_manager._instance = port_manager
|
||||||
config = Config.instance()
|
config = Config.instance()
|
||||||
config.clear()
|
config.clear()
|
||||||
config.set("Server", "project_directory", tmppath)
|
config.set("Server", "project_directory", tmppath)
|
||||||
@ -157,7 +158,6 @@ def run_around_tests(monkeypatch):
|
|||||||
# Force turn off KVM because it's not available on CI
|
# Force turn off KVM because it's not available on CI
|
||||||
config.set("Qemu", "enable_kvm", False)
|
config.set("Qemu", "enable_kvm", False)
|
||||||
|
|
||||||
|
|
||||||
monkeypatch.setattr("gns3server.modules.project.Project._get_default_project_directory", lambda *args: tmppath)
|
monkeypatch.setattr("gns3server.modules.project.Project._get_default_project_directory", lambda *args: tmppath)
|
||||||
|
|
||||||
# Force sys.platform to the original value. Because it seem not be restore correctly at each tests
|
# Force sys.platform to the original value. Because it seem not be restore correctly at each tests
|
||||||
@ -171,6 +171,7 @@ def run_around_tests(monkeypatch):
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@pytest.yield_fixture
|
@pytest.yield_fixture
|
||||||
def darwin_platform():
|
def darwin_platform():
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user