Skip to content

Commit acf27a6

Browse files
authored
doc: exclude Testdir.Session (#519)
* doc: exclude Testdir.Session `Testdir.Session` appears to be there for convenience only, and is used in internal tests. This patch excludes it from `Testdir`'s documentation, which causes duplicate cross-references for `Session` in Sphinx. * Move setting of Testdir.Session up
1 parent b348989 commit acf27a6

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

doc/en/reference.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,8 +512,9 @@ To use it, include in your top-most ``conftest.py`` file:
512512
513513
514514
515-
.. autoclass:: Testdir()
515+
.. autoclass:: Testdir
516516
:members:
517+
:exclude-members: Session
517518

518519
.. autoclass:: RunResult()
519520
:members:

src/_pytest/pytester/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,8 @@ class Testdir(Generic[AnyStr]):
601601
CLOSE_STDIN = CLOSE_STDIN
602602
"""Sentinel to close stdin."""
603603

604+
Session = Session
605+
604606
class TimeoutExpired(Exception):
605607
pass
606608

@@ -911,8 +913,6 @@ def copy_example(self, name=None):
911913
'example "{}" is not found as a file or directory'.format(example_path)
912914
)
913915

914-
Session = Session
915-
916916
def getnode(self, config, arg):
917917
"""Return the collection node of a file.
918918

0 commit comments

Comments
 (0)