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

[tor-commits] [stem/master] Minor revisions for test_transition_to_relay()



commit dbb066053e39698300d13c0be0228d5b4e33669a
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Tue Feb 17 08:02:42 2015 -0800

    Minor revisions for test_transition_to_relay()
    
    Very, very minor tweaks...
    
      * mentioning an example of what this test is for catching
      * 'runner' was only used in one spot
      * breaking up the method a bit for readability
      * there was an extra newline after the method
      * pep8 is citing a style issue for me ("E201 E201 whitespace after '{'")
---
 test/integ/control/controller.py |   15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/test/integ/control/controller.py b/test/integ/control/controller.py
index 4fb3806..4b2cbfc 100644
--- a/test/integ/control/controller.py
+++ b/test/integ/control/controller.py
@@ -1222,31 +1222,32 @@ class TestController(unittest.TestCase):
     elif test.runner.require_version(self, Requirement.EXTENDCIRCUIT_PATH_OPTIONAL):
       return
 
-    runner = test.runner.get_runner()
-    with runner.get_tor_controller() as controller:
+    with test.runner.get_runner().get_tor_controller() as controller:
       new_circ = controller.new_circuit()
       circuits = controller.get_circuits()
       self.assertTrue(new_circ in [circ.id for circ in circuits])
 
   def test_transition_to_relay(self):
     """
-    Transitions Tor to turn into a relay, then back to a client.
+    Transitions Tor to turn into a relay, then back to a client. This helps to
+    catch transition issues such as the one cited in :trac:`14901`.
     """
 
     if test.runner.require_control(self):
       return
 
-    runner = test.runner.get_runner()
-    with runner.get_tor_controller() as controller:
+    with test.runner.get_runner().get_tor_controller() as controller:
       self.assertEqual(None, controller.get_conf('OrPort'))
+
       # DisableNetwork ensures no port is actually opened
-      controller.set_options({ 'OrPort': '9090', 'DisableNetwork': '1', })
+      controller.set_options({'OrPort': '9090', 'DisableNetwork': '1'})
+
       # TODO once tor 0.2.7.x exists, test that we can generate a descriptor on demand.
+
       self.assertEqual('9090', controller.get_conf('OrPort'))
       controller.reset_conf('OrPort', 'DisableNetwork')
       self.assertEqual(None, controller.get_conf('OrPort'))
 
-
   def _get_router_status_entry(self, controller):
     """
     Provides a router status entry for a relay with a nickname other than

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