def create_tmpfile ( self , content ) : # Not using a context manager to avoid unneccessary identation in test code tmpfile , tmpfilepath = tempfile . mkstemp ( ) self . tmpfiles . append ( tmpfilepath ) with os . fdopen ( tmpfile , "w" ) as f : f . write ( content ) return tmpfilepath
python temp file creation for testing
Utility method to create temp files . These are cleaned at the end of the test
def create_tmpfile(self, content):
        """ Utility method to create temp files. These are cleaned at the end of the test """
        # Not using a context manager to avoid unneccessary identation in test code
        tmpfile, tmpfilepath = tempfile.mkstemp()
        self.tmpfiles.append(tmpfilepath)
        with os.fdopen(tmpfile, "w") as f:
            f.write(content)
        return tmpfilepath