The oslotest.createfile Module¶
-
class
oslotest.createfile.CreateFileWithContent(filename, contents, ext=’.conf’, encoding=’utf-8’)¶ Bases:
fixtures.fixture.FixtureCreate a temporary file with the given content.
Creates a file using a predictable name, to be used by tests for code that need a filename to load data or otherwise interact with the real filesystem.
Warning
It is the responsibility of the caller to ensure that the file is removed.
Users of this fixture may also want to use
fixtures.NestedTempfileto set the temporary directory somewhere safe and to ensure the files are cleaned up.-
path¶ The canonical name of the file created.
Parameters: - filename – Base file name or full literal path to the file to be created.
- contents – The data to write to the file. Unicode data will be encoded before being written.
- ext – An extension to add to filename.
- encoding – An encoding to use for unicode data (ignored for byte strings).
-
setUp()¶
-