1
1
import icdiff
2
+ from unittest import mock
3
+ import pytest
2
4
import re
3
5
from pprintpp import pformat
4
6
7
9
GREEN_ON = '\x1b [1;32m'
8
10
ANSI_ESCAPE_RE = re .compile (r'(\x9B|\x1B\[)[0-?]*[ -/]*[@-~]' )
9
11
12
+ @pytest .fixture
13
+ def with_80_col_terminal ():
14
+ # haven't found a better way to simulate terminal sizes
15
+ # at a lower level yet sadly.
16
+ with mock .patch ("pytest_icdiff.COLS" , 99 ):
17
+ yield
18
+
10
19
11
20
def test_short_dict (testdir ):
12
21
one = {
@@ -193,6 +202,7 @@ def test_a():
193
202
assert drilldown_expression in output
194
203
195
204
205
+ @pytest .mark .usefixtures ("with_80_col_terminal" )
196
206
def test_long_lines_in_comparators_are_wrapped_sensibly_multiline (testdir ):
197
207
left = {1 : "hello " * 20 , 2 : 'two' }
198
208
right = {1 : "hella " * 20 , 2 : 'two' }
@@ -207,6 +217,7 @@ def test_one():
207
217
assert comparison_line .count ('hell' ) < 13
208
218
209
219
220
+ @pytest .mark .usefixtures ("with_80_col_terminal" )
210
221
def test_long_lines_in_comparators_are_wrapped_sensibly_singleline (testdir ):
211
222
left = "hello " * 10
212
223
right = "hella " * 10
@@ -277,6 +288,7 @@ def test_one():
277
288
assert f"123456 123456{ GREEN_ON } 7" in output
278
289
279
290
291
+ @pytest .mark .usefixtures ("with_80_col_terminal" )
280
292
def test_really_long_diffs_use_context_mode (testdir ):
281
293
testdir .makepyfile (
282
294
f"""
0 commit comments