List Testdir members in the docs
Also include docstrings pointing to the counterparts in Pytester. Fix #7892
This commit is contained in:
		
							parent
							
								
									69419cb700
								
							
						
					
					
						commit
						3cae145e41
					
				|  | @ -530,6 +530,9 @@ To use it, include in your topmost ``conftest.py`` file: | ||||||
| .. autoclass:: LineMatcher() | .. autoclass:: LineMatcher() | ||||||
|     :members: |     :members: | ||||||
| 
 | 
 | ||||||
|  | .. autoclass:: HookRecorder() | ||||||
|  |     :members: | ||||||
|  | 
 | ||||||
| .. fixture:: testdir | .. fixture:: testdir | ||||||
| 
 | 
 | ||||||
| testdir | testdir | ||||||
|  | @ -540,6 +543,10 @@ legacy ``py.path.local`` objects instead when applicable. | ||||||
| 
 | 
 | ||||||
| New code should avoid using :fixture:`testdir` in favor of :fixture:`pytester`. | New code should avoid using :fixture:`testdir` in favor of :fixture:`pytester`. | ||||||
| 
 | 
 | ||||||
|  | .. autoclass:: Testdir() | ||||||
|  |     :members: | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| .. fixture:: recwarn | .. fixture:: recwarn | ||||||
| 
 | 
 | ||||||
| recwarn | recwarn | ||||||
|  |  | ||||||
|  | @ -1494,6 +1494,7 @@ class Testdir: | ||||||
| 
 | 
 | ||||||
|     @property |     @property | ||||||
|     def tmpdir(self) -> py.path.local: |     def tmpdir(self) -> py.path.local: | ||||||
|  |         """Temporary directory where tests are executed.""" | ||||||
|         return py.path.local(self._pytester.path) |         return py.path.local(self._pytester.path) | ||||||
| 
 | 
 | ||||||
|     @property |     @property | ||||||
|  | @ -1517,89 +1518,117 @@ class Testdir: | ||||||
|         return self._pytester._monkeypatch |         return self._pytester._monkeypatch | ||||||
| 
 | 
 | ||||||
|     def make_hook_recorder(self, pluginmanager) -> HookRecorder: |     def make_hook_recorder(self, pluginmanager) -> HookRecorder: | ||||||
|  |         """See :meth:`Pytester.make_hook_recorder`.""" | ||||||
|         return self._pytester.make_hook_recorder(pluginmanager) |         return self._pytester.make_hook_recorder(pluginmanager) | ||||||
| 
 | 
 | ||||||
|     def chdir(self) -> None: |     def chdir(self) -> None: | ||||||
|  |         """See :meth:`Pytester.chdir`.""" | ||||||
|         return self._pytester.chdir() |         return self._pytester.chdir() | ||||||
| 
 | 
 | ||||||
|     def finalize(self) -> None: |     def finalize(self) -> None: | ||||||
|  |         """See :meth:`Pytester._finalize`.""" | ||||||
|         return self._pytester._finalize() |         return self._pytester._finalize() | ||||||
| 
 | 
 | ||||||
|     def makefile(self, ext, *args, **kwargs) -> py.path.local: |     def makefile(self, ext, *args, **kwargs) -> py.path.local: | ||||||
|  |         """See :meth:`Pytester.makefile`.""" | ||||||
|         return py.path.local(str(self._pytester.makefile(ext, *args, **kwargs))) |         return py.path.local(str(self._pytester.makefile(ext, *args, **kwargs))) | ||||||
| 
 | 
 | ||||||
|     def makeconftest(self, source) -> py.path.local: |     def makeconftest(self, source) -> py.path.local: | ||||||
|  |         """See :meth:`Pytester.makeconftest`.""" | ||||||
|         return py.path.local(str(self._pytester.makeconftest(source))) |         return py.path.local(str(self._pytester.makeconftest(source))) | ||||||
| 
 | 
 | ||||||
|     def makeini(self, source) -> py.path.local: |     def makeini(self, source) -> py.path.local: | ||||||
|  |         """See :meth:`Pytester.makeini`.""" | ||||||
|         return py.path.local(str(self._pytester.makeini(source))) |         return py.path.local(str(self._pytester.makeini(source))) | ||||||
| 
 | 
 | ||||||
