[MERGE] from 14.0

Forward-port support for no tunnel.
This commit is contained in:
xmo-odoo 2022-08-24 11:19:41 +02:00 committed by GitHub
commit d5095dac63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -78,7 +78,7 @@ def pytest_addoption(parser):
parser.addoption('--log-github', action='store_true')
parser.addoption(
'--tunnel', action="store", type="choice", choices=['ngrok', 'localtunnel'], default='ngrok',
'--tunnel', action="store", type="choice", choices=['', 'ngrok', 'localtunnel'], default='',
help="Which tunneling method to use to expose the local Odoo server "
"to hook up github's webhook. ngrok is more reliable, but "
"creating a free account is necessary to avoid rate-limiting "
@ -91,7 +91,7 @@ def pytest_addoption(parser):
# noinspection PyUnusedLocal
def pytest_configure(config):
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'mergebot_test_utils'))
print(sys.path)
@pytest.fixture(scope='session', autouse=True)
def _set_socket_timeout():
@ -183,7 +183,9 @@ def tunnel(pytestconfig, port):
publicly routable address & terminate the process at the end of the session
"""
tunnel = pytestconfig.getoption('--tunnel')
if tunnel == 'ngrok':
if tunnel == '':
return f'http://localhost:{port}'
elif tunnel == 'ngrok':
web_addr = 'http://localhost:4040/api'
addr = 'localhost:%d' % port
# try to find out if ngrok is running, and if it's not attempt