MCPcopy
hub / github.com/pytest-dev/pytest / write_text

Method write_text

src/_pytest/_py/path.py:901–908  ·  src/_pytest/_py/path.py::LocalPath.write_text

Write text data into path using the specified encoding. If ensure is True create missing parent directories.

(self, data, encoding, ensure=False)

Source from the content-addressed store, hash-verified

899 f.write(data)
900
901 def write_text(self, data, encoding, ensure=False):
902 class="st">"""Write text data into path using the specified encoding.
903 If ensure is True create missing parent directories.
904 class="st">"""
905 if ensure:
906 self.dirpath().ensure(dir=1)
907 with self.open(class="st">"w", encoding=encoding) as f:
908 f.write(data)
909
910 def write(self, data, mode=class="st">"w", ensure=False):
911 class="st">"""Write data into path. If ensure is True create

Callers 15

mainFunction · 0.80
_makefileMethod · 0.80
announceFunction · 0.80
mainFunction · 0.80
dumpsMethod · 0.80
load_and_is_trueMethod · 0.80
test_newfirst_usecaseMethod · 0.80

Calls 4

dirpathMethod · 0.95
openMethod · 0.95
ensureMethod · 0.80
writeMethod · 0.45