Skip to content

Commit 810b878

Browse files
authored
Migrate to pytester: test_capture.py, test_terminal.py, approx.py (#8108)
* Migrate to pytester: test_capture.py, test_config.py, approx.py * migrate test_terminal.py * revert test_config.py * more typing in test_terminal.py * try-out 'tr' fixture update * revert 'tr' fixture, update test_config.py
1 parent 059f6ff commit 810b878

File tree

4 files changed

+928
-822
lines changed

4 files changed

+928
-822
lines changed

testing/python/approx.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from typing import Optional
88

99
import pytest
10+
from _pytest.pytester import Pytester
1011
from pytest import approx
1112

1213
inf, nan = float("inf"), float("nan")
@@ -456,20 +457,20 @@ def test_doctests(self, mocked_doctest_runner) -> None:
456457
)
457458
mocked_doctest_runner.run(test)
458459

459-
def test_unicode_plus_minus(self, testdir):
460+
def test_unicode_plus_minus(self, pytester: Pytester) -> None:
460461
"""
461462
Comparing approx instances inside lists should not produce an error in the detailed diff.
462463
Integration test for issue #2111.
463464
"""
464-
testdir.makepyfile(
465+
pytester.makepyfile(
465466
"""
466467
import pytest
467468
def test_foo():
468469
assert [3] == [pytest.approx(4)]
469470
"""
470471
)
471472
expected = "4.0e-06"
472-
result = testdir.runpytest()
473+
result = pytester.runpytest()
473474
result.stdout.fnmatch_lines(
474475
[f"*At index 0 diff: 3 != 4 ± {expected}", "=* 1 failed in *="]
475476
)

0 commit comments

Comments
 (0)