Back to index

moin  1.9.0~rc2
Public Member Functions | Public Attributes
test_filesys.TestRename Class Reference

List of all members.

Public Member Functions

def setup_method
def teardown_method
def makefile
def test_posix_rename_exists
def test_win32_rename_exists
def test_special_rename_exists
def test_posix_rename_notexists
def test_win32_rename_notexists
def test_special_rename_notexists

Public Attributes

 test_dir
 src
 dst

Detailed Description

test filesys.rename* 

Definition at line 82 of file test_filesys.py.


Member Function Documentation

def test_filesys.TestRename.makefile (   self,
  fname,
  content 
)

Definition at line 93 of file test_filesys.py.

00093 
00094     def makefile(self, fname, content):
00095         f = open(fname, "w")
00096         f.write(content)
00097         f.close()

Here is the caller graph for this function:

def test_filesys.TestRename.setup_method (   self,
  method 
)

Definition at line 85 of file test_filesys.py.

00085 
00086     def setup_method(self, method):
00087         self.test_dir = tempfile.mkdtemp('', 'rename_')
00088         self.src = os.path.join(self.test_dir, "rename-src")
00089         self.dst = os.path.join(self.test_dir, "rename-dst")

def test_filesys.TestRename.teardown_method (   self,
  method 
)

Definition at line 90 of file test_filesys.py.

00090 
00091     def teardown_method(self, method):
00092         shutil.rmtree(self.test_dir)

Definition at line 98 of file test_filesys.py.

00098 
00099     def test_posix_rename_exists(self):
00100         self.makefile(self.src, "src")
00101         self.makefile(self.dst, "dst")
00102         # posix rename overwrites an existing destination
00103         # (on win32, we emulate this behaviour)
00104         filesys.rename(self.src, self.dst)
00105         dst_contents = open(self.dst).read()
00106         assert dst_contents == "src"

Here is the call graph for this function:

Definition at line 120 of file test_filesys.py.

00120 
00121     def test_posix_rename_notexists(self):
00122         self.makefile(self.src, "src")
00123         filesys.rename(self.src, self.dst)
00124         dst_contents = open(self.dst).read()
00125         assert dst_contents == "src"

Here is the call graph for this function:

Definition at line 114 of file test_filesys.py.

00114 
00115     def test_special_rename_exists(self):
00116         self.makefile(self.src, "src")
00117         self.makefile(self.dst, "dst")
00118         py.test.raises(OSError, filesys.rename_no_overwrite, self.src, self.dst, delete_old=True)
00119         assert not os.path.exists(self.src)

Here is the call graph for this function:

Definition at line 132 of file test_filesys.py.

00132 
00133     def test_special_rename_notexists(self):
00134         self.makefile(self.src, "src")
00135         filesys.rename_no_overwrite(self.src, self.dst, delete_old=True)
00136         assert not os.path.exists(self.src)
00137 

Here is the call graph for this function:

Definition at line 107 of file test_filesys.py.

00107 
00108     def test_win32_rename_exists(self):
00109         self.makefile(self.src, "src")
00110         self.makefile(self.dst, "dst")
00111         # win32-like rename does not overwrite an existing destination
00112         # (on posix, we emulate this behaviour)
00113         py.test.raises(OSError, filesys.rename_no_overwrite, self.src, self.dst)

Here is the call graph for this function:

Definition at line 126 of file test_filesys.py.

00126 
00127     def test_win32_rename_notexists(self):
00128         self.makefile(self.src, "src")
00129         filesys.rename_no_overwrite(self.src, self.dst)
00130         dst_contents = open(self.dst).read()
00131         assert dst_contents == "src"

Here is the call graph for this function:


Member Data Documentation

Definition at line 88 of file test_filesys.py.

Definition at line 87 of file test_filesys.py.

Definition at line 86 of file test_filesys.py.


The documentation for this class was generated from the following file: