mirror of
https://github.com/hanzoai/pymssql.git
synced 2026-10-30 14:54:29 +00:00
24 lines
631 B
Python
24 lines
631 B
Python
# -*- coding: utf-8 -*-
|
|
|
|
import time
|
|
import pytest
|
|
import pymssql
|
|
|
|
|
|
@pytest.mark.slow
|
|
@pytest.mark.mssql_server_required
|
|
@pytest.mark.timeout(120)
|
|
@pytest.mark.xfail(strict=False)
|
|
@pytest.mark.parametrize('to', [2])
|
|
def test_remote_connect_timeout(to):
|
|
|
|
t = time.time()
|
|
try:
|
|
pymssql.connect(server="www.google.com", port=81, user='username', password='password',
|
|
login_timeout=to)
|
|
except pymssql.OperationalError:
|
|
pass
|
|
t = time.time() - t
|
|
print('remote: requested {} -> {} actual timeout'.format(to, t))
|
|
assert t == pytest.approx(to, 5), "{} != {}".format(t, to)
|