]> arthur.barton.de Git - bup.git/blobdiff - t/test-prune-older
test-prune-older: report cmd, not argv in exception
[bup.git] / t / test-prune-older
index b53eb4518b5b5f7ef0aebd8aba2842a5b08bc52e..4ebc94cabf0e4771a563f05f8c240ceb7372e848 100755 (executable)
@@ -50,7 +50,7 @@ def exo(cmd, stdin=None, stdout=True, stderr=False, shell=False, check=True):
     out, err = p.communicate()
     if check and p.returncode != 0:
         raise Exception('subprocess %r failed with status %d, stderr: %r'
-                        % (' '.join(argv), p.returncode, err))
+                        % (' '.join(map(quote, cmd)), p.returncode, err))
     return out, err, p
 
 def bup(*args):
@@ -101,17 +101,17 @@ def expected_retentions(utcs, utc_start, spec):
     utcs = list(dropwhile(lambda x: x >= period_start['all'], utcs))
 
     matches = takewhile(lambda x: x >= period_start['dailies'], utcs)
-    dailies = [min(day_utcs) for yday, day_utcs
+    dailies = [max(day_utcs) for yday, day_utcs
                in groupby(matches, lambda x: localtime(x).tm_yday)]
     utcs = list(dropwhile(lambda x: x >= period_start['dailies'], utcs))
 
     matches = takewhile(lambda x: x >= period_start['monthlies'], utcs)
-    monthlies = [min(month_utcs) for month, month_utcs
+    monthlies = [max(month_utcs) for month, month_utcs
                  in groupby(matches, lambda x: localtime(x).tm_mon)]
     utcs = dropwhile(lambda x: x >= period_start['monthlies'], utcs)
 
     matches = takewhile(lambda x: x >= period_start['yearlies'], utcs)
-    yearlies = [min(year_utcs) for year, year_utcs
+    yearlies = [max(year_utcs) for year, year_utcs
                 in groupby(matches, lambda x: localtime(x).tm_year)]
 
     return chain(all, dailies, monthlies, yearlies)
@@ -164,6 +164,11 @@ def check_prune_result(expected):
     wvpass(expected == actual)
 
 
+environ['GIT_AUTHOR_NAME'] = 'bup test'
+environ['GIT_COMMITTER_NAME'] = 'bup test'
+environ['GIT_AUTHOR_EMAIL'] = 'bup@a425bc70a02811e49bdf73ee56450e6f'
+environ['GIT_COMMITTER_EMAIL'] = 'bup@a425bc70a02811e49bdf73ee56450e6f'
+
 seed = int(environ.get('BUP_TEST_SEED', time()))
 random.seed(seed)
 print('random seed:', seed, file=stderr)