File: suppress-post-install-tests.patch

package info (click to toggle)
python-language-server 0.36.2-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,196 kB
  • sloc: python: 5,314; sh: 12; makefile: 6
file content (83 lines) | stat: -rw-r--r-- 3,203 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
This patch skips tests that only work post-installation.  They have
been reported upstream as:
https://github.com/palantir/python-language-server/issues/897

--- a/test/plugins/test_pylint_lint.py
+++ b/test/plugins/test_pylint_lint.py
@@ -3,7 +3,7 @@
 import os
 import tempfile
 
-from test import py2_only, py3_only, IS_PY3
+from test import py2_only, py3_only, IS_PY3, is_building, installed_only
 from pyls import lsp, uris
 from pyls.workspace import Document
 from pyls.plugins import pylint_lint
@@ -49,8 +49,9 @@
         assert unused_import['range']['start'] == {'line': 0, 'character': 0}
         assert unused_import['severity'] == lsp.DiagnosticSeverity.Warning
 
-        if IS_PY3:
+        if IS_PY3 and not is_building:
             # test running pylint in stdin
+            # but not during package build time
             config.plugin_settings('pylint')['executable'] = 'pylint'
             diags = pylint_lint.pyls_lint(config, doc, True)
 
@@ -75,13 +76,15 @@
         assert diag['severity'] == lsp.DiagnosticSeverity.Error
 
         # test running pylint in stdin
-        config.plugin_settings('pylint')['executable'] = 'pylint'
-        diag = pylint_lint.pyls_lint(config, doc, True)[0]
-
-        assert diag['message'].startswith('invalid syntax')
-        # Pylint doesn't give column numbers for invalid syntax.
-        assert diag['range']['start'] == {'line': 0, 'character': 12}
-        assert diag['severity'] == lsp.DiagnosticSeverity.Error
+        # but not during package build time
+        if not is_building:
+            config.plugin_settings('pylint')['executable'] = 'pylint'
+            diag = pylint_lint.pyls_lint(config, doc, True)[0]
+    
+            assert diag['message'].startswith('invalid syntax')
+            # Pylint doesn't give column numbers for invalid syntax.
+            assert diag['range']['start'] == {'line': 0, 'character': 12}
+            assert diag['severity'] == lsp.DiagnosticSeverity.Error
 
 
 @py2_only
@@ -95,6 +98,7 @@
         assert diag['severity'] == lsp.DiagnosticSeverity.Error
 
 
+@installed_only
 def test_lint_free_pylint(config, workspace):
     # Can't use temp_document because it might give us a file that doesn't
     # match pylint's naming requirements. We should be keeping this file clean
@@ -131,6 +135,7 @@
         assert not pylint_lint.PylintLinter.lint(doc, False, flags)
 
 
+@installed_only
 def test_per_file_caching(config, workspace):
     # Ensure that diagnostics are cached per-file.
     with temp_document(DOC, workspace) as doc:
--- a/test/__init__.py
+++ b/test/__init__.py
@@ -1,5 +1,6 @@
 # Copyright 2017 Palantir Technologies, Inc.
 import sys
+import os
 import pytest
 from pyls import IS_WIN
 
@@ -9,3 +10,8 @@
 windows_only = pytest.mark.skipif(not IS_WIN, reason="Windows only")
 py3_only = pytest.mark.skipif(not IS_PY3, reason="Python3 only")
 py2_only = pytest.mark.skipif(IS_PY3, reason="Python2 only")
+
+# Are we in the middle of a Debian package build?
+# Some tests only make sense once the package is installed, so we skip those.
+is_building = 'DEB_BUILD_ARCH' in os.environ
+installed_only = pytest.mark.skipif(is_building, reason="Post-install only")