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
This commit is contained in:
parent
059f6ff315
commit
810b878ef8
|
@ -7,6 +7,7 @@ from operator import ne
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
from _pytest.pytester import Pytester
|
||||||
from pytest import approx
|
from pytest import approx
|
||||||
|
|
||||||
inf, nan = float("inf"), float("nan")
|
inf, nan = float("inf"), float("nan")
|
||||||
|
@ -456,12 +457,12 @@ class TestApprox:
|
||||||
)
|
)
|
||||||
mocked_doctest_runner.run(test)
|
mocked_doctest_runner.run(test)
|
||||||
|
|
||||||
def test_unicode_plus_minus(self, testdir):
|
def test_unicode_plus_minus(self, pytester: Pytester) -> None:
|
||||||
"""
|
"""
|
||||||
Comparing approx instances inside lists should not produce an error in the detailed diff.
|
Comparing approx instances inside lists should not produce an error in the detailed diff.
|
||||||
Integration test for issue #2111.
|
Integration test for issue #2111.
|
||||||
"""
|
"""
|
||||||
testdir.makepyfile(
|
pytester.makepyfile(
|
||||||
"""
|
"""
|
||||||
import pytest
|
import pytest
|
||||||
def test_foo():
|
def test_foo():
|
||||||
|
@ -469,7 +470,7 @@ class TestApprox:
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
expected = "4.0e-06"
|
expected = "4.0e-06"
|
||||||
result = testdir.runpytest()
|
result = pytester.runpytest()
|
||||||
result.stdout.fnmatch_lines(
|
result.stdout.fnmatch_lines(
|
||||||
[f"*At index 0 diff: 3 != 4 ± {expected}", "=* 1 failed in *="]
|
[f"*At index 0 diff: 3 != 4 ± {expected}", "=* 1 failed in *="]
|
||||||
)
|
)
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue