Fixing for tests.

This commit is contained in:
MadcowOG 2022-05-03 20:12:53 -07:00
parent 1f9e07c4fe
commit 9745f2d256

View File

@ -53,12 +53,12 @@ def send_tor_signal(signal: Signal) -> bool:
# If password doesn't work try with cookie.
try:
with Controller.from_port(port=9051) as c:
authenticate_cookie(c, cookie_path="/var/lib/tor/control_auth_cookie")
cookie_path="/var/lib/tor/control_auth_cookie"
authenticate_cookie(c, cookie_path=cookie_path)
c.signal(signal)
os.environ['TOR_AVAILABLE'] = '1'
except (SocketError, ConnectionRefusedError, ConnectionError):
os.environ['TOR_AVAILABLE'] = '0'
print("Authentication with control port failed. Tor will be unavailable.")
return False