diff --git a/.coverage.atlantis.6236.785802 b/.coverage.atlantis.6236.785802 new file mode 100644 index 00000000..52f67bce --- /dev/null +++ b/.coverage.atlantis.6236.785802 @@ -0,0 +1 @@ +!coverage.py: This is a private format, don't read it directly!{"lines": {"/Users/noplay/code/gns3/gns3-server/gns3server/modules/docker/docker_vm.py": [20, 22, 23, 24, 25, 27, 28, 29, 30, 31, 32, 34, 35, 38, 46, 48, 49, 51, 52, 53, 54, 55, 56, 57, 58, 60, 62, 63, 64, 65, 66, 68, 77, 82, 89, 91, 92, 93, 94, 95, 97, 101, 102, 103, 104, 105, 106, 109, 112, 113, 114, 115, 116, 118, 122, 123, 124, 126, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 142, 143, 144, 145, 146, 147, 148, 149, 155, 156, 157, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 197, 198, 199, 215, 216, 217, 273, 274, 275, 285, 286, 287, 291, 292, 298, 299, 300, 301, 302, 303, 304, 306, 307, 308, 332, 333, 334, 339, 340, 341, 342, 343, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360], "/Users/noplay/code/gns3/gns3-server/gns3server/modules/docker/__init__.py": [20, 22, 23, 24, 25, 26, 27, 29, 31, 32, 33, 34, 37, 39, 41, 42, 44, 45, 47, 48, 57, 58, 59, 60, 61, 62, 63, 64, 66, 67, 68, 69, 70, 72, 79, 80, 81, 82, 83], "/Users/noplay/code/gns3/gns3-server/gns3server/modules/docker/docker_error.py": [20, 22, 25, 26]}} \ No newline at end of file diff --git a/README.rst b/README.rst index 5275c6d2..891577aa 100644 --- a/README.rst +++ b/README.rst @@ -163,7 +163,6 @@ and homebrew: http://brew.sh/. python3 setup.py install gns3server - SSL --- @@ -190,3 +189,18 @@ Or in your gns3_server.conf by adding in the Server section: certfile=/Users/noplay/.config/GNS3/ssl/server.cert certkey=/Users/noplay/.config/GNS3/ssl/server.key ssl=True + +Running tests +************* + +Just run: + +.. code:: bash + + py.test -vv + +If you want test coverage: + +.. code:: bash + + py.test --cov=gns3server diff --git a/gns3server/modules/port_manager.py b/gns3server/modules/port_manager.py index 2ed368bf..619c51f3 100644 --- a/gns3server/modules/port_manager.py +++ b/gns3server/modules/port_manager.py @@ -90,7 +90,7 @@ class PortManager: return self._console_port_range - @console_host.setter + @console_port_range.setter def console_port_range(self, new_range): assert isinstance(new_range, tuple) @@ -111,7 +111,7 @@ class PortManager: return self._udp_port_range - @udp_host.setter + @udp_port_range.setter def udp_port_range(self, new_range): assert isinstance(new_range, tuple) diff --git a/gns3server/web/logger.py b/gns3server/web/logger.py index 37b4882d..ba5c4736 100644 --- a/gns3server/web/logger.py +++ b/gns3server/web/logger.py @@ -94,7 +94,6 @@ class WinStreamHandler(logging.StreamHandler): stream.write(msg.encode(stream.encoding, errors="replace").decode(stream.encoding)) stream.write(self.terminator) self.flush() - pass except Exception: self.handleError(record) diff --git a/tests/handlers/test_upload.py b/tests/handlers/test_upload.py index 477e3535..dd7b9246 100644 --- a/tests/handlers/test_upload.py +++ b/tests/handlers/test_upload.py @@ -197,10 +197,10 @@ def test_backup_images(server, tmpdir, loop): tar.close() 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')) - 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): @@ -229,7 +229,7 @@ def test_backup_projects(server, tmpdir, loop): tar.close() 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')) - open(os.path.join('b', 'b.gns3')).read() == 'world' + assert open(os.path.join('b', 'b.gns3')).read() == 'world' diff --git a/tests/modules/vpcs/test_vpcs_vm.py b/tests/modules/vpcs/test_vpcs_vm.py index e02d7f4d..15808990 100644 --- a/tests/modules/vpcs/test_vpcs_vm.py +++ b/tests/modules/vpcs/test_vpcs_vm.py @@ -181,15 +181,6 @@ def test_update_startup_script(vm): 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): content = "setname %h\n" vm.name = "pc1"