[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

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



commit 3a71bd9eef0445b5454bd931bb35cc83da257c3b
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
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()
 

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits