1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-12-25 00:08:11 +00:00

Try to fix capsys issue with Python 3.8

This commit is contained in:
grossmj 2020-06-16 20:56:10 +09:30
parent d33584a2e4
commit 241caa1ec7
3 changed files with 8 additions and 7 deletions

View File

@ -31,7 +31,7 @@ if "dev" in __version__:
import os import os
import subprocess import subprocess
if os.path.exists(os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", ".git")): 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 __version__ += "-" + r
except Exception as e: except Exception as e:
print(e) print(e)

View File

@ -100,6 +100,7 @@ async def test_auto_start(controller, dummy_gns3vm, dummy_engine):
assert controller.computes["vm"].user == "hello" assert controller.computes["vm"].user == "hello"
assert controller.computes["vm"].password == "world" assert controller.computes["vm"].password == "world"
@pytest.mark.skipif(sys.platform.startswith("win"), reason="Not working well on Windows") @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): async def test_auto_start_with_error(controller, dummy_gns3vm, dummy_engine):

View File

@ -50,23 +50,23 @@ def test_parse_arguments(capsys, tmpdir):
with pytest.raises(SystemExit): with pytest.raises(SystemExit):
run.parse_arguments(["-v"]) run.parse_arguments(["-v"])
out, err = capsys.readouterr() out, _ = capsys.readouterr()
assert __version__ in "{}{}".format(out.strip(), err.strip()) # Depending of the Python version the location of the version change assert __version__ in "{}".format(out.strip()) # Depending of the Python version the location of the version change
with pytest.raises(SystemExit): with pytest.raises(SystemExit):
run.parse_arguments(["--version"]) run.parse_arguments(["--version"])
out, err = capsys.readouterr() out, _ = capsys.readouterr()
assert __version__ in "{}{}".format(out.strip(), err.strip()) # Depending of the Python version the location of the version change assert __version__ in "{}".format(out.strip()) # Depending of the Python version the location of the version change
with pytest.raises(SystemExit): with pytest.raises(SystemExit):
run.parse_arguments(["-h"]) run.parse_arguments(["-h"])
out, err = capsys.readouterr() out, _ = capsys.readouterr()
assert __version__ in out assert __version__ in out
assert "optional arguments" in out assert "optional arguments" in out
with pytest.raises(SystemExit): with pytest.raises(SystemExit):
run.parse_arguments(["--help"]) run.parse_arguments(["--help"])
out, err = capsys.readouterr() out, _ = capsys.readouterr()
assert __version__ in out assert __version__ in out
assert "optional arguments" in out assert "optional arguments" in out