|     def getinicfg(self, source) -> py.path.local: |     def getinicfg(self, source) -> py.path.local: | ||||||
|  |         """See :meth:`Pytester.getinicfg`.""" | ||||||
|         return py.path.local(str(self._pytester.getinicfg(source))) |         return py.path.local(str(self._pytester.getinicfg(source))) | ||||||
| 
 | 
 | ||||||
|     def makepyprojecttoml(self, source) -> py.path.local: |     def makepyprojecttoml(self, source) -> py.path.local: | ||||||
|  |         """See :meth:`Pytester.makepyprojecttoml`.""" | ||||||
|         return py.path.local(str(self._pytester.makepyprojecttoml(source))) |         return py.path.local(str(self._pytester.makepyprojecttoml(source))) | ||||||
| 
 | 
 | ||||||
|     def makepyfile(self, *args, **kwargs) -> py.path.local: |     def makepyfile(self, *args, **kwargs) -> py.path.local: | ||||||
|  |         """See :meth:`Pytester.makepyfile`.""" | ||||||
|         return py.path.local(str(self._pytester.makepyfile(*args, **kwargs))) |         return py.path.local(str(self._pytester.makepyfile(*args, **kwargs))) | ||||||
| 
 | 
 | ||||||
|     def maketxtfile(self, *args, **kwargs) -> py.path.local: |     def maketxtfile(self, *args, **kwargs) -> py.path.local: | ||||||
|  |         """See :meth:`Pytester.maketxtfile`.""" | ||||||
|         return py.path.local(str(self._pytester.maketxtfile(*args, **kwargs))) |         return py.path.local(str(self._pytester.maketxtfile(*args, **kwargs))) | ||||||
| 
 | 
 | ||||||
|     def syspathinsert(self, path=None) -> None: |     def syspathinsert(self, path=None) -> None: | ||||||
|  |         """See :meth:`Pytester.syspathinsert`.""" | ||||||
|         return self._pytester.syspathinsert(path) |         return self._pytester.syspathinsert(path) | ||||||
| 
 | 
 | ||||||
|     def mkdir(self, name) -> py.path.local: |     def mkdir(self, name) -> py.path.local: | ||||||
|  |         """See :meth:`Pytester.mkdir`.""" | ||||||
|         return py.path.local(str(self._pytester.mkdir(name))) |         return py.path.local(str(self._pytester.mkdir(name))) | ||||||
| 
 | 
 | ||||||
|     def mkpydir(self, name) -> py.path.local: |     def mkpydir(self, name) -> py.path.local: | ||||||
|  |         """See :meth:`Pytester.mkpydir`.""" | ||||||
|         return py.path.local(str(self._pytester.mkpydir(name))) |         return py.path.local(str(self._pytester.mkpydir(name))) | ||||||
| 
 | 
 | ||||||
|     def copy_example(self, name=None) -> py.path.local: |     def copy_example(self, name=None) -> py.path.local: | ||||||
|  |         """See :meth:`Pytester.copy_example`.""" | ||||||
|         return py.path.local(str(self._pytester.copy_example(name))) |         return py.path.local(str(self._pytester.copy_example(name))) | ||||||
| 
 | 
 | ||||||
|     def getnode(self, config: Config, arg) -> Optional[Union[Item, Collector]]: |     def getnode(self, config: Config, arg) -> Optional[Union[Item, Collector]]: | ||||||
|  |         """See :meth:`Pytester.getnode`.""" | ||||||
|         return self._pytester.getnode(config, arg) |         return self._pytester.getnode(config, arg) | ||||||
| 
 | 
 | ||||||
|     def getpathnode(self, path): |     def getpathnode(self, path): | ||||||
|  |         """See :meth:`Pytester.getpathnode`.""" | ||||||
|         return self._pytester.getpathnode(path) |         return self._pytester.getpathnode(path) | ||||||
| 
 | 
 | ||||||
