Loading sbws/util/stem.py +4 −4 Original line number Diff line number Diff line Loading @@ -173,10 +173,10 @@ def set_torrc_runtime_options(controller): """Set torrc options at runtime.""" try: controller.set_options(TORRC_RUNTIME_OPTIONS) except (ControllerError, InvalidArguments, InvalidRequest) as e: log.exception("Error trying to launch tor: %s. " "Maybe the tor directory is being used by other " "sbws instance?", e) # Only the first option that fails will be logged here. # Just log stem's exceptions. except (ControllerError, InvalidRequest, InvalidArguments) as e: log.exception(e) exit(1) def launch_tor(conf): Loading tests/integration/util/test_stem.py +8 −0 Original line number Diff line number Diff line Loading @@ -10,3 +10,11 @@ def test_set_torrc_runtime_option_succesful(persistent_launch_tor): controller = persistent_launch_tor runtime_options = controller.get_conf_map(['__LeaveStreamsUnattached']) assert runtime_options == {'__LeaveStreamsUnattached': ['1']} def test_set_torrc_runtime_invalidrequest_option_fail(persistent_launch_tor): controller = persistent_launch_tor try: controller.set_conf('ControlSocket', '/tmp/dummy') except stem_utils.InvalidRequest as e: assert "Unable to set option" in e.message Loading
sbws/util/stem.py +4 −4 Original line number Diff line number Diff line Loading @@ -173,10 +173,10 @@ def set_torrc_runtime_options(controller): """Set torrc options at runtime.""" try: controller.set_options(TORRC_RUNTIME_OPTIONS) except (ControllerError, InvalidArguments, InvalidRequest) as e: log.exception("Error trying to launch tor: %s. " "Maybe the tor directory is being used by other " "sbws instance?", e) # Only the first option that fails will be logged here. # Just log stem's exceptions. except (ControllerError, InvalidRequest, InvalidArguments) as e: log.exception(e) exit(1) def launch_tor(conf): Loading
tests/integration/util/test_stem.py +8 −0 Original line number Diff line number Diff line Loading @@ -10,3 +10,11 @@ def test_set_torrc_runtime_option_succesful(persistent_launch_tor): controller = persistent_launch_tor runtime_options = controller.get_conf_map(['__LeaveStreamsUnattached']) assert runtime_options == {'__LeaveStreamsUnattached': ['1']} def test_set_torrc_runtime_invalidrequest_option_fail(persistent_launch_tor): controller = persistent_launch_tor try: controller.set_conf('ControlSocket', '/tmp/dummy') except stem_utils.InvalidRequest as e: assert "Unable to set option" in e.message