@@ -687,11 +687,41 @@ def getinicfg(self, source):
687
687
return py .iniconfig .IniConfig (p )["pytest" ]
688
688
689
689
def makepyfile (self , * args , ** kwargs ):
690
- """Shortcut for .makefile() with a .py extension."""
690
+ r"""Shortcut for .makefile() with a .py extension.
691
+ Defaults to the test name with a '.py' extension, e.g test_foobar.py, overwriting
692
+ existing files.
693
+
694
+ Examples:
695
+
696
+ .. code-block:: python
697
+
698
+ def test_something(testdir):
699
+ # initial file is created test_something.py
700
+ testdir.makepyfile("foobar")
701
+ # to create multiple files, pass kwargs accordingly
702
+ testdir.makepyfile(custom="foobar")
703
+ # at this point, both 'test_something.py' & 'custom.py' exist in the test directory
704
+
705
+ """
691
706
return self ._makefile (".py" , args , kwargs )
692
707
693
708
def maketxtfile (self , * args , ** kwargs ):
694
- """Shortcut for .makefile() with a .txt extension."""
709
+ r"""Shortcut for .makefile() with a .txt extension.
710
+ Defaults to the test name with a '.txt' extension, e.g test_foobar.txt, overwriting
711
+ existing files.
712
+
713
+ Examples:
714
+
715
+ .. code-block:: python
716
+
717
+ def test_something(testdir):
718
+ # initial file is created test_something.txt
719
+ testdir.maketxtfile("foobar")
720
+ # to create multiple files, pass kwargs accordingly
721
+ testdir.maketxtfile(custom="foobar")
722
+ # at this point, both 'test_something.txt' & 'custom.txt' exist in the test directory
723
+
724
+ """
695
725
return self ._makefile (".txt" , args , kwargs )
696
726
697
727
def syspathinsert (self , path = None ):
0 commit comments