|     def genitems(self, colitems: List[Union[Item, Collector]]) -> List[Item]: |     def genitems(self, colitems: List[Union[Item, Collector]]) -> List[Item]: | ||||||
|  |         """See :meth:`Pytester.genitems`.""" | ||||||
|         return self._pytester.genitems(colitems) |         return self._pytester.genitems(colitems) | ||||||
| 
 | 
 | ||||||
|     def runitem(self, source): |     def runitem(self, source): | ||||||
|  |         """See :meth:`Pytester.runitem`.""" | ||||||
|         return self._pytester.runitem(source) |         return self._pytester.runitem(source) | ||||||
| 
 | 
 | ||||||
|     def inline_runsource(self, source, *cmdlineargs): |     def inline_runsource(self, source, *cmdlineargs): | ||||||
|  |         """See :meth:`Pytester.inline_runsource`.""" | ||||||
|         return self._pytester.inline_runsource(source, *cmdlineargs) |         return self._pytester.inline_runsource(source, *cmdlineargs) | ||||||
| 
 | 
 | ||||||
|     def inline_genitems(self, *args): |     def inline_genitems(self, *args): | ||||||
|  |         """See :meth:`Pytester.inline_genitems`.""" | ||||||
|         return self._pytester.inline_genitems(*args) |         return self._pytester.inline_genitems(*args) | ||||||
| 
 | 
 | ||||||
|     def inline_run(self, *args, plugins=(), no_reraise_ctrlc: bool = False): |     def inline_run(self, *args, plugins=(), no_reraise_ctrlc: bool = False): | ||||||
|  |         """See :meth:`Pytester.inline_run`.""" | ||||||
|         return self._pytester.inline_run( |         return self._pytester.inline_run( | ||||||
|             *args, plugins=plugins, no_reraise_ctrlc=no_reraise_ctrlc |             *args, plugins=plugins, no_reraise_ctrlc=no_reraise_ctrlc | ||||||
|         ) |         ) | ||||||
| 
 | 
 | ||||||
|     def runpytest_inprocess(self, *args, **kwargs) -> RunResult: |     def runpytest_inprocess(self, *args, **kwargs) -> RunResult: | ||||||
|  |         """See :meth:`Pytester.runpytest_inprocess`.""" | ||||||
|         return self._pytester.runpytest_inprocess(*args, **kwargs) |         return self._pytester.runpytest_inprocess(*args, **kwargs) | ||||||
| 
 | 
 | ||||||
|     def runpytest(self, *args, **kwargs) -> RunResult: |     def runpytest(self, *args, **kwargs) -> RunResult: | ||||||
|  |         """See :meth:`Pytester.runpytest`.""" | ||||||
|         return self._pytester.runpytest(*args, **kwargs) |         return self._pytester.runpytest(*args, **kwargs) | ||||||
| 
 | 
 | ||||||
|     def parseconfig(self, *args) -> Config: |     def parseconfig(self, *args) -> Config: | ||||||
|  |         """See :meth:`Pytester.parseconfig`.""" | ||||||
|         return self._pytester.parseconfig(*args) |         return self._pytester.parseconfig(*args) | ||||||
| 
 | 
 | ||||||
|     def parseconfigure(self, *args) -> Config: |     def parseconfigure(self, *args) -> Config: | ||||||
|  |         """See :meth:`Pytester.parseconfigure`.""" | ||||||
|         return self._pytester.parseconfigure(*args) |         return self._pytester.parseconfigure(*args) | ||||||
| 
 | 
 | ||||||
|     def getitem(self, source, funcname="test_func"): |     def getitem(self, source, funcname="test_func"): | ||||||
|  |         """See :meth:`Pytester.getitem`.""" | ||||||
|         return self._pytester.getitem(source, funcname) |         return self._pytester.getitem(source, funcname) | ||||||
| 
 | 
 | ||||||
|     def getitems(self, source): |     def getitems(self, source): | ||||||
|  |         """See :meth:`Pytester.getitems`.""" | ||||||
|         return self._pytester.getitems(source) |         return self._pytester.getitems(source) | ||||||
| 
 | 
 | ||||||
