Skip to content

Commit 3d0ee90

Browse files
committed
Python: Make two tests not depend on minor Python version.
For syntax errors, we simply report the major version. For unused imports, we were getting a result for `typing.py` when run under Python 3.7.3. To prevent this import from being considered, I've set the maximum import depth to `0`.
1 parent c690e25 commit 3d0ee90

4 files changed

Lines changed: 4 additions & 3 deletions

File tree

python/ql/src/Imports/SyntaxError.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ import python
1414

1515
from SyntaxError error
1616
where not error instanceof EncodingError
17-
select error, error.getMessage() + " (in Python " + major_version() + "." + minor_version() + ")."
17+
select error, error.getMessage() + " (in Python " + major_version() + ")."
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
| nonsense.py:1:14:1:14 | Syntax Error | Syntax Error (in Python 2.7). |
1+
| nonsense.py:1:14:1:14 | Syntax Error | Syntax Error (in Python 2). |
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
| nonsense.py:1:2:1:2 | Syntax Error | Syntax Error (in Python 3.5). |
1+
| nonsense.py:1:2:1:2 | Syntax Error | Syntax Error (in Python 3). |
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
semmle-extractor-options: --max-import-depth=0

0 commit comments

Comments
 (0)