Make test-rawdog not depend on having a host it can test connection
timeouts against, and add a -T option if you do have one.
+When renaming a feed's state file in splitstate mode, don't fail if the
+state file doesn't exist -- which can happen if we get a 301 response
+for a feed the first time we fetch it. Also rename the lock file along
+with the state file.
+
Add some more comprehensive tests for the changeconfig option; in
particular, test it more thoroughly with splitstate both on and off.
# persister: persist Python objects safely to pickle files
-# Copyright 2003, 2004, 2005, 2013 Adam Sampson <ats@offog.org>
+# Copyright 2003, 2004, 2005, 2013, 2014 Adam Sampson <ats@offog.org>
#
# rawdog is free software; you can redistribute and/or modify it
# under the terms of that license as published by the Free Software
currently open or not."""
self.persister._rename(self.filename, new_filename)
- os.rename(self.filename, new_filename)
+ for ext in ("", ".lock"):
+ try:
+ os.rename(self.filename + ext,
+ new_filename + ext)
+ except OSError, e:
+ # If the file doesn't exist (yet),
+ # that's OK.
+ if e.errno != errno.ENOENT:
+ raise e
self.filename = new_filename
def __enter__(self):
def delete(self, filename):
"""Delete a persisted file, along with its lock file,
if they exist."""
- for fn in (filename, filename + ".lock"):
+ for ext in ("", ".lock"):
try:
- os.unlink(fn)
+ os.unlink(filename + ext)
except OSError:
pass