From 241caa1ec78ddef1b67cc642e473fe635fa64b64 Mon Sep 17 00:00:00 2001 From: grossmj Date: Tue, 16 Jun 2020 20:56:10 +0930 Subject: [PATCH] Try to fix capsys issue with Python 3.8 --- gns3server/version.py | 2 +- tests/controller/test_gns3vm.py | 1 + tests/test_run.py | 12 ++++++------ 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/gns3server/version.py b/gns3server/version.py index 473e6b64..60bdce77 100644 --- a/gns3server/version.py +++ b/gns3server/version.py @@ -31,7 +31,7 @@ if "dev" in __version__: import os import subprocess if os.path.exists(os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", ".git")): - r = subprocess.check_output(["git", "rev-parse", "--short", "HEAD"]).decode().strip("\n") + r = subprocess.check_output(["git", "rev-parse", "--short", "HEAD"]).decode().strip() __version__ += "-" + r except Exception as e: print(e) diff --git a/tests/controller/test_gns3vm.py b/tests/controller/test_gns3vm.py index a56dfdb6..8d01fae9 100644 --- a/tests/controller/test_gns3vm.py +++ b/tests/controller/test_gns3vm.py @@ -100,6 +100,7 @@ async def test_auto_start(controller, dummy_gns3vm, dummy_engine): assert controller.computes["vm"].user == "hello" assert controller.computes["vm"].password == "world" + @pytest.mark.skipif(sys.platform.startswith("win"), reason="Not working well on Windows") async def test_auto_start_with_error(controller, dummy_gns3vm, dummy_engine): diff --git a/tests/test_run.py b/tests/test_run.py index c15bfb27..966acfcc 100644 --- a/tests/test_run.py +++ b/tests/test_run.py @@ -50,23 +50,23 @@ def test_parse_arguments(capsys, tmpdir): with pytest.raises(SystemExit): run.parse_arguments(["-v"]) - out, err = capsys.readouterr() - assert __version__ in "{}{}".format(out.strip(), err.strip()) # Depending of the Python version the location of the version change + out, _ = capsys.readouterr() + assert __version__ in "{}".format(out.strip()) # Depending of the Python version the location of the version change with pytest.raises(SystemExit): run.parse_arguments(["--version"]) - out, err = capsys.readouterr() - assert __version__ in "{}{}".format(out.strip(), err.strip()) # Depending of the Python version the location of the version change + out, _ = capsys.readouterr() + assert __version__ in "{}".format(out.strip()) # Depending of the Python version the location of the version change with pytest.raises(SystemExit): run.parse_arguments(["-h"]) - out, err = capsys.readouterr() + out, _ = capsys.readouterr() assert __version__ in out assert "optional arguments" in out with pytest.raises(SystemExit): run.parse_arguments(["--help"]) - out, err = capsys.readouterr() + out, _ = capsys.readouterr() assert __version__ in out assert "optional arguments" in out