Skip to content

fake_tempfile is using AddOpenFile incorrectly. #23

@GoogleCodeExporter

Description

@GoogleCodeExporter
Code to reproduce:

def Repro():
  fd, fn = tempfile.mkstemp()
  fo = os.fdopen(fd, 'w+b')
  ...

I'd get a stack trace like this:

"myfile.py", line 3, in Repro
    fo = os.fdopen(fd, 'w+b')
  File ".../fakefs/fake_filesystem.py", line 1208, in _fdopen_ver2
    return FakeFileOpen(self.filesystem).Call(file_des, mode=mode)
  File ".../fakefs/fake_filesystem.py", line 1918, in Call
    file_object = self.filesystem.GetOpenFile(filedes).GetObject()
AttributeError: 'FakeFile' object has no attribute 'GetObject'

The offending part in fake_tempfile calls AddOpenFile() with a FakeFile object, 
but according to fake_filesystem.py line 2184 this should be FakeFileWrapper 
which is only visible from the FakeFileOpen class.

liulk

Original issue reported on code.google.com by liulk@google.com on 6 Dec 2013 at 12:09

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions