summaryrefslogtreecommitdiff
path: root/obnam
diff options
context:
space:
mode:
authorLars Wirzenius <liw@gytha>2008-03-24 16:19:44 +0200
committerLars Wirzenius <liw@gytha>2008-03-24 16:19:44 +0200
commitfe4ed29615e5eb4c117e99d14a30cb4ca6193949 (patch)
treed84aeb1bcea117cc537c50a0256fbdb9894b86ab /obnam
parentf89eb8337a62219f261a80beed34eb7e3acdab44 (diff)
downloadobnam-fe4ed29615e5eb4c117e99d14a30cb4ca6193949.tar.gz
Started on an obnam.format.Listing class.
Diffstat (limited to 'obnam')
-rw-r--r--obnam/format.py15
-rw-r--r--obnam/formatTests.py13
2 files changed, 28 insertions, 0 deletions
diff --git a/obnam/format.py b/obnam/format.py
index 334727f9..428098ff 100644
--- a/obnam/format.py
+++ b/obnam/format.py
@@ -112,3 +112,18 @@ def inode_fields(file_component):
def timestamp(seconds):
"""Format a time stamp given in seconds since epoch"""
return time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime(seconds))
+
+
+class Listing:
+
+ """Format listings of contents of backups.
+
+ The listings are formatted similar to the Unix 'ls -l' command.
+
+ """
+
+ def __init__(self, output_file):
+ self._output = output_file
+
+ def walk(self, dirs, filegroups):
+ pass
diff --git a/obnam/formatTests.py b/obnam/formatTests.py
index 98c8868d..20cc4718 100644
--- a/obnam/formatTests.py
+++ b/obnam/formatTests.py
@@ -19,6 +19,7 @@
import stat
+import StringIO
import unittest
@@ -109,3 +110,15 @@ class FormatTimeTests(unittest.TestCase):
def test(self):
self.failUnlessEqual(obnam.format.timestamp(1), "1970-01-01 00:00:01")
+
+
+
+class ListingTests(unittest.TestCase):
+
+ def setUp(self):
+ self.file = StringIO.StringIO()
+ self.listing = obnam.format.Listing(self.file)
+
+ def testReturnsNothingForNothing(self):
+ self.listing.walk([], [])
+ self.failUnlessEqual(self.file.getvalue(), "")