|     def getmodulecol(self, source, configargs=(), withinit=False): |     def getmodulecol(self, source, configargs=(), withinit=False): | ||||||
|  |         """See :meth:`Pytester.getmodulecol`.""" | ||||||
|         return self._pytester.getmodulecol( |         return self._pytester.getmodulecol( | ||||||
|             source, configargs=configargs, withinit=withinit |             source, configargs=configargs, withinit=withinit | ||||||
|         ) |         ) | ||||||
|  | @ -1607,6 +1636,7 @@ class Testdir: | ||||||
|     def collect_by_name( |     def collect_by_name( | ||||||
|         self, modcol: Module, name: str |         self, modcol: Module, name: str | ||||||
|     ) -> Optional[Union[Item, Collector]]: |     ) -> Optional[Union[Item, Collector]]: | ||||||
|  |         """See :meth:`Pytester.collect_by_name`.""" | ||||||
|         return self._pytester.collect_by_name(modcol, name) |         return self._pytester.collect_by_name(modcol, name) | ||||||
| 
 | 
 | ||||||
|     def popen( |     def popen( | ||||||
|  | @ -1617,26 +1647,33 @@ class Testdir: | ||||||
|         stdin=CLOSE_STDIN, |         stdin=CLOSE_STDIN, | ||||||
|         **kw, |         **kw, | ||||||
|     ): |     ): | ||||||
|  |         """See :meth:`Pytester.popen`.""" | ||||||
|         return self._pytester.popen(cmdargs, stdout, stderr, stdin, **kw) |         return self._pytester.popen(cmdargs, stdout, stderr, stdin, **kw) | ||||||
| 
 | 
 | ||||||
|     def run(self, *cmdargs, timeout=None, stdin=CLOSE_STDIN) -> RunResult: |     def run(self, *cmdargs, timeout=None, stdin=CLOSE_STDIN) -> RunResult: | ||||||
|  |         """See :meth:`Pytester.run`.""" | ||||||
|         return self._pytester.run(*cmdargs, timeout=timeout, stdin=stdin) |         return self._pytester.run(*cmdargs, timeout=timeout, stdin=stdin) | ||||||
| 
 | 
 | ||||||
|     def runpython(self, script) -> RunResult: |     def runpython(self, script) -> RunResult: | ||||||
|  |         """See :meth:`Pytester.runpython`.""" | ||||||
|         return self._pytester.runpython(script) |         return self._pytester.runpython(script) | ||||||
| 
 | 
 | ||||||
|     def runpython_c(self, command): |     def runpython_c(self, command): | ||||||
|  |         """See :meth:`Pytester.runpython_c`.""" | ||||||
|         return self._pytester.runpython_c(command) |         return self._pytester.runpython_c(command) | ||||||
| 
 | 
 | ||||||
|     def runpytest_subprocess(self, *args, timeout=None) -> RunResult: |     def runpytest_subprocess(self, *args, timeout=None) -> RunResult: | ||||||
|  |         """See :meth:`Pytester.runpytest_subprocess`.""" | ||||||
|         return self._pytester.runpytest_subprocess(*args, timeout=timeout) |         return self._pytester.runpytest_subprocess(*args, timeout=timeout) | ||||||
| 
 | 
 | ||||||
|     def spawn_pytest( |     def spawn_pytest( | ||||||
|         self, string: str, expect_timeout: float = 10.0 |         self, string: str, expect_timeout: float = 10.0 | ||||||
|     ) -> "pexpect.spawn": |     ) -> "pexpect.spawn": | ||||||
|  |         """See :meth:`Pytester.spawn_pytest`.""" | ||||||
|         return self._pytester.spawn_pytest(string, expect_timeout=expect_timeout) |         return self._pytester.spawn_pytest(string, expect_timeout=expect_timeout) | ||||||
| 
 | 
 | ||||||
|     def spawn(self, cmd: str, expect_timeout: float = 10.0) -> "pexpect.spawn": |     def spawn(self, cmd: str, expect_timeout: float = 10.0) -> "pexpect.spawn": | ||||||
|  |         """See :meth:`Pytester.spawn`.""" | ||||||
|         return self._pytester.spawn(cmd, expect_timeout=expect_timeout) |         return self._pytester.spawn(cmd, expect_timeout=expect_timeout) | ||||||
| 
 | 
 | ||||||
|     def __repr__(self) -> str: |     def __repr__(self) -> str: | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue