diff --git a/.gitignore b/.gitignore index 0786884..723d68a 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ __pycache__ python2.env venv .idea +password.sh diff --git a/requirements.txt b/requirements.txt index 850f7d6..2319de0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ colorama argparse -coverage==4.5.4 +coverage python-coveralls unittest2 mock diff --git a/tests/basetest.py b/tests/basetest.py index 6305193..acb5f43 100644 --- a/tests/basetest.py +++ b/tests/basetest.py @@ -58,7 +58,8 @@ def redirect_stderr(target): def shelltest(cmd): """execute and print result as nice copypastable string for unit tests (adds extra newlines on top/bottom)""" - ret=(subprocess.check_output(cmd , shell=True).decode('utf-8')) + + ret=(subprocess.check_output("SUDO_ASKPASS=./password.sh sudo -A "+cmd , shell=True).decode('utf-8')) print("######### result of: {}".format(cmd)) print(ret) print("#########") diff --git a/tests/test_zfsautobackup.py b/tests/test_zfsautobackup.py index ea196b3..9a0354b 100644 --- a/tests/test_zfsautobackup.py +++ b/tests/test_zfsautobackup.py @@ -2,7 +2,6 @@ from basetest import * import time - class TestZfsAutobackup(unittest2.TestCase): def setUp(self): @@ -696,8 +695,8 @@ test_target1 #test incremental - with patch('time.strftime', return_value="20101111000000"): - self.assertFalse(ZfsAutobackup("test test_target1 --no-progress --verbose --test".split(" ")).run()) + with patch('time.strftime', return_value="20101111000002"): + self.assertFalse(ZfsAutobackup("test test_target1 --no-progress --allow-empty --verbose --test".split(" ")).run()) r=shelltest("zfs list -H -o name -r -t all "+TEST_POOLS) self.assertMultiLineEqual(r,""" diff --git a/zfs_autobackup/ThinnerRule.py b/zfs_autobackup/ThinnerRule.py index 5351766..0bb1425 100644 --- a/zfs_autobackup/ThinnerRule.py +++ b/zfs_autobackup/ThinnerRule.py @@ -42,7 +42,6 @@ class ThinnerRule: if '' in matches: raise (Exception("Invalid schedule string: '{}'".format(rule_str))) - print(matches) period_amount = int(matches[0]) period_unit = matches[1] ttl_amount = int(matches[2])