test suite: remove unused remove() methods from maildir classes
For cleanup of temporary files, we lean on shutil.rmtree anyway, so don't bother wasting more code on this.
This commit is contained in:
parent
7058290c2e
commit
2ce89ef508
|
@ -60,7 +60,6 @@ import unittest
|
||||||
import gzip
|
import gzip
|
||||||
import cStringIO
|
import cStringIO
|
||||||
import rfc822
|
import rfc822
|
||||||
import errno
|
|
||||||
import mailbox
|
import mailbox
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -144,14 +143,6 @@ class IndexedMailboxDir:
|
||||||
"""Return all relative pathnames of files in this mailbox."""
|
"""Return all relative pathnames of files in this mailbox."""
|
||||||
return self.msg_id_dict.values()
|
return self.msg_id_dict.values()
|
||||||
|
|
||||||
def clear(self):
|
|
||||||
"""Remove all messages in this mailbox."""
|
|
||||||
for relpath in self.msg_id_dict.values():
|
|
||||||
try: os.remove(os.path.join(self.root, relpath))
|
|
||||||
except OSError, e:
|
|
||||||
if e.errno != errno.ENOENT: raise
|
|
||||||
self.msg_id_dict.clear()
|
|
||||||
|
|
||||||
class SimpleMaildir(IndexedMailboxDir):
|
class SimpleMaildir(IndexedMailboxDir):
|
||||||
"""Primitive Maildir class, just good enough for generating short-lived
|
"""Primitive Maildir class, just good enough for generating short-lived
|
||||||
test maildirs."""
|
test maildirs."""
|
||||||
|
@ -177,14 +168,6 @@ class SimpleMaildir(IndexedMailboxDir):
|
||||||
f.close()
|
f.close()
|
||||||
self._add_to_index(msg_str, relpath)
|
self._add_to_index(msg_str, relpath)
|
||||||
|
|
||||||
def remove(self):
|
|
||||||
"""Remove all files and directories that comprise this mailbox."""
|
|
||||||
self.clear()
|
|
||||||
for d in "cur", "new", "tmp":
|
|
||||||
os.rmdir(os.path.join(self.root, d))
|
|
||||||
os.rmdir(self.root)
|
|
||||||
self.root = None
|
|
||||||
|
|
||||||
def _mkname(self, new, flags):
|
def _mkname(self, new, flags):
|
||||||
"""Generate a unique filename for a new message."""
|
"""Generate a unique filename for a new message."""
|
||||||
validflags = 'DFPRST'
|
validflags = 'DFPRST'
|
||||||
|
|
Loading…
Reference in New Issue