]> arthur.barton.de Git - bup.git/blobdiff - lib/bup/t/tindex.py
tindex.py: move test file foo to t/tmp
[bup.git] / lib / bup / t / tindex.py
index 54775067a931bf1e90de4626ebe2e834b7d32e12..3ec4939e5a4b415a039d97284f2b295d5fd79ebf 100644 (file)
@@ -14,10 +14,12 @@ def index_basic():
     cd = os.path.realpath('../../../t')
     WVPASS(cd)
     sd = os.path.realpath(cd + '/sampledata')
-    WVPASSEQ(index.realpath(cd + '/sampledata'), cd + '/sampledata')
+    WVPASSEQ(index.realpath(cd + '/sampledata'), sd)
     WVPASSEQ(os.path.realpath(cd + '/sampledata/x'), sd + '/x')
-    WVPASSEQ(os.path.realpath(cd + '/sampledata/etc'), os.path.realpath('/etc'))
-    WVPASSEQ(index.realpath(cd + '/sampledata/etc'), sd + '/etc')
+    WVPASSEQ(os.path.realpath(cd + '/sampledata/abs-symlink'),
+             sd + '/abs-symlink-target')
+    WVPASSEQ(index.realpath(cd + '/sampledata/abs-symlink'),
+             sd + '/abs-symlink')
 
 
 @wvtest
@@ -66,23 +68,24 @@ def index_negative_timestamps():
     initial_failures = wvfailure_count()
     tmpdir = tempfile.mkdtemp(dir=bup_tmp, prefix='bup-tindex-')
     # Makes 'foo' exist
-    f = file('foo', 'wb')
+    foopath = tmpdir + '/foo'
+    f = file(foopath, 'wb')
     f.close()
 
     # Dec 31, 1969
-    os.utime("foo", (-86400, -86400))
+    os.utime(foopath, (-86400, -86400))
     ns_per_sec = 10**9
     tstart = time.time() * ns_per_sec
     tmax = tstart - ns_per_sec
-    e = index.BlankNewEntry("foo", 0, tmax)
-    e.from_stat(xstat.stat("foo"), 0, tstart)
+    e = index.BlankNewEntry(foopath, 0, tmax)
+    e.from_stat(xstat.stat(foopath), 0, tstart)
     assert len(e.packed())
     WVPASS()
 
     # Jun 10, 1893
-    os.utime("foo", (-0x80000000, -0x80000000))
-    e = index.BlankNewEntry("foo", 0, tmax)
-    e.from_stat(xstat.stat("foo"), 0, tstart)
+    os.utime(foopath, (-0x80000000, -0x80000000))
+    e = index.BlankNewEntry(foopath, 0, tmax)
+    e.from_stat(xstat.stat(foopath), 0, tstart)
     assert len(e.packed())
     WVPASS()
     if wvfailure_count() == initial_failures: