Mock the rename failure a bit better

This commit is contained in:
Antoine Pitrou 2012-01-02 19:18:02 +01:00
parent 5e458f520c
commit c041ab6c7d

View file

@ -7,6 +7,7 @@ import sys
import stat import stat
import os import os
import os.path import os.path
import errno
import functools import functools
from test import support from test import support
from test.support import TESTFN from test.support import TESTFN
@ -46,7 +47,7 @@ except ImportError:
def _fake_rename(*args, **kwargs): def _fake_rename(*args, **kwargs):
# Pretend the destination path is on a different filesystem. # Pretend the destination path is on a different filesystem.
raise OSError() raise OSError(getattr(errno, 'EXDEV', 18), "Invalid cross-device link")
def mock_rename(func): def mock_rename(func):
@functools.wraps(func) @functools.wraps(func)