Skip to content
Snippets Groups Projects
Commit eb987ee1 authored by Andreas Tille's avatar Andreas Tille
Browse files

Update upstream source from tag 'upstream/0.6.3'

Update to upstream version '0.6.3'
with Debian dir 4d52fb348eda41bf57f337c2b60369d4af93aa84
parents e68e57f8 6d10faae
No related branches found
No related tags found
No related merge requests found
name: Tests name: Tests
on: [push, pull_request]
on:
push:
branches:
- master
pull_request:
workflow_dispatch:
jobs: jobs:
build: build:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
strategy: strategy:
matrix: matrix:
python-version: [3.6, 3.7, 3.8, 3.9, '3.10', 3.11-dev] python-version: [3.6, 3.7, 3.8, 3.9, '3.10', 3.11, '3.12-dev']
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }} - name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2 uses: actions/setup-python@v4
with: with:
python-version: ${{ matrix.python-version }} python-version: ${{ matrix.python-version }}
- name: run tests - name: run tests
env: env:
STACK_DATA_SLOW_TESTS: 1 STACK_DATA_SLOW_TESTS: 1
run: | run: |
pip install -U pip pip install --upgrade pip
pip install --upgrade coveralls setuptools setuptools_scm pep517 pip install --upgrade coveralls setuptools setuptools_scm pep517
pip install .[tests] pip install .[tests]
coverage run --source stack_data -m pytest coverage run --source stack_data -m pytest
......
...@@ -16,6 +16,7 @@ classifiers = ...@@ -16,6 +16,7 @@ classifiers =
Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10 Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11 Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.12
License :: OSI Approved :: MIT License License :: OSI Approved :: MIT License
Operating System :: OS Independent Operating System :: OS Independent
Topic :: Software Development :: Debuggers Topic :: Software Development :: Debuggers
......
...@@ -92,12 +92,13 @@ def is_frame(frame_or_tb: Union[FrameType, TracebackType]) -> bool: ...@@ -92,12 +92,13 @@ def is_frame(frame_or_tb: Union[FrameType, TracebackType]) -> bool:
def iter_stack(frame_or_tb: Union[FrameType, TracebackType]) -> Iterator[Union[FrameType, TracebackType]]: def iter_stack(frame_or_tb: Union[FrameType, TracebackType]) -> Iterator[Union[FrameType, TracebackType]]:
while frame_or_tb: current: Union[FrameType, TracebackType, None] = frame_or_tb
yield frame_or_tb while current:
if is_frame(frame_or_tb): yield current
frame_or_tb = frame_or_tb.f_back if is_frame(current):
current = current.f_back
else: else:
frame_or_tb = frame_or_tb.tb_next current = current.tb_next
def frame_and_lineno(frame_or_tb: Union[FrameType, TracebackType]) -> Tuple[FrameType, int]: def frame_and_lineno(frame_or_tb: Union[FrameType, TracebackType]) -> Tuple[FrameType, int]:
......
import os import os
import pyximport import pyximport
from typeguard.importhook import install_import_hook try:
from typeguard import install_import_hook
except ImportError:
from typeguard.importhook import install_import_hook
pyximport.install(language_level=3) pyximport.install(language_level=3)
......
Traceback (most recent call last): Traceback (most recent call last):
File "formatter_example.py", line 21, in foo File "formatter_example.py", line 21, in foo
9 | x = 1 9 | x = 1
10 | lst = ( 10 | lst = (
11 |  [ 11 |  [
12 |  x, 12 |  x,
(...) (...)
18 |  + [] 18 |  + []
19 | ) 19 | )
20 | try: 20 | try:
--> 21 |  return int(str(lst)) --> 21 |  return int(str(lst))
...@@ -19,7 +19,7 @@ Traceback (most recent call last): ...@@ -19,7 +19,7 @@ Traceback (most recent call last):
21 |  return int(str(lst)) 21 |  return int(str(lst))
22 | except: 22 | except:
23 |  try: 23 |  try:
--> 24 |  return 1 / 0 --> 24 |  return 1 / 0
25 |  except Exception as e: 25 |  except Exception as e:
ZeroDivisionError: division by zero ZeroDivisionError: division by zero
...@@ -31,24 +31,24 @@ Traceback (most recent call last): ...@@ -31,24 +31,24 @@ Traceback (most recent call last):
--> 30 |  exec("foo()") --> 30 |  exec("foo()")
File "<string>", line 1, in <module> File "<string>", line 1, in <module>
File "formatter_example.py", line 8, in foo File "formatter_example.py", line 8, in foo
6 | def foo(n=5): 6 | def foo(n=5):
7 |  if n > 0: 7 |  if n > 0:
--> 8 |  return foo(n - 1) --> 8 |  return foo(n - 1)
9 |  x = 1 9 |  x = 1
File "formatter_example.py", line 8, in foo File "formatter_example.py", line 8, in foo
6 | def foo(n=5): 6 | def foo(n=5):
7 |  if n > 0: 7 |  if n > 0:
--> 8 |  return foo(n - 1) --> 8 |  return foo(n - 1)
9 |  x = 1 9 |  x = 1
[... skipping similar frames: foo at line 8 (2 times)] [... skipping similar frames: foo at line 8 (2 times)]
File "formatter_example.py", line 8, in foo File "formatter_example.py", line 8, in foo
6 | def foo(n=5): 6 | def foo(n=5):
7 |  if n > 0: 7 |  if n > 0:
--> 8 |  return foo(n - 1) --> 8 |  return foo(n - 1)
9 |  x = 1 9 |  x = 1
File "formatter_example.py", line 26, in foo File "formatter_example.py", line 26, in foo
23 | try: 23 | try:
24 |  return 1 / 0 24 |  return 1 / 0
25 | except Exception as e: 25 | except Exception as e:
--> 26 |  raise TypeError from e --> 26 |  raise TypeError from e
TypeError TypeError
...@@ -582,13 +582,13 @@ ...@@ -582,13 +582,13 @@
"type": "line", "type": "line",
"is_current": false, "is_current": false,
"lineno": 9, "lineno": 9,
"text": "\u001b[38;5;15m\u001b[39m\u001b[38;5;15mx\u001b[39m\u001b[38;5;15m \u001b[39m\u001b[38;5;197m=\u001b[39m\u001b[38;5;15m \u001b[39m\u001b[38;5;141m1\u001b[39m" "text": "\u001b[38;5;15m\u001b[39m\u001b[38;5;15mx\u001b[39m\u001b[38;5;15m \u001b[39m\u001b[38;5;204m=\u001b[39m\u001b[38;5;15m \u001b[39m\u001b[38;5;141m1\u001b[39m"
}, },
{ {
"type": "line", "type": "line",
"is_current": false, "is_current": false,
"lineno": 10, "lineno": 10,
"text": "\u001b[38;5;15m\u001b[39m\u001b[38;5;15mlst\u001b[39m\u001b[38;5;15m \u001b[39m\u001b[38;5;197m=\u001b[39m\u001b[38;5;15m \u001b[39m\u001b[38;5;15m(\u001b[39m" "text": "\u001b[38;5;15m\u001b[39m\u001b[38;5;15mlst\u001b[39m\u001b[38;5;15m \u001b[39m\u001b[38;5;204m=\u001b[39m\u001b[38;5;15m \u001b[39m\u001b[38;5;15m(\u001b[39m"
}, },
{ {
"type": "line", "type": "line",
...@@ -609,7 +609,7 @@ ...@@ -609,7 +609,7 @@
"type": "line", "type": "line",
"is_current": false, "is_current": false,
"lineno": 18, "lineno": 18,
"text": "\u001b[38;5;15m \u001b[39m\u001b[38;5;197m+\u001b[39m\u001b[38;5;15m \u001b[39m\u001b[38;5;15m[\u001b[39m\u001b[38;5;15m]\u001b[39m" "text": "\u001b[38;5;15m \u001b[39m\u001b[38;5;204m+\u001b[39m\u001b[38;5;15m \u001b[39m\u001b[38;5;15m[\u001b[39m\u001b[38;5;15m]\u001b[39m"
}, },
{ {
"type": "line", "type": "line",
...@@ -724,7 +724,7 @@ ...@@ -724,7 +724,7 @@
"type": "line", "type": "line",
"is_current": true, "is_current": true,
"lineno": 24, "lineno": 24,
"text": "\u001b[38;5;15m \u001b[39m\u001b[38;5;81mreturn\u001b[39m\u001b[38;5;15m \u001b[39m\u001b[38;5;141;48;5;24m1\u001b[39;49m\u001b[38;5;15;48;5;24m \u001b[39;49m\u001b[38;5;197;48;5;24m/\u001b[39;49m\u001b[38;5;15;48;5;24m \u001b[39;49m\u001b[38;5;141;48;5;24m0\u001b[39;49m" "text": "\u001b[38;5;15m \u001b[39m\u001b[38;5;81mreturn\u001b[39m\u001b[38;5;15m \u001b[39m\u001b[38;5;141;48;5;24m1\u001b[39;49m\u001b[38;5;15;48;5;24m \u001b[39;49m\u001b[38;5;204;48;5;24m/\u001b[39;49m\u001b[38;5;15;48;5;24m \u001b[39;49m\u001b[38;5;141;48;5;24m0\u001b[39;49m"
}, },
{ {
"type": "line", "type": "line",
...@@ -832,25 +832,25 @@ ...@@ -832,25 +832,25 @@
"type": "line", "type": "line",
"is_current": false, "is_current": false,
"lineno": 6, "lineno": 6,
"text": "\u001b[38;5;81mdef\u001b[39m\u001b[38;5;15m \u001b[39m\u001b[38;5;148mfoo\u001b[39m\u001b[38;5;15m(\u001b[39m\u001b[38;5;15mn\u001b[39m\u001b[38;5;197m=\u001b[39m\u001b[38;5;141m5\u001b[39m\u001b[38;5;15m)\u001b[39m\u001b[38;5;15m:\u001b[39m" "text": "\u001b[38;5;81mdef\u001b[39m\u001b[38;5;15m \u001b[39m\u001b[38;5;148mfoo\u001b[39m\u001b[38;5;15m(\u001b[39m\u001b[38;5;15mn\u001b[39m\u001b[38;5;204m=\u001b[39m\u001b[38;5;141m5\u001b[39m\u001b[38;5;15m)\u001b[39m\u001b[38;5;15m:\u001b[39m"
}, },
{ {
"type": "line", "type": "line",
"is_current": false, "is_current": false,
"lineno": 7, "lineno": 7,
"text": "\u001b[38;5;15m \u001b[39m\u001b[38;5;81mif\u001b[39m\u001b[38;5;15m \u001b[39m\u001b[38;5;15mn\u001b[39m\u001b[38;5;15m \u001b[39m\u001b[38;5;197m>\u001b[39m\u001b[38;5;15m \u001b[39m\u001b[38;5;141m0\u001b[39m\u001b[38;5;15m:\u001b[39m" "text": "\u001b[38;5;15m \u001b[39m\u001b[38;5;81mif\u001b[39m\u001b[38;5;15m \u001b[39m\u001b[38;5;15mn\u001b[39m\u001b[38;5;15m \u001b[39m\u001b[38;5;204m>\u001b[39m\u001b[38;5;15m \u001b[39m\u001b[38;5;141m0\u001b[39m\u001b[38;5;15m:\u001b[39m"
}, },
{ {
"type": "line", "type": "line",
"is_current": true, "is_current": true,
"lineno": 8, "lineno": 8,
"text": "\u001b[38;5;15m \u001b[39m\u001b[38;5;81mreturn\u001b[39m\u001b[38;5;15m \u001b[39m\u001b[38;5;15;48;5;24mfoo\u001b[39;49m\u001b[38;5;15;48;5;24m(\u001b[39;49m\u001b[38;5;15;48;5;24mn\u001b[39;49m\u001b[38;5;15;48;5;24m \u001b[39;49m\u001b[38;5;197;48;5;24m-\u001b[39;49m\u001b[38;5;15;48;5;24m \u001b[39;49m\u001b[38;5;141;48;5;24m1\u001b[39;49m\u001b[38;5;15;48;5;24m)\u001b[39;49m" "text": "\u001b[38;5;15m \u001b[39m\u001b[38;5;81mreturn\u001b[39m\u001b[38;5;15m \u001b[39m\u001b[38;5;15;48;5;24mfoo\u001b[39;49m\u001b[38;5;15;48;5;24m(\u001b[39;49m\u001b[38;5;15;48;5;24mn\u001b[39;49m\u001b[38;5;15;48;5;24m \u001b[39;49m\u001b[38;5;204;48;5;24m-\u001b[39;49m\u001b[38;5;15;48;5;24m \u001b[39;49m\u001b[38;5;141;48;5;24m1\u001b[39;49m\u001b[38;5;15;48;5;24m)\u001b[39;49m"
}, },
{ {
"type": "line", "type": "line",
"is_current": false, "is_current": false,
"lineno": 9, "lineno": 9,
"text": "\u001b[38;5;15m \u001b[39m\u001b[38;5;15mx\u001b[39m\u001b[38;5;15m \u001b[39m\u001b[38;5;197m=\u001b[39m\u001b[38;5;15m \u001b[39m\u001b[38;5;141m1\u001b[39m" "text": "\u001b[38;5;15m \u001b[39m\u001b[38;5;15mx\u001b[39m\u001b[38;5;15m \u001b[39m\u001b[38;5;204m=\u001b[39m\u001b[38;5;15m \u001b[39m\u001b[38;5;141m1\u001b[39m"
} }
], ],
"variables": [ "variables": [
...@@ -878,25 +878,25 @@ ...@@ -878,25 +878,25 @@
"type": "line", "type": "line",
"is_current": false, "is_current": false,
"lineno": 6, "lineno": 6,
"text": "\u001b[38;5;81mdef\u001b[39m\u001b[38;5;15m \u001b[39m\u001b[38;5;148mfoo\u001b[39m\u001b[38;5;15m(\u001b[39m\u001b[38;5;15mn\u001b[39m\u001b[38;5;197m=\u001b[39m\u001b[38;5;141m5\u001b[39m\u001b[38;5;15m)\u001b[39m\u001b[38;5;15m:\u001b[39m" "text": "\u001b[38;5;81mdef\u001b[39m\u001b[38;5;15m \u001b[39m\u001b[38;5;148mfoo\u001b[39m\u001b[38;5;15m(\u001b[39m\u001b[38;5;15mn\u001b[39m\u001b[38;5;204m=\u001b[39m\u001b[38;5;141m5\u001b[39m\u001b[38;5;15m)\u001b[39m\u001b[38;5;15m:\u001b[39m"
}, },
{ {
"type": "line", "type": "line",
"is_current": false, "is_current": false,
"lineno": 7, "lineno": 7,
"text": "\u001b[38;5;15m \u001b[39m\u001b[38;5;81mif\u001b[39m\u001b[38;5;15m \u001b[39m\u001b[38;5;15mn\u001b[39m\u001b[38;5;15m \u001b[39m\u001b[38;5;197m>\u001b[39m\u001b[38;5;15m \u001b[39m\u001b[38;5;141m0\u001b[39m\u001b[38;5;15m:\u001b[39m" "text": "\u001b[38;5;15m \u001b[39m\u001b[38;5;81mif\u001b[39m\u001b[38;5;15m \u001b[39m\u001b[38;5;15mn\u001b[39m\u001b[38;5;15m \u001b[39m\u001b[38;5;204m>\u001b[39m\u001b[38;5;15m \u001b[39m\u001b[38;5;141m0\u001b[39m\u001b[38;5;15m:\u001b[39m"
}, },
{ {
"type": "line", "type": "line",
"is_current": true, "is_current": true,
"lineno": 8, "lineno": 8,
"text": "\u001b[38;5;15m \u001b[39m\u001b[38;5;81mreturn\u001b[39m\u001b[38;5;15m \u001b[39m\u001b[38;5;15;48;5;24mfoo\u001b[39;49m\u001b[38;5;15;48;5;24m(\u001b[39;49m\u001b[38;5;15;48;5;24mn\u001b[39;49m\u001b[38;5;15;48;5;24m \u001b[39;49m\u001b[38;5;197;48;5;24m-\u001b[39;49m\u001b[38;5;15;48;5;24m \u001b[39;49m\u001b[38;5;141;48;5;24m1\u001b[39;49m\u001b[38;5;15;48;5;24m)\u001b[39;49m" "text": "\u001b[38;5;15m \u001b[39m\u001b[38;5;81mreturn\u001b[39m\u001b[38;5;15m \u001b[39m\u001b[38;5;15;48;5;24mfoo\u001b[39;49m\u001b[38;5;15;48;5;24m(\u001b[39;49m\u001b[38;5;15;48;5;24mn\u001b[39;49m\u001b[38;5;15;48;5;24m \u001b[39;49m\u001b[38;5;204;48;5;24m-\u001b[39;49m\u001b[38;5;15;48;5;24m \u001b[39;49m\u001b[38;5;141;48;5;24m1\u001b[39;49m\u001b[38;5;15;48;5;24m)\u001b[39;49m"
}, },
{ {
"type": "line", "type": "line",
"is_current": false, "is_current": false,
"lineno": 9, "lineno": 9,
"text": "\u001b[38;5;15m \u001b[39m\u001b[38;5;15mx\u001b[39m\u001b[38;5;15m \u001b[39m\u001b[38;5;197m=\u001b[39m\u001b[38;5;15m \u001b[39m\u001b[38;5;141m1\u001b[39m" "text": "\u001b[38;5;15m \u001b[39m\u001b[38;5;15mx\u001b[39m\u001b[38;5;15m \u001b[39m\u001b[38;5;204m=\u001b[39m\u001b[38;5;15m \u001b[39m\u001b[38;5;141m1\u001b[39m"
} }
], ],
"variables": [ "variables": [
...@@ -934,25 +934,25 @@ ...@@ -934,25 +934,25 @@
"type": "line", "type": "line",
"is_current": false, "is_current": false,
"lineno": 6, "lineno": 6,
"text": "\u001b[38;5;81mdef\u001b[39m\u001b[38;5;15m \u001b[39m\u001b[38;5;148mfoo\u001b[39m\u001b[38;5;15m(\u001b[39m\u001b[38;5;15mn\u001b[39m\u001b[38;5;197m=\u001b[39m\u001b[38;5;141m5\u001b[39m\u001b[38;5;15m)\u001b[39m\u001b[38;5;15m:\u001b[39m" "text": "\u001b[38;5;81mdef\u001b[39m\u001b[38;5;15m \u001b[39m\u001b[38;5;148mfoo\u001b[39m\u001b[38;5;15m(\u001b[39m\u001b[38;5;15mn\u001b[39m\u001b[38;5;204m=\u001b[39m\u001b[38;5;141m5\u001b[39m\u001b[38;5;15m)\u001b[39m\u001b[38;5;15m:\u001b[39m"
}, },
{ {
"type": "line", "type": "line",
"is_current": false, "is_current": false,
"lineno": 7, "lineno": 7,
"text": "\u001b[38;5;15m \u001b[39m\u001b[38;5;81mif\u001b[39m\u001b[38;5;15m \u001b[39m\u001b[38;5;15mn\u001b[39m\u001b[38;5;15m \u001b[39m\u001b[38;5;197m>\u001b[39m\u001b[38;5;15m \u001b[39m\u001b[38;5;141m0\u001b[39m\u001b[38;5;15m:\u001b[39m" "text": "\u001b[38;5;15m \u001b[39m\u001b[38;5;81mif\u001b[39m\u001b[38;5;15m \u001b[39m\u001b[38;5;15mn\u001b[39m\u001b[38;5;15m \u001b[39m\u001b[38;5;204m>\u001b[39m\u001b[38;5;15m \u001b[39m\u001b[38;5;141m0\u001b[39m\u001b[38;5;15m:\u001b[39m"
}, },
{ {
"type": "line", "type": "line",
"is_current": true, "is_current": true,
"lineno": 8, "lineno": 8,
"text": "\u001b[38;5;15m \u001b[39m\u001b[38;5;81mreturn\u001b[39m\u001b[38;5;15m \u001b[39m\u001b[38;5;15;48;5;24mfoo\u001b[39;49m\u001b[38;5;15;48;5;24m(\u001b[39;49m\u001b[38;5;15;48;5;24mn\u001b[39;49m\u001b[38;5;15;48;5;24m \u001b[39;49m\u001b[38;5;197;48;5;24m-\u001b[39;49m\u001b[38;5;15;48;5;24m \u001b[39;49m\u001b[38;5;141;48;5;24m1\u001b[39;49m\u001b[38;5;15;48;5;24m)\u001b[39;49m" "text": "\u001b[38;5;15m \u001b[39m\u001b[38;5;81mreturn\u001b[39m\u001b[38;5;15m \u001b[39m\u001b[38;5;15;48;5;24mfoo\u001b[39;49m\u001b[38;5;15;48;5;24m(\u001b[39;49m\u001b[38;5;15;48;5;24mn\u001b[39;49m\u001b[38;5;15;48;5;24m \u001b[39;49m\u001b[38;5;204;48;5;24m-\u001b[39;49m\u001b[38;5;15;48;5;24m \u001b[39;49m\u001b[38;5;141;48;5;24m1\u001b[39;49m\u001b[38;5;15;48;5;24m)\u001b[39;49m"
}, },
{ {
"type": "line", "type": "line",
"is_current": false, "is_current": false,
"lineno": 9, "lineno": 9,
"text": "\u001b[38;5;15m \u001b[39m\u001b[38;5;15mx\u001b[39m\u001b[38;5;15m \u001b[39m\u001b[38;5;197m=\u001b[39m\u001b[38;5;15m \u001b[39m\u001b[38;5;141m1\u001b[39m" "text": "\u001b[38;5;15m \u001b[39m\u001b[38;5;15mx\u001b[39m\u001b[38;5;15m \u001b[39m\u001b[38;5;204m=\u001b[39m\u001b[38;5;15m \u001b[39m\u001b[38;5;141m1\u001b[39m"
} }
], ],
"variables": [ "variables": [
...@@ -986,7 +986,7 @@ ...@@ -986,7 +986,7 @@
"type": "line", "type": "line",
"is_current": false, "is_current": false,
"lineno": 24, "lineno": 24,
"text": "\u001b[38;5;15m \u001b[39m\u001b[38;5;81mreturn\u001b[39m\u001b[38;5;15m \u001b[39m\u001b[38;5;141m1\u001b[39m\u001b[38;5;15m \u001b[39m\u001b[38;5;197m/\u001b[39m\u001b[38;5;15m \u001b[39m\u001b[38;5;141m0\u001b[39m" "text": "\u001b[38;5;15m \u001b[39m\u001b[38;5;81mreturn\u001b[39m\u001b[38;5;15m \u001b[39m\u001b[38;5;141m1\u001b[39m\u001b[38;5;15m \u001b[39m\u001b[38;5;204m/\u001b[39m\u001b[38;5;15m \u001b[39m\u001b[38;5;141m0\u001b[39m"
}, },
{ {
"type": "line", "type": "line",
...@@ -998,7 +998,7 @@ ...@@ -998,7 +998,7 @@
"type": "line", "type": "line",
"is_current": true, "is_current": true,
"lineno": 26, "lineno": 26,
"text": "\u001b[38;5;15m \u001b[39m\u001b[38;5;81mraise\u001b[39m\u001b[38;5;15m \u001b[39m\u001b[38;5;148mTypeError\u001b[39m\u001b[38;5;15m \u001b[39m\u001b[38;5;197mfrom\u001b[39m\u001b[38;5;15m \u001b[39m\u001b[38;5;15me\u001b[39m" "text": "\u001b[38;5;15m \u001b[39m\u001b[38;5;81mraise\u001b[39m\u001b[38;5;15m \u001b[39m\u001b[38;5;148mTypeError\u001b[39m\u001b[38;5;15m \u001b[39m\u001b[38;5;204mfrom\u001b[39m\u001b[38;5;15m \u001b[39m\u001b[38;5;15me\u001b[39m"
} }
], ],
"variables": [ "variables": [
......
...@@ -484,7 +484,7 @@ def sys_modules_sources(): ...@@ -484,7 +484,7 @@ def sys_modules_sources():
for module in list(sys.modules.values()): for module in list(sys.modules.values()):
try: try:
filename = inspect.getsourcefile(module) filename = inspect.getsourcefile(module)
except TypeError: except (TypeError, AttributeError):
continue continue
if not filename: if not filename:
...@@ -630,7 +630,7 @@ x = 1 ...@@ -630,7 +630,7 @@ x = 1
""" """
@pytest.mark.skipif(pygments_version < (2, 12), reason="Different output in older Pygments") @pytest.mark.skipif(pygments_version < (2, 14), reason="Different output in older Pygments")
def test_pygments_example(): def test_pygments_example():
from .samples.pygments_example import bar from .samples.pygments_example import bar
result = bar() result = bar()
...@@ -670,32 +670,32 @@ Terminal256Formatter <class \'stack_data.core.style_with_executing_node.<locals> ...@@ -670,32 +670,32 @@ Terminal256Formatter <class \'stack_data.core.style_with_executing_node.<locals>
TerminalFormatter native: TerminalFormatter native:
13 | \x1b[34mdef\x1b[39;49;00m \x1b[32mbar\x1b[39;49;00m(): 13 | \x1b[34mdef\x1b[39;49;00m \x1b[32mbar\x1b[39;49;00m():\x1b[37m\x1b[39;49;00m
14 | x = \x1b[34m1\x1b[39;49;00m 14 | x = \x1b[34m1\x1b[39;49;00m\x1b[37m\x1b[39;49;00m
15 | \x1b[36mstr\x1b[39;49;00m(x) 15 | \x1b[36mstr\x1b[39;49;00m(x)\x1b[37m\x1b[39;49;00m
17 | \x1b[90m@deco\x1b[39;49;00m 17 | \x1b[90m@deco\x1b[39;49;00m\x1b[37m\x1b[39;49;00m
18 | \x1b[34mdef\x1b[39;49;00m \x1b[32mfoo\x1b[39;49;00m(): 18 | \x1b[34mdef\x1b[39;49;00m \x1b[32mfoo\x1b[39;49;00m():\x1b[37m\x1b[39;49;00m
19 | \x1b[34mpass\x1b[39;49;00m 19 | \x1b[34mpass\x1b[39;49;00m\x1b[37m\x1b[39;49;00m
----- -----
25 | \x1b[34mdef\x1b[39;49;00m \x1b[32mdeco\x1b[39;49;00m(f): 25 | \x1b[34mdef\x1b[39;49;00m \x1b[32mdeco\x1b[39;49;00m(f):\x1b[37m\x1b[39;49;00m
26 | f.result = print_stack() 26 | f.result = print_stack()\x1b[37m\x1b[39;49;00m
27 | \x1b[34mreturn\x1b[39;49;00m f 27 | \x1b[34mreturn\x1b[39;49;00m f\x1b[37m\x1b[39;49;00m
----- -----
==================== ====================
TerminalFormatter <class \'stack_data.core.style_with_executing_node.<locals>.NewStyle\'>: TerminalFormatter <class \'stack_data.core.style_with_executing_node.<locals>.NewStyle\'>:
13 | \x1b[34mdef\x1b[39;49;00m \x1b[32mbar\x1b[39;49;00m(): 13 | \x1b[34mdef\x1b[39;49;00m \x1b[32mbar\x1b[39;49;00m():\x1b[37m\x1b[39;49;00m
14 | x = \x1b[34m1\x1b[39;49;00m 14 | x = \x1b[34m1\x1b[39;49;00m\x1b[37m\x1b[39;49;00m
15 | \x1b[36mstr\x1b[39;49;00m(x) 15 | \x1b[36mstr\x1b[39;49;00m(x)\x1b[37m\x1b[39;49;00m
17 | \x1b[90m@deco\x1b[39;49;00m 17 | \x1b[90m@deco\x1b[39;49;00m\x1b[37m\x1b[39;49;00m
18 | \x1b[34mdef\x1b[39;49;00m \x1b[32mfoo\x1b[39;49;00m(): 18 | \x1b[34mdef\x1b[39;49;00m \x1b[32mfoo\x1b[39;49;00m():\x1b[37m\x1b[39;49;00m
19 | \x1b[34mpass\x1b[39;49;00m 19 | \x1b[34mpass\x1b[39;49;00m\x1b[37m\x1b[39;49;00m
----- -----
25 | \x1b[34mdef\x1b[39;49;00m \x1b[32mdeco\x1b[39;49;00m(f): 25 | \x1b[34mdef\x1b[39;49;00m \x1b[32mdeco\x1b[39;49;00m(f):\x1b[37m\x1b[39;49;00m
26 | f.result = print_stack() 26 | f.result = print_stack()\x1b[37m\x1b[39;49;00m
27 | \x1b[34mreturn\x1b[39;49;00m f 27 | \x1b[34mreturn\x1b[39;49;00m f\x1b[37m\x1b[39;49;00m
----- -----
==================== ====================
...@@ -753,9 +753,9 @@ HtmlFormatter <class \'stack_data.core.style_with_executing_node.<locals>.NewSty ...@@ -753,9 +753,9 @@ HtmlFormatter <class \'stack_data.core.style_with_executing_node.<locals>.NewSty
13 | <span class="k">def</span> <span class="nf">bar</span><span class="p">():</span> 13 | <span class="k">def</span> <span class="nf">bar</span><span class="p">():</span>
14 | <span class="n">x</span> <span class="o">=</span> <span class="mi">1</span> 14 | <span class="n">x</span> <span class="o">=</span> <span class="mi">1</span>
15 | <span class="nb">str</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> 15 | <span class="nb">str</span><span class="p">(</span><span class="n">x</span><span class="p">)</span>
17 | <span class=" -ExecutingNode"> </span><span class="nd nd-ExecutingNode">@deco</span><span class=" -ExecutingNode"></span> 17 | <span class=" -ExecutingNode"> </span><span class="nd nd-ExecutingNode">@deco</span>
18 | <span class=" -ExecutingNode"> </span><span class="k k-ExecutingNode">def</span><span class=" -ExecutingNode"> </span><span class="nf nf-ExecutingNode">foo</span><span class="p p-ExecutingNode">():</span><span class=" -ExecutingNode"></span> 18 | <span class=" -ExecutingNode"> </span><span class="k k-ExecutingNode">def</span><span class=" -ExecutingNode"> </span><span class="nf nf-ExecutingNode">foo</span><span class="p p-ExecutingNode">():</span>
19 | <span class=" -ExecutingNode"> </span><span class="k k-ExecutingNode">pass</span><span class=" -ExecutingNode"></span> 19 | <span class=" -ExecutingNode"> </span><span class="k k-ExecutingNode">pass</span>
----- -----
25 | <span class="k">def</span> <span class="nf">deco</span><span class="p">(</span><span class="n">f</span><span class="p">):</span> 25 | <span class="k">def</span> <span class="nf">deco</span><span class="p">(</span><span class="n">f</span><span class="p">):</span>
26 | <span class="n">f</span><span class="o">.</span><span class="n">result</span> <span class="o">=</span> <span class="n n-ExecutingNode">print_stack</span><span class="p p-ExecutingNode">()</span> 26 | <span class="n">f</span><span class="o">.</span><span class="n">result</span> <span class="o">=</span> <span class="n n-ExecutingNode">print_stack</span><span class="p p-ExecutingNode">()</span>
......
...@@ -3,8 +3,9 @@ import re ...@@ -3,8 +3,9 @@ import re
import sys import sys
from contextlib import contextmanager from contextlib import contextmanager
import pytest
import pygments import pygments
import pytest
from asttokens.util import fstring_positions_work
from stack_data import Formatter, FrameInfo, Options, BlankLines from stack_data import Formatter, FrameInfo, Options, BlankLines
from tests.utils import compare_to_file from tests.utils import compare_to_file
...@@ -82,8 +83,7 @@ def test_example(capsys): ...@@ -82,8 +83,7 @@ def test_example(capsys):
if sys.version_info[:2] < (3, 8): if sys.version_info[:2] < (3, 8):
f_string_suffix = 'old' f_string_suffix = 'old'
elif sys.version_info[:2] == (3, 8): elif not fstring_positions_work():
# lineno/col_offset in f-strings cannot be trusted in 3.8
f_string_suffix = '3.8' f_string_suffix = '3.8'
else: else:
f_string_suffix = 'new' f_string_suffix = 'new'
......
...@@ -39,4 +39,4 @@ def test_example(): ...@@ -39,4 +39,4 @@ def test_example():
) )
compare_to_file_json(result, "serialize") compare_to_file_json(result, "serialize", pygmented=True)
import os import os
import pygments
from littleutils import string_to_file, file_to_string, json_to_file, file_to_json from littleutils import string_to_file, file_to_string, json_to_file, file_to_json
def parse_version(version: str):
return tuple(int(x) for x in version.split("."))
old_pygments = parse_version(pygments.__version__) < (2, 16, 1)
def compare_to_file(text, name): def compare_to_file(text, name):
if old_pygments and "pygment" in name:
return
filename = os.path.join( filename = os.path.join(
os.path.dirname(__file__), os.path.dirname(__file__),
'golden_files', 'golden_files',
...@@ -16,7 +26,9 @@ def compare_to_file(text, name): ...@@ -16,7 +26,9 @@ def compare_to_file(text, name):
assert text == expected_output assert text == expected_output
def compare_to_file_json(data, name): def compare_to_file_json(data, name, *, pygmented):
if old_pygments and pygmented:
return
filename = os.path.join( filename = os.path.join(
os.path.dirname(__file__), os.path.dirname(__file__),
'golden_files', 'golden_files',
......
[tox] [tox]
envlist = py{36,37,38,39,310,311} envlist = py{36,37,38,39,310,311,312}
[testenv] [testenv]
commands = pytest {posargs} commands = pytest {posargs}
extras = tests extras = tests
passenv = passenv =
STACK_DATA_SLOW_TESTS STACK_DATA_SLOW_TESTS
FIX_STACK_DATA_TESTS
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment