@@ -71,9 +71,9 @@ class Command(BaseCommand):
# assume if <infile> is a directory, then we're passing a maildir
if os.path.isfile(path):
- mbox = mailbox.mbox(path)
+ mbox = mailbox.mbox(path, create=False)
else:
- mbox = mailbox.Maildir(path)
+ mbox = mailbox.Maildir(path, create=False)
count = len(mbox)
@@ -45,7 +45,7 @@ class _BaseTestCase(TestCase):
results = [[], [], []]
project = project or utils.create_project()
- mbox = mailbox.mbox(os.path.join(TEST_SERIES_DIR, name))
+ mbox = mailbox.mbox(os.path.join(TEST_SERIES_DIR, name), create=False)
for msg in mbox:
obj = parser.parse_mail(msg, project.listid)
if type(obj) == models.CoverLetter:
@@ -632,7 +632,7 @@ class SeriesNameTestCase(TestCase):
:param name: Name of mbox file
"""
- return mailbox.mbox(os.path.join(TEST_SERIES_DIR, name))
+ return mailbox.mbox(os.path.join(TEST_SERIES_DIR, name), create=False)
def _parse_mail(self, mail):
return parser.parse_mail(mail, self.project.listid)
I realised when I misspelled the name of an input to a test case that mailbox will happily create an mbox or maildir if it doesn't exist. Don't do that, set create=False. Signed-off-by: Daniel Axtens <dja@axtens.net> --- patchwork/management/commands/parsearchive.py | 4 ++-- patchwork/tests/test_series.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)