X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Fbup%2Ft%2Ftxstat.py;h=64bad2de0eed71d0e8776dabe1831e5e1e9d3247;hb=c40b3dd5fd74e72024fbaad3daf5a958aefa1c54;hp=d7922edf10335e25e52e7066829f09342106e46e;hpb=be2593062aa08b541343f80ebf05d0ca3a22c52a;p=bup.git diff --git a/lib/bup/t/txstat.py b/lib/bup/t/txstat.py index d7922ed..64bad2d 100644 --- a/lib/bup/t/txstat.py +++ b/lib/bup/t/txstat.py @@ -1,3 +1,5 @@ + +from __future__ import absolute_import import math, tempfile, subprocess from wvtest import * @@ -62,51 +64,54 @@ def test_fstime(): def test_bup_utimensat(): if not xstat._bup_utimensat: return - with no_lingering_errors(), test_tempdir('bup-txstat-') as tmpdir: - path = tmpdir + '/foo' - open(path, 'w').close() - frac_ts = (0, 10**9 / 2) - xstat._bup_utimensat(_helpers.AT_FDCWD, path, (frac_ts, frac_ts), 0) - st = _helpers.stat(path) - atime_ts = st[8] - mtime_ts = st[9] - WVPASSEQ(atime_ts[0], 0) - WVPASS(atime_ts[1] == 0 or atime_ts[1] == frac_ts[1]) - WVPASSEQ(mtime_ts[0], 0) - WVPASS(mtime_ts[1] == 0 or mtime_ts[1] == frac_ts[1]) + with no_lingering_errors(): + with test_tempdir('bup-txstat-') as tmpdir: + path = tmpdir + '/foo' + open(path, 'w').close() + frac_ts = (0, 10**9 / 2) + xstat._bup_utimensat(_helpers.AT_FDCWD, path, (frac_ts, frac_ts), 0) + st = _helpers.stat(path) + atime_ts = st[8] + mtime_ts = st[9] + WVPASSEQ(atime_ts[0], 0) + WVPASS(atime_ts[1] == 0 or atime_ts[1] == frac_ts[1]) + WVPASSEQ(mtime_ts[0], 0) + WVPASS(mtime_ts[1] == 0 or mtime_ts[1] == frac_ts[1]) @wvtest def test_bup_utimes(): if not xstat._bup_utimes: return - with no_lingering_errors(), test_tempdir('bup-txstat-') as tmpdir: - path = tmpdir + '/foo' - open(path, 'w').close() - frac_ts = (0, 10**6 / 2) - xstat._bup_utimes(path, (frac_ts, frac_ts)) - st = _helpers.stat(path) - atime_ts = st[8] - mtime_ts = st[9] - WVPASSEQ(atime_ts[0], 0) - WVPASS(atime_ts[1] == 0 or atime_ts[1] == frac_ts[1] * 1000) - WVPASSEQ(mtime_ts[0], 0) - WVPASS(mtime_ts[1] == 0 or mtime_ts[1] == frac_ts[1] * 1000) + with no_lingering_errors(): + with test_tempdir('bup-txstat-') as tmpdir: + path = tmpdir + '/foo' + open(path, 'w').close() + frac_ts = (0, 10**6 / 2) + xstat._bup_utimes(path, (frac_ts, frac_ts)) + st = _helpers.stat(path) + atime_ts = st[8] + mtime_ts = st[9] + WVPASSEQ(atime_ts[0], 0) + WVPASS(atime_ts[1] == 0 or atime_ts[1] == frac_ts[1] * 1000) + WVPASSEQ(mtime_ts[0], 0) + WVPASS(mtime_ts[1] == 0 or mtime_ts[1] == frac_ts[1] * 1000) @wvtest def test_bup_lutimes(): if not xstat._bup_lutimes: return - with no_lingering_errors(), test_tempdir('bup-txstat-') as tmpdir: - path = tmpdir + '/foo' - open(path, 'w').close() - frac_ts = (0, 10**6 / 2) - xstat._bup_lutimes(path, (frac_ts, frac_ts)) - st = _helpers.stat(path) - atime_ts = st[8] - mtime_ts = st[9] - WVPASSEQ(atime_ts[0], 0) - WVPASS(atime_ts[1] == 0 or atime_ts[1] == frac_ts[1] * 1000) - WVPASSEQ(mtime_ts[0], 0) - WVPASS(mtime_ts[1] == 0 or mtime_ts[1] == frac_ts[1] * 1000) + with no_lingering_errors(): + with test_tempdir('bup-txstat-') as tmpdir: + path = tmpdir + '/foo' + open(path, 'w').close() + frac_ts = (0, 10**6 / 2) + xstat._bup_lutimes(path, (frac_ts, frac_ts)) + st = _helpers.stat(path) + atime_ts = st[8] + mtime_ts = st[9] + WVPASSEQ(atime_ts[0], 0) + WVPASS(atime_ts[1] == 0 or atime_ts[1] == frac_ts[1] * 1000) + WVPASSEQ(mtime_ts[0], 0) + WVPASS(mtime_ts[1] == 0 or mtime_ts[1] == frac_ts[1] * 1000)