Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions tests_integrity/test_aes_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

from .support import check_url, start_server

# pylint: disable=inconsistent-return-statements
# pylint: disable=missing-function-docstring
# pylint: disable=no-self-use
# pylint: disable=redefined-outer-name
Expand All @@ -16,17 +15,19 @@
@fixture(scope="module")
def url(request):
"""The URL (server fixture)."""
val = environ.get("TEST_AES_SESSION_URL", "").strip('/')
process = None
val = environ.get("TEST_AES_SESSION_URL", "").rstrip('/')
if val:
return val

process = start_server(
request,
join(dirname(__file__), pardir, 'examples/aes_session.py'))

yield "http://localhost:8080" # server is running
process.kill()
process.wait()
yield val
else:
process = start_server(
request,
join(dirname(__file__), pardir, 'examples/aes_session.py'))
yield "http://localhost:8080" # server is running

if process is not None:
process.kill()
process.wait()


@fixture
Expand Down
23 changes: 12 additions & 11 deletions tests_integrity/test_digest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

from .support import check_url, start_server

# pylint: disable=inconsistent-return-statements
# pylint: disable=missing-function-docstring
# pylint: disable=redefined-outer-name
# pylint: disable=no-self-use
Expand All @@ -16,17 +15,19 @@
@fixture(scope="module")
def url(request):
"""The URL (server fixture)."""
val = environ.get("TEST_DIGEST_URL", "").strip('/')
process = None
val = environ.get("TEST_DIGEST_URL", "").rstrip('/')
if val:
return val

process = start_server(
request,
join(dirname(__file__), pardir, 'examples/http_digest.py'))

yield "http://localhost:8080" # server is running
process.kill()
process.wait()
yield val
else:
process = start_server(
request,
join(dirname(__file__), pardir, 'examples/http_digest.py'))
yield "http://localhost:8080" # server is running

if process is not None:
process.kill()
process.wait()


@fixture
Expand Down
23 changes: 12 additions & 11 deletions tests_integrity/test_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from . support import start_server, check_url

# pylint: disable=missing-function-docstring
# pylint: disable=inconsistent-return-statements
# pylint: disable=redefined-outer-name
# pylint: disable=no-self-use
# pylint: disable=consider-using-f-string
Expand All @@ -17,17 +16,19 @@
@fixture(scope="module")
def server(request):
"""Fixture for starting the JSON example server."""
value = environ.get("TEST_SIMPLE_JSON_URL", "").strip('/')
process = None
value = environ.get("TEST_SIMPLE_JSON_URL", "").rstrip('/')
if value:
return value

process = start_server(
request,
join(dirname(__file__), pardir, 'examples/simple_json.py'))

yield "http://localhost:8080" # server is running
process.kill()
process.wait()
yield value
else:
process = start_server(
request,
join(dirname(__file__), pardir, 'examples/simple_json.py'))
yield "http://localhost:8080" # server is running

if process is not None:
process.kill()
process.wait()


class TestHeaders:
Expand Down
21 changes: 11 additions & 10 deletions tests_integrity/test_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,19 @@
def url(request):
"""Returns the server URL or starts the metrics application if it doesn't
exist."""
retval = environ.get("TEST_METRICS_URL", "").strip('/')
process = None
retval = environ.get("TEST_METRICS_URL", "").rstrip('/')
if retval:
yield retval
return

process = start_server(
request,
join(dirname(__file__), pardir, 'examples/metrics.py'))

yield "http://localhost:8080" # server is running
process.kill()
process.wait()
else:
process = start_server(
request,
join(dirname(__file__), pardir, 'examples/metrics.py'))
yield "http://localhost:8080" # server is running

if process is not None:
process.kill()
process.wait()


class TestMetrics():
Expand Down
25 changes: 13 additions & 12 deletions tests_integrity/test_openapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,19 @@
@fixture(scope="module")
def url(request):
"""Fixture for starting the OpenAPI example server."""
url = environ.get("TEST_OPENAPI_URL", "").strip('/')
if url:
yield url
return

process = start_server(
request,
join(dirname(__file__), pardir, 'examples/openapi3.py'))

yield "http://localhost:8080" # server is running
process.kill()
process.wait()
process = None
val = environ.get("TEST_OPENAPI_URL", "").rstrip('/')
if val:
yield val
else:
process = start_server(
request,
join(dirname(__file__), pardir, 'examples/openapi3.py'))
yield "http://localhost:8080" # server is running

