From e620798d33346187005b44ab0ff96decd5b5e95a Mon Sep 17 00:00:00 2001 From: wim glenn Date: Sun, 19 Aug 2018 23:11:31 -0500 Subject: [PATCH 1/2] more autodocs for pytester --- changelog/3833.doc.rst | 1 + doc/en/reference.rst | 2 +- src/_pytest/pytester.py | 20 ++++++++++++-------- 3 files changed, 14 insertions(+), 9 deletions(-) create mode 100644 changelog/3833.doc.rst diff --git a/changelog/3833.doc.rst b/changelog/3833.doc.rst new file mode 100644 index 000000000..d74ee10b2 --- /dev/null +++ b/changelog/3833.doc.rst @@ -0,0 +1 @@ +Added missing docs for ``pytester.Testdir`` \ No newline at end of file diff --git a/doc/en/reference.rst b/doc/en/reference.rst index 86d92cf07..484c755da 100644 --- a/doc/en/reference.rst +++ b/doc/en/reference.rst @@ -460,7 +460,7 @@ To use it, include in your top-most ``conftest.py`` file:: .. autoclass:: Testdir() - :members: runpytest,runpytest_subprocess,runpytest_inprocess,makeconftest,makepyfile + :members: .. autoclass:: RunResult() :members: diff --git a/src/_pytest/pytester.py b/src/_pytest/pytester.py index 5b42b81ee..b40a9e267 100644 --- a/src/_pytest/pytester.py +++ b/src/_pytest/pytester.py @@ -550,18 +550,22 @@ class Testdir(object): return ret 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`. - - args: All args will be treated as strings and joined using newlines. + :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. 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. - E.g. "testdir.makefile('.txt', 'line1', 'line2')" - - kwargs: Each keyword is the name of a file, while the value of it will + :param kwargs: Each keyword is the name of a file, while the value of it will 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) From e4bea9068bf800f1610b228457232cbdfd949343 Mon Sep 17 00:00:00 2001 From: wim glenn Date: Sun, 19 Aug 2018 23:39:10 -0500 Subject: [PATCH 2/2] end of line for this file, perhaps? --- changelog/3833.doc.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog/3833.doc.rst b/changelog/3833.doc.rst index d74ee10b2..254e2e4b6 100644 --- a/changelog/3833.doc.rst +++ b/changelog/3833.doc.rst @@ -1 +1 @@ -Added missing docs for ``pytester.Testdir`` \ No newline at end of file +Added missing docs for ``pytester.Testdir``