
commit 14b8ccf70c991e612edcd0e55904b6d8289048f3 Author: juga0 <juga@riseup.net> Date: Wed Feb 27 08:59:54 2019 +0000 cleanup: Use getpath to get configuration paths We changed conf['paths']['X'] to use conf.getpath('paths', 'X'), so that paths with `~` get expanded, but cleanup was forgotten. Also remove extra path check in main. And run cleanup as part of the integration tests. Bugfix v0.7.0. --- sbws/core/cleanup.py | 8 ++------ tox.ini | 1 + 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/sbws/core/cleanup.py b/sbws/core/cleanup.py index 9a04ec0..aa16fba 100644 --- a/sbws/core/cleanup.py +++ b/sbws/core/cleanup.py @@ -122,7 +122,7 @@ def _check_validity_periods_results( def _clean_v3bw_files(args, conf): - v3bw_dname = conf['paths']['v3bw_dname'] + v3bw_dname = conf.getpath('paths', 'v3bw_dname') if not os.path.isdir(v3bw_dname): fail_hard('%s does not exist', v3bw_dname) compress_after_days = conf.getint('cleanup', @@ -144,7 +144,7 @@ def _clean_v3bw_files(args, conf): def _clean_result_files(args, conf): - datadir = conf['paths']['datadir'] + datadir = conf.getpath('paths', 'datadir') if not os.path.isdir(datadir): fail_hard('%s does not exist', datadir) data_period = conf.getint('general', 'data_period') @@ -174,10 +174,6 @@ def main(args, conf): :param argparse.Namespace args: command line arguments :param configparser.ConfigParser conf: parsed config files ''' - datadir = conf.getpath('paths', 'datadir') - if not os.path.isdir(datadir): - fail_hard('%s does not exist', datadir) - if not args.no_results: _clean_result_files(args, conf) diff --git a/tox.ini b/tox.ini index eb8e3a1..7109cc5 100644 --- a/tox.ini +++ b/tox.ini @@ -57,6 +57,7 @@ commands = ; This add around 3min more to the tests sbws -c {toxinidir}/tests/integration/sbws_testnet.ini scanner coverage run -a --rcfile={toxinidir}/.coveragerc --source=sbws -m pytest -s {toxinidir}/tests/integration -vv + sbws -c {toxinidir}/tests/integration/sbws_testnet.ini cleanup bash {envtmpdir}/net/stop.sh # no need to remove .tox/net directory. rm -rf /tmp/.sbws