Commit 14b8ccf7 authored by juga's avatar juga
Browse files

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.
parent 54c5db04
Loading
Loading
Loading
Loading
+2 −6
Original line number Diff line number Diff line
@@ -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)

+1 −0
Original line number Diff line number Diff line
@@ -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