[tor-commits] [stem/master] Fix --test and --exclude-test arguments

atagar at torproject.org atagar at torproject.org
Fri May 15 00:46:59 UTC 2020


commit 3a71bd9eef0445b5454bd931bb35cc83da257c3b
Author: Damian Johnson <atagar at torproject.org>
Date:   Thu May 14 17:41:12 2020 -0700

    Fix --test and --exclude-test arguments
    
    Commit 076f89d rewrote how we parse arguments. This broke our --test and
    --exclude-test arguments because there is no longer a default value in the
    'args' dictionary...
    
      % ./run_tests.py --unit --test endpoint
      Traceback (most recent call last):
        File "./run_tests.py", line 482, in <module>
          main()
        File "./run_tests.py", line 197, in main
          args = test.arguments.Arguments.parse(sys.argv[1:])
        File "/home/atagar/Desktop/stem/test/arguments.py", line 109, in parse
          args['specific_test'].append(crop_module_name(arg))
      KeyError: 'specific_test'
    
    Reported by teor on...
    
      https://github.com/torproject/stem/issues/63
---
 test/arguments.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/test/arguments.py b/test/arguments.py
index e06148c4..cab15400 100644
--- a/test/arguments.py
+++ b/test/arguments.py
@@ -106,9 +106,9 @@ class Arguments(NamedTuple):
 
         args['attribute_targets'] = attribute_targets
       elif opt == '--test':
-        args['specific_test'].append(crop_module_name(arg))
+        args.setdefault('specific_test', []).append(crop_module_name(arg))
       elif opt == '--exclude-test':
-        args['exclude_test'].append(crop_module_name(arg))
+        args.setdefault('exclude_test', []).append(crop_module_name(arg))
       elif opt in ('-l', '--log'):
         arg = arg.upper()
 



More information about the tor-commits mailing list