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

Fix random failures in tests on OSX and Windows

This commit is contained in:
Julien Duponchelle 2015-08-25 10:13:49 +02:00
parent f0f901a15d
commit 796ca86df9

View File

@ -28,6 +28,8 @@ from unittest.mock import patch
sys._called_from_test = True sys._called_from_test = True
sys.original_platform = sys.platform
# Prevent execution of external binaries # Prevent execution of external binaries
os.environ["PATH"] = tempfile.mkdtemp() os.environ["PATH"] = tempfile.mkdtemp()
@ -158,6 +160,9 @@ def run_around_tests(monkeypatch):
monkeypatch.setattr("gns3server.modules.project.Project._get_default_project_directory", lambda *args: tmppath) monkeypatch.setattr("gns3server.modules.project.Project._get_default_project_directory", lambda *args: tmppath)
# Force sys.platform to the original value. Because it seem not be restore correctly at each tests
sys.platform = sys.original_platform
yield yield
# An helper should not raise Exception # An helper should not raise Exception