Skip to content

Commit 7a69365

Browse files
committed
Move TWMock class to a fixture
Using a relative import like before was not very nice
1 parent 3c82b1c commit 7a69365

File tree

3 files changed

+194
-203
lines changed

3 files changed

+194
-203
lines changed

testing/code/test_code.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import sys
22
from unittest import mock
33

4-
from test_excinfo import TWMock
5-
64
import _pytest._code
75
import pytest
86

@@ -168,17 +166,15 @@ def test_getsource(self):
168166

169167

170168
class TestReprFuncArgs:
171-
def test_not_raise_exception_with_mixed_encoding(self):
169+
def test_not_raise_exception_with_mixed_encoding(self, tw_mock):
172170
from _pytest._code.code import ReprFuncArgs
173171

174-
tw = TWMock()
175-
176172
args = [("unicode_string", "São Paulo"), ("utf8_string", b"S\xc3\xa3o Paulo")]
177173

178174
r = ReprFuncArgs(args)
179-
r.toterminal(tw)
175+
r.toterminal(tw_mock)
180176

181177
assert (
182-
tw.lines[0]
178+
tw_mock.lines[0]
183179
== r"unicode_string = São Paulo, utf8_string = b'S\xc3\xa3o Paulo'"
184180
)

0 commit comments

Comments
 (0)