Skip to content

Commit 9e8526b

Browse files
committed
docs(pytest_plugin): Cleanup
1 parent adbcd0c commit 9e8526b

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

src/libtmux/pytest_plugin.py

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,10 @@ def server(
119119
... assert [session.name.startswith('my') for session in server.sessions]
120120
121121
.. ::
122-
123122
>>> locals().keys()
124123
dict_keys(...)
125124
126-
>>> source = ''.join([
127-
... example.source for example in request._pyfuncitem.dtest.examples
128-
... ][:3])
129-
125+
>>> source = ''.join([e.source for e in request._pyfuncitem.dtest.examples][:3])
130126
>>> pytester = request.getfixturevalue('pytester')
131127
132128
>>> pytester.makepyfile(**{'whatever.py': source})
@@ -161,18 +157,19 @@ def session(request: pytest.FixtureRequest, server: Server) -> "Session":
161157
... assert window.name == 'new one'
162158
163159
.. ::
160+
>>> locals().keys()
161+
dict_keys(...)
164162
165-
The nifty little thing above hides our pytester assertions from docs.
166-
167-
>>> import inspect
168-
163+
>>> source = ''.join([e.source for e in request._pyfuncitem.dtest.examples][:3])
169164
>>> pytester = request.getfixturevalue('pytester')
170165
171-
>>> test_mod = pytester.makepyfile(whatever=inspect.getsource(test_example))
172-
>>> result = pytester.inline_run(str(test_mod), '--disable-warnings')
166+
>>> pytester.makepyfile(**{'whatever.py': source})
167+
PosixPath(...)
168+
169+
>>> result = pytester.runpytest('whatever.py', '--disable-warnings')
173170
===...
174171
175-
>>> result.assertoutcome(passed=1)
172+
>>> result.assert_outcomes(passed=1)
176173
"""
177174
session_name = "tmuxp"
178175

0 commit comments

Comments
 (0)