Commit Graph

41 Commits

Author SHA1 Message Date
Antoine Pitrou e4c6b16b37 This should finally fix #6896. Let's watch the buildbots. 2009-11-01 21:29:33 +00:00
Antoine Pitrou 0da5cb8db6 Use richer assertions in test_mailbox (for better failure messages). 2009-10-31 23:19:52 +00:00
Benjamin Peterson 5c8da86f3a convert usage of fail* to assert* 2009-06-30 22:57:08 +00:00
Andrew M. Kuchling 420d4eb1f3 #1607951: Make mailbox.Maildir re-read the directories less frequently.
This is done by recording the current time -1sec, and not re-reading unless
the directory mod. times are >= the recorded time.
2009-05-02 19:17:28 +00:00
R. David Murray 52720c5455 Add missing iteritems() call to the for loop in mailbox.MH.get_message().
Fixes issue2625.
2009-04-02 14:05:35 +00:00
Andrew M. Kuchling 10288e19bf Bug 3228: take a test from Niels Gustaebel's patch, and based on his patch, check for having os.stat available 2008-08-05 01:00:57 +00:00
Andrew M. Kuchling 70a6dbd46e Bug 3228: Explicitly supply the file mode to avoid creating executable files,
and add corresponding tests.
Possible 2.5 backport candidate
2008-08-04 01:43:43 +00:00
Benjamin Peterson 5b63acd31e #2503 make singletons compared with "is" not == or !=
Thanks to Wummel for the patch
2008-03-29 15:24:25 +00:00
Neal Norwitz 22b3e3aff8 Ensure that the mailbox is closed to prevent problems on Windows with removing
an open file.  This doesn't seem to be a problem in 2.6, but that appears
to be somewhat accidental (specific to reference counting).  When this
gets merged to 3.0, it will make the 3.0 code simpler.
2008-03-26 05:19:41 +00:00
Amaury Forgeot d'Arc 07974d7a93 Correct test_mailbox on win32: since the test sets a custom 'colon' attribute
to the main mailbox, copy it to secondary mailbox instances.
2008-02-03 23:15:32 +00:00
Andrew M. Kuchling 15ce880cc8 Bug 1277: make Maildir use the user-provided factory instead of hard-wiring MaildirMessage.
2.5.2 bugfix candidate.
2008-01-19 20:12:04 +00:00
Andrew M. Kuchling 2b09ef0c6d Avoid exception if there's a stray directory inside a Maildir folder.
The Maildir specification doesn't seem to say anything about this
situation, and it can happen if you're keeping a Maildir mailbox in
Subversion (.svn directories) or some similar system.  The patch just
ignores directories in the cur/, new/, tmp/ folders.
2007-07-14 21:56:19 +00:00
Neal Norwitz 6cbd8de641 Try to be a little more resilient to errors. This might help the test
pass, but my guess is that it won't.  I'm guessing that some other
test is leaving this file open which means it can't be removed
under Windows AFAIK.
2007-03-20 06:53:17 +00:00
Neal Norwitz b0a7d4ec68 Try to make this test more resistant to dropping from previous runs (ie, files that may exist but cause the test to fail). Should be backported (assuming it works :-) 2007-03-20 06:16:26 +00:00
Tim Peters f733abb783 Whitespace normalization. 2007-01-30 03:03:46 +00:00
Georg Brandl 5a096e1b10 Use new email module names (#1637162, #1637159, #1637157). 2007-01-22 19:40:21 +00:00
Andrew M. Kuchling 8c456f3b57 Remove file-locking in MH.pack() method.
This change looks massive but it's mostly a re-indenting after
removing some try...finally blocks.

Also adds a test case that does a pack() while the mailbox is locked; this
test would have turned up bugs in the original code on some platforms.

In both nmh and GNU Mailutils' implementation of MH-format mailboxes,
no locking is done of individual message files when renaming them.

The original mailbox.py code did do locking, which meant that message
files had to be opened.  This code was buggy on certain platforms
(found through reading the code); there were code paths that closed
the file object and then called _unlock_file() on it.

Will backport to 25-maint once I see how the buildbots react to this patch.
2006-11-17 13:30:25 +00:00
Andrew M. Kuchling a3e5d3757c [Bug #1569790] mailbox.Maildir.get_folder() loses factory information
Both the Maildir and MH classes had this bug; the patch fixes both classes
and adds a test.

Will backport to 25-maint.
2006-11-09 13:27:07 +00:00
Tim Peters abd8a336a3 Whitespace normalization. 2006-11-03 02:32:46 +00:00
Andrew M. Kuchling 0f87183cf5 [Bug #1575506] The _singlefileMailbox class was using the wrong file object in its flush() method, causing an error 2006-10-27 16:55:34 +00:00
Neal Norwitz 003c9e2952 Fix the failures on cygwin (2006-08-10 fixed the actual locking issue).
The first hunk changes the colon to an ! like other Windows variants.
We need to always wait on the child so the lock gets released and
no other tests fail.  This is the try/finally in the second hunk.
2006-08-11 06:09:41 +00:00
Andrew MacIntyre afa358fabf Get mailbox module working on OS/2 EMX port. 2006-07-23 13:04:00 +00:00
Neal Norwitz b15ac3169d Add new utility function, reap_children(), to test_support. This should
be called at the end of each test that spawns children (perhaps it
should be called from regrtest instead?).  This will hopefully prevent
some of the unexplained failures in the buildbots (hppa and alpha)
during tests that spawn children.  The problems were not reproducible.
There were many zombies that remained at the end of several tests.
In the worst case, this shouldn't cause any more problems,
though it may not help either.  Time will tell.
2006-06-29 04:10:08 +00:00
Tim Peters 3249d00f4d Whitespace normalization. 2006-06-27 11:52:49 +00:00
Andrew M. Kuchling 15486f78f0 Attempt to fix build failure on OS X and Debian alpha; the symptom is
consistent with os.wait() returning immediately because some other
subprocess had previously exited; the test suite then immediately
tries to lock the mailbox and gets an error saying it's already
locked.

To fix this, do a waitpid() so the test suite only continues once
the intended child process has exited.
2006-06-26 17:00:35 +00:00
Andrew M. Kuchling ec3c368195 Windows doesn't have os.fork(). I'll just disable this test for now 2006-06-26 14:33:24 +00:00
Andrew M. Kuchling 9afbacef27 Add a test for a conflicting lock.
On slow machines, maybe the time intervals (2 sec, 0.5 sec) will be too tight.
I'll see how the buildbots like it.
2006-06-26 13:23:10 +00:00
Andrew M. Kuchling 214db63df8 Use open() instead of file() 2006-05-02 21:44:33 +00:00
Guido van Rossum b2045837b6 Hopefully this will fix the spurious failures of test_mailbox.py that I'm
experiencing.  (This code and mailbox.py itself are full of calls to file()
that should be calls to open() -- but I'm not fixing those.)
2006-05-02 20:47:36 +00:00
Tim Peters 6d7cd7d6f4 Whitespace normalization. 2006-04-22 05:52:59 +00:00
Andrew M. Kuchling 1da4a94719 Add Gregory K. Johnson's revised version of mailbox.py (funded by
the 2005 Summer of Code).

The revision adds a number of new mailbox classes that support adding
and removing messages; these classes also support mailbox locking and
default to using email.Message instead of rfc822.Message.

The old mailbox classes are largely left alone for backward compatibility.
The exception is the Maildir class, which was present in the old module
and now inherits from the new classes.  The Maildir class's interface
is pretty simple, though, so I think it'll be compatible with existing
code.

(The change to the NEWS file also adds a missing word to a different
news item, which unfortunately required rewrapping the line.)
2006-04-22 02:32:43 +00:00
Skip Montanaro 5253da163c added test for bug #996359. 2004-07-24 19:56:03 +00:00
Barry Warsaw 04f357cffe Get rid of relative imports in all unittests. Now anything that
imports e.g. test_support must do so using an absolute package name
such as "import test.test_support" or "from test import test_support".

This also updates the README in Lib/test, and gets rid of the
duplicate data dirctory in Lib/test/data (replaced by
Lib/email/test/data).

Now Tim and Jack can have at it. :)
2002-07-23 19:04:11 +00:00
Guido van Rossum e2ae77b8b8 SF patch #474590 -- RISC OS support 2001-10-24 20:42:55 +00:00
Fred Drake 2e2be3760c Change the PyUnit-based tests to use the test_main() approach. This
allows using the tests with unittest.py as a script.  The tests will
still run when run as a script themselves.
2001-09-20 21:33:42 +00:00
Jack Jansen 97df7b61f2 The test used int(time.time()) to get a random number, but this doesn't work on the mac (where times are bigger than ints). Changed to int(time.time()%1000000). 2001-06-19 20:20:05 +00:00
Tim Peters 6626c1f183 create_message(): When os.link() doesn't exist, make a copy of the msg
instead.  Allows this test to finish on Windows again.
2001-05-22 16:29:01 +00:00
Fred Drake c02bc3e819 Re-write the mailbox test suite to use PyUnit. Cover a lot more ground
for the Maildir mailbox format.  This still does not address other mailbox
formats.
2001-05-21 20:23:21 +00:00
Guido van Rossum 75ebb29f88 Some other tests, when failing, don't always remove their TESTFN file.
Try to do it for them, so our mkdir() operation doesn't fail.
2001-04-10 15:01:20 +00:00
Guido van Rossum ca956e2e47 When catching errors from os.rmdir(), test for os.error, not IOError! 2001-03-02 05:46:17 +00:00
Fred Drake 0aaed272a7 Added test for regression on SourceForge bug #117490. 2000-10-23 13:39:15 +00:00