From 796ca86df992bc9eebd4746124ccb8635da74cad Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Tue, 25 Aug 2015 10:13:49 +0200 Subject: [PATCH] Fix random failures in tests on OSX and Windows --- tests/conftest.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/conftest.py b/tests/conftest.py index b983a89c..42cc8750 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -28,6 +28,8 @@ from unittest.mock import patch sys._called_from_test = True +sys.original_platform = sys.platform + # Prevent execution of external binaries 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) + # Force sys.platform to the original value. Because it seem not be restore correctly at each tests + sys.platform = sys.original_platform + yield # An helper should not raise Exception