Exit node retrying: Retry 3 times. Also add tests for it.

Closes #20

Signed-off-by: Jesús <heckyel@hyperbola.info>
This commit is contained in:
James Taylor
2020-12-21 11:59:35 -08:00
committed by Jesús
parent 574cb2dae8
commit b11120d000
6 changed files with 140 additions and 4 deletions

14
tests/conftest.py Normal file
View File

@@ -0,0 +1,14 @@
import pytest
import urllib3
import urllib
import urllib.request
import socket
# https://realpython.com/pytest-python-testing/
@pytest.fixture(autouse=True)
def disable_network_calls(monkeypatch):
def stunted_get(*args, **kwargs):
raise RuntimeError('Network access not allowed during testing!')
monkeypatch.setattr(urllib.request, 'Request', stunted_get)
monkeypatch.setattr(urllib3.PoolManager, 'request', stunted_get)
monkeypatch.setattr(socket, 'socket', stunted_get)