From f7f32fe2068b2d1be163288ec3cd936cf5e54efc Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Thu, 9 Aug 2018 17:16:53 +0200 Subject: [PATCH] Better checking for sys --- test/test_plugin/test_stub.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/test/test_plugin/test_stub.py b/test/test_plugin/test_stub.py index 41a01646..f0e64b29 100644 --- a/test/test_plugin/test_stub.py +++ b/test/test_plugin/test_stub.py @@ -81,11 +81,19 @@ def test_method(Script): assert context.class_context.py__name__() == 'str' -def test_sys(Script): +def test_sys(Script, environment): code = 'import sys; sys.exc_info()[1]' def_, = Script(code).goto_definitions() assert def_.name == 'BaseException' + # This should only exist on Windows, but cmpletion should happen + # everywhere. + def_, = Script('import sys; sys.getwindowsversion().major').goto_definitions() + if environment.version_info.major == 2: + assert def_.name == 'Any' + else: + assert def_.name == 'int' + def test_math(Script): def_, = Script('import math; math.acos()').goto_definitions()