Closed mm1ke closed 1 month ago
Hi,
for some reason gns3-server fails one test on my system. The output of the test looks like this:
__________________________________________________________________ test_create_image_with_not_supported_characters_by_filesystem ___________________________________________________________________ tmpdir = local('/tmp/pytest-of-root/pytest-0/test_create_image_with_not_sup0'), fake_qemu_img_binary = '/tmp/pytest-of-root/pytest-0/test_create_image_with_not_sup0/qemu-img' async def test_create_image_with_not_supported_characters_by_filesystem(tmpdir, fake_qemu_img_binary): open(str(tmpdir / "hda.qcow2"), "w+").close() options = { "format": "raw", "size": 100 } # patching os.makedirs is necessary as it depends on already mocked os.path.exists with asyncio_patch("asyncio.create_subprocess_exec", return_value=MagicMock()) as process, \ patch("gns3server.compute.qemu.Qemu.get_images_directory", return_value=str(tmpdir)), \ patch("os.path.exists", side_effect=UnicodeEncodeError('error', u"", 1, 2, 'Emulated Unicode Err')),\ patch("os.makedirs"): with pytest.raises(QemuError): > await Qemu.instance().create_disk(fake_qemu_img_binary, "hda.qcow2", options) tests/compute/qemu/test_qemu_manager.py:203: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ gns3server/compute/base_manager.py:95: in instance cls._instance = cls() gns3server/compute/qemu/__init__.py:53: in __init__ self._init_config_disk() gns3server/compute/qemu/__init__.py:385: in _init_config_disk self.get_abs_image_path(self.config_disk) gns3server/compute/base_manager.py:488: in get_abs_image_path valid_directory_prefices = images_directories(self._NODE_TYPE) gns3server/utils/images.py:143: in images_directories return [force_unix_path(p) for p in paths if os.path.exists(p)] /usr/lib/python3.12/unittest/mock.py:1134: in __call__ return self._mock_call(*args, **kwargs) /usr/lib/python3.12/unittest/mock.py:1138: in _mock_call return self._execute_mock_call(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <MagicMock name='exists' id='139793396437968'>, args = ('/tmp/tmpfpbfbqqg/images/QEMU',), kwargs = {}, effect = UnicodeEncodeError('error', '', 1, 2, 'Emulated Unicode Err') def _execute_mock_call(self, /, *args, **kwargs): # separate from _increment_mock_call so that awaited functions are # executed separately from their call, also AsyncMock overrides this method effect = self.side_effect if effect is not None: if _is_exception(effect): > raise effect E UnicodeEncodeError: 'error' codec can't encode characters in position 1-1: Emulated Unicode Err /usr/lib/python3.12/unittest/mock.py:1193: UnicodeEncodeError
This test also fails with older versions which is why i guess it has something todo with some changed system packages. Tests were done with python 3.12:
platform linux -- Python 3.12.3, pytest-8.2.0, pluggy-1.5.0 rootdir: /root/gns3-server-2.2.46 configfile: pytest.ini plugins: pkgcore-0.12.27, asyncio-0.23.6, aiohttp-1.0.5 asyncio: mode=Mode.AUTO
Previously this didn't fail. Any idea what causes this? Other then that, gns3 seems to work fine.
Fixed, thanks 👍
Hi,
for some reason gns3-server fails one test on my system. The output of the test looks like this:
This test also fails with older versions which is why i guess it has something todo with some changed system packages. Tests were done with python 3.12:
Previously this didn't fail. Any idea what causes this? Other then that, gns3 seems to work fine.