[tor-bugs] #7795 [Ooni]: Problems in cmd line argument parsing when importing test template modules

Tor Bug Tracker & Wiki blackhole at torproject.org
Tue Dec 25 00:06:30 UTC 2012


#7795: Problems in cmd line argument parsing when importing test template modules
---------------------+------------------------------------------------------
 Reporter:  hellais  |          Owner:  hellais
     Type:  defect   |         Status:  new    
 Priority:  normal   |      Milestone:         
Component:  Ooni     |        Version:         
 Keywords:           |         Parent:         
   Points:           |   Actualpoints:         
---------------------+------------------------------------------------------
 When importing test template modules inside of an ooniprobe nettest (that
 means doing from ooni.template.httpt import HTTPTest) command line
 argument parsing will not work as expected.

 The problem lies in the fact that inside of runner.py if a certain test
 `isTestCase` (that is it's a subclass of NetTest) we will call processTest
 on it. `processTest` will do command line argument parsing and since that
 object does not have the proper usageOptions set it will fail to parse the
 command line arguments of the actual test.

 The quick and easy workaround it to simply not import the test class
 directly, but just import the module (that means doing from `ooni.template
 import httpt`).

 The long term solution probably involves finding a way to distinguish a
 test template from a subclass of it.

-- 
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/7795>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list