if process is not None:
process.kill()
process.wait()


@fixture
Expand Down
25 changes: 13 additions & 12 deletions tests_integrity/test_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from . support import start_server, check_url

# pylint: disable=missing-function-docstring
# pylint: disable=inconsistent-return-statements
# pylint: disable=redefined-outer-name
# pylint: disable=no-self-use
# pylint: disable=consider-using-f-string
Expand All @@ -17,18 +16,20 @@
@fixture(scope="module")
def server(request):
"""Fixture for starting the profiling JSON example server."""
value = environ.get("TEST_SIMPLE_JSON_URL", "").strip('/')
process = None
value = environ.get("TEST_SIMPLE_JSON_URL", "").rstrip('/')
if value:
return value

process = start_server(
request,
join(dirname(__file__), pardir, 'examples/simple_json.py'),
{"PROFILE": "1"})

yield "http://localhost:8080" # server is running
process.kill()
process.wait()
yield value
else:
process = start_server(
request,
join(dirname(__file__), pardir, 'examples/simple_json.py'),
{"PROFILE": "1"})
yield "http://localhost:8080" # server is running

if process is not None:
process.kill()
process.wait()


class TestRequest:
Expand Down
23 changes: 12 additions & 11 deletions tests_integrity/test_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

from .support import check_url, start_server

# pylint: disable=inconsistent-return-statements
# pylint: disable=missing-function-docstring
# pylint: disable=no-self-use
# pylint: disable=redefined-outer-name
Expand All @@ -16,17 +15,19 @@
@fixture(scope="module")
def url(request):
"""The URL (server fixture)."""
val = environ.get("TEST_SESSION_URL", "").strip('/')
process = None
val = environ.get("TEST_SESSION_URL", "").rstrip('/')
if val:
return val

process = start_server(
request,
join(dirname(__file__), pardir, 'examples/session.py'))

yield "http://localhost:8080" # server is running
process.kill()
process.wait()
yield val
else:
process = start_server(
request,
join(dirname(__file__), pardir, 'examples/session.py'))
yield "http://localhost:8080" # server is running

if process is not None:
process.kill()
process.wait()


@fixture
Expand Down
25 changes: 13 additions & 12 deletions tests_integrity/test_simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

from .support import check_url, start_server

# pylint: disable=inconsistent-return-statements
# pylint: disable=missing-function-docstring
# pylint: disable=no-self-use
# pylint: disable=redefined-outer-name
Expand All @@ -17,17 +16,19 @@
@fixture(scope="module")
def url(request):
"""The URL (server fixture)."""
url = environ.get("TEST_SIMPLE_URL", "").strip('/')
if url:
return url

process = start_server(
request,
join(dirname(__file__), pardir, 'examples/simple.py'))

yield "http://localhost:8080" # server is running
process.kill()
process.wait()
process = None
val = environ.get("TEST_SIMPLE_URL", "").rstrip('/')
if val:
yield val
else:
process = start_server(
request,
join(dirname(__file__), pardir, 'examples/simple.py'))
yield "http://localhost:8080" # server is running

if process is not None:
process.kill()
process.wait()


@fixture
Expand Down
23 changes: 12 additions & 11 deletions tests_integrity/test_websocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

from . support import start_server, check_url

# pylint: disable=inconsistent-return-statements
# pylint: disable=missing-function-docstring
# pylint: disable=redefined-outer-name
# pylint: disable=no-self-use
Expand All @@ -19,18 +18,20 @@
@fixture(scope="module")
def server(request):
"""Fixture for starting the WebSocket example server."""
value = environ.get("TEST_WEBSOCKET_URL", "").strip('/')
process = None
value = environ.get("TEST_WEBSOCKET_URL", "").rstrip('/')
if value:
return value
yield value
else:
process = start_server(
request,
join(dirname(__file__), pardir, 'examples/websocket.py'),
close=False)
yield "localhost:8080" # server is running

process = start_server(
request,
join(dirname(__file__), pardir, 'examples/websocket.py'),
close=False)

yield "localhost:8080" # server is running
process.kill()
process.wait()
if process is not None:
process.kill()
process.wait()


@fixture(scope="module")
Expand Down
Loading