Merge pull request #3835 from wimglenn/issue3833

more autodocs for pytester
This commit is contained in:
Anthony Sottile 2018-08-20 00:30:28 -07:00 committed by GitHub
commit 308d789d92
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 9 deletions

1
changelog/3833.doc.rst Normal file
View File

@ -0,0 +1 @@
Added missing docs for ``pytester.Testdir``

View File

@ -460,7 +460,7 @@ To use it, include in your top-most ``conftest.py`` file::
.. autoclass:: Testdir() .. autoclass:: Testdir()
:members: runpytest,runpytest_subprocess,runpytest_inprocess,makeconftest,makepyfile :members:
.. autoclass:: RunResult() .. autoclass:: RunResult()
:members: :members:

View File

@ -550,18 +550,22 @@ class Testdir(object):
return ret return ret
def makefile(self, ext, *args, **kwargs): def makefile(self, ext, *args, **kwargs):
"""Create a new file in the testdir. r"""Create new file(s) in the testdir.
ext: The extension the file should use, including the dot, e.g. `.py`. :param str ext: The extension the file(s) should use, including the dot, e.g. `.py`.
:param list[str] args: All args will be treated as strings and joined using newlines.
args: All args will be treated as strings and joined using newlines.
The result will be written as contents to the file. The name of the The result will be written as contents to the file. The name of the
file will be based on the test function requesting this fixture. file will be based on the test function requesting this fixture.
E.g. "testdir.makefile('.txt', 'line1', 'line2')" :param kwargs: Each keyword is the name of a file, while the value of it will
kwargs: Each keyword is the name of a file, while the value of it will
be written as contents of the file. be written as contents of the file.
E.g. "testdir.makefile('.ini', pytest='[pytest]\naddopts=-rs\n')"
Examples:
.. code-block:: python
testdir.makefile(".txt", "line1", "line2")
testdir.makefile(".ini", pytest="[pytest]\naddopts=-rs\n")
""" """
return self._makefile(ext, args, kwargs) return self._makefile(ext, args, kwargs)