From e06294e8668e4939de1d84faa2e1d6a02d3bf9dd Mon Sep 17 00:00:00 2001 From: Manuel Gunther <siebenkopf@googlemail.com> Date: Thu, 20 Oct 2016 19:30:59 -0600 Subject: [PATCH] Fixed wrong usage of setattr --- bob/bio/base/test/test_scripts.py | 24 ++++++++++++++++++++++++ bob/bio/base/tools/command_line.py | 2 +- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/bob/bio/base/test/test_scripts.py b/bob/bio/base/test/test_scripts.py index b8782234..35e84d2e 100644 --- a/bob/bio/base/test/test_scripts.py +++ b/bob/bio/base/test/test_scripts.py @@ -253,6 +253,30 @@ def test_verify_missing(): shutil.rmtree(test_dir) +def test_verify_execute_only(): + test_dir = tempfile.mkdtemp(prefix='bobtest_') + # define dummy parameters + parameters = [ + '-d', 'dummy', + '-p', 'dummy', + '-e', 'dummy', + '-a', 'dummy', + '--zt-norm', + '--allow-missing-files', + '-vs', 'test_missing', + '--temp-directory', test_dir, + '--result-directory', test_dir, + '--preferred-package', 'bob.bio.base', + '--imports', 'bob.bio.base.test.dummy', + '--execute-only', 'preprocessing', 'score-computation', + '--dry-run' + ] + + try: + from bob.bio.base.script.verify import main + main(parameters) + + def test_internal_raises(): test_dir = tempfile.mkdtemp(prefix='bobtest_') # define dummy parameters diff --git a/bob/bio/base/tools/command_line.py b/bob/bio/base/tools/command_line.py index dc923b83..7c325e36 100644 --- a/bob/bio/base/tools/command_line.py +++ b/bob/bio/base/tools/command_line.py @@ -271,7 +271,7 @@ def initialize(parsers, command_line_parameters = None, skips = []): if skips is not None and args.execute_only is not None: for skip in skips: if skip not in args.execute_only: - setattr("args", "skip_%s" % skip.replace("-", "_"), True) + setattr(args, "skip_%s" % skip.replace("-", "_"), True) if args.parallel is not None: args.grid = bob.bio.base.grid.Grid("local", number_of_parallel_processes = args.parallel) -- GitLab