mirror of
https://github.com/GNS3/gns3-server
synced 2024-12-25 16:28:11 +00:00
Fix minor errors reported by codacy.com
This commit is contained in:
parent
a961387af9
commit
bd54c55ae1
@ -91,7 +91,7 @@ class PortManager:
|
|||||||
|
|
||||||
return self._console_port_range
|
return self._console_port_range
|
||||||
|
|
||||||
@console_host.setter
|
@console_port_range.setter
|
||||||
def console_port_range(self, new_range):
|
def console_port_range(self, new_range):
|
||||||
|
|
||||||
assert isinstance(new_range, tuple)
|
assert isinstance(new_range, tuple)
|
||||||
@ -112,7 +112,7 @@ class PortManager:
|
|||||||
|
|
||||||
return self._udp_port_range
|
return self._udp_port_range
|
||||||
|
|
||||||
@udp_host.setter
|
@udp_port_range.setter
|
||||||
def udp_port_range(self, new_range):
|
def udp_port_range(self, new_range):
|
||||||
|
|
||||||
assert isinstance(new_range, tuple)
|
assert isinstance(new_range, tuple)
|
||||||
|
@ -94,7 +94,6 @@ class WinStreamHandler(logging.StreamHandler):
|
|||||||
stream.write(msg.encode(stream.encoding, errors="replace").decode(stream.encoding))
|
stream.write(msg.encode(stream.encoding, errors="replace").decode(stream.encoding))
|
||||||
stream.write(self.terminator)
|
stream.write(self.terminator)
|
||||||
self.flush()
|
self.flush()
|
||||||
pass
|
|
||||||
except Exception:
|
except Exception:
|
||||||
self.handleError(record)
|
self.handleError(record)
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ def _get_unused_port():
|
|||||||
return port
|
return port
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope="session")
|
@pytest.fixture
|
||||||
def server(request, loop, port_manager, monkeypatch):
|
def server(request, loop, port_manager, monkeypatch):
|
||||||
"""A GNS3 server"""
|
"""A GNS3 server"""
|
||||||
|
|
||||||
|
@ -144,10 +144,10 @@ def test_backup_images(server, tmpdir, loop):
|
|||||||
tar.close()
|
tar.close()
|
||||||
|
|
||||||
assert os.path.exists(os.path.join('QEMU', 'a.img'))
|
assert os.path.exists(os.path.join('QEMU', 'a.img'))
|
||||||
open(os.path.join('QEMU', 'a.img')).read() == 'hello'
|
assert open(os.path.join('QEMU', 'a.img')).read() == 'hello'
|
||||||
|
|
||||||
assert os.path.exists(os.path.join('QEMU', 'b.img'))
|
assert os.path.exists(os.path.join('QEMU', 'b.img'))
|
||||||
open(os.path.join('QEMU', 'b.img')).read() == 'world'
|
assert open(os.path.join('QEMU', 'b.img')).read() == 'world'
|
||||||
|
|
||||||
|
|
||||||
def test_backup_projects(server, tmpdir, loop):
|
def test_backup_projects(server, tmpdir, loop):
|
||||||
@ -176,7 +176,7 @@ def test_backup_projects(server, tmpdir, loop):
|
|||||||
tar.close()
|
tar.close()
|
||||||
|
|
||||||
assert os.path.exists(os.path.join('a', 'a.gns3'))
|
assert os.path.exists(os.path.join('a', 'a.gns3'))
|
||||||
open(os.path.join('a', 'a.gns3')).read() == 'hello'
|
assert open(os.path.join('a', 'a.gns3')).read() == 'hello'
|
||||||
|
|
||||||
assert os.path.exists(os.path.join('b', 'b.gns3'))
|
assert os.path.exists(os.path.join('b', 'b.gns3'))
|
||||||
open(os.path.join('b', 'b.gns3')).read() == 'world'
|
assert open(os.path.join('b', 'b.gns3')).read() == 'world'
|
||||||
|
@ -171,15 +171,6 @@ def test_update_startup_script(vm):
|
|||||||
assert f.read() == content
|
assert f.read() == content
|
||||||
|
|
||||||
|
|
||||||
def test_update_startup_script(vm):
|
|
||||||
content = "echo GNS3 VPCS\nip 192.168.1.2\n"
|
|
||||||
vm.startup_script = content
|
|
||||||
filepath = os.path.join(vm.working_dir, 'startup.vpc')
|
|
||||||
assert os.path.exists(filepath)
|
|
||||||
with open(filepath) as f:
|
|
||||||
assert f.read() == content
|
|
||||||
|
|
||||||
|
|
||||||
def test_update_startup_script_h(vm):
|
def test_update_startup_script_h(vm):
|
||||||
content = "setname %h\n"
|
content = "setname %h\n"
|
||||||
vm.name = "pc1"
|
vm.name = "pc1"
|
||||||
|
Loading…
Reference in New Issue
Block a user