Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unit test for service_run #56

Merged
merged 7 commits into from
Aug 20, 2024
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
11 changes: 0 additions & 11 deletions softpack_core/graphql.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
from typing_extensions import Type

from .api import API
from .app import app
from .schemas.base import BaseSchema
from .schemas.environment import EnvironmentSchema
from .schemas.groups import GroupsSchema
Expand All @@ -32,16 +31,6 @@ class GraphQL(API):
]
commands = Typer(help="GraphQL commands.")

@staticmethod
@commands.command("query", help="Execute a GraphQL query.")
def query_command() -> None:
"""Execute a GraphQL query.

Returns:
None.
"""
app.echo("GraphQL Query")

class Schema(strawberry.Schema):
"""GraphQL Schema class."""

Expand Down
2 changes: 1 addition & 1 deletion tests/integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def httpx_post(mocker):


@pytest.fixture
def testable_env_input(mocker) -> EnvironmentInput:
def testable_env_input(mocker) -> EnvironmentInput: # type: ignore
ad = new_test_artifacts()
artifacts: Artifacts = ad["artifacts"]
user = ad["test_user"]
Expand Down
31 changes: 31 additions & 0 deletions tests/unit/test_service.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"""Copyright (c) 2023 Genome Research Ltd.

This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""

import multiprocessing
from time import sleep

import httpx
from box import Box

from softpack_core import __version__
from softpack_core.app import app
from softpack_core.service import ServiceAPI


def test_service_run() -> None:
run = multiprocessing.Process(target=ServiceAPI.run)
run.start()
while True:
try:
response = httpx.get(app.url())
break
except httpx.RequestError:
if not run.is_alive():
raise Exception("Service failed to start.")
sleep(5)
run.terminate()
status = Box(response.json())
assert status.softpack.core.version == __version__
Loading