Skip to content

Commit

Permalink
Update tests to use pytest "style/format" tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lbeckman314 committed Nov 4, 2024
1 parent 553ed63 commit d575a28
Show file tree
Hide file tree
Showing 5 changed files with 946 additions and 349 deletions.
20 changes: 9 additions & 11 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,10 @@ def find_version(*file_paths):
maintainer_email="[email protected]",
url="https://github.com/ohsu-comp-bio/py-tes",
license="MIT",
packages=find_packages(),
python_requires=">=2.7, <4",
install_requires=[
"attrs>=17.4.0",
"future>=0.16.0",
"python-dateutil>=2.6.1",
"requests>=2.18.1"
],
packages=find_packages(exclude=["tests*"]),
python_requires=">=3.7, <4",
install_requires=read("requirements.txt").splitlines(),
tests_require=read("tests/requirements.txt").splitlines(),
zip_safe=True,
classifiers=[
"Development Status :: 3 - Alpha",
Expand All @@ -54,8 +50,10 @@ def find_version(*file_paths):
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6"
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11"
],
)
53 changes: 53 additions & 0 deletions tests/integration/test_funnel.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import pytest
import tes


@pytest.fixture
def tes_client():
return tes.HTTPClient("http://localhost:8000", timeout=5)


@pytest.fixture
def task():
return tes.Task(
executors=[
tes.Executor(
image="alpine",
command=["echo", "hello"]
)
]
)


def test_service_info(tes_client):
service_info = tes_client.get_service_info()
assert service_info is not None


def test_task_creation(tes_client, task):
task_id = tes_client.create_task(task)
assert task_id is not None

_ = tes_client.wait(task_id)

task_info = tes_client.get_task(task_id, view="BASIC")
assert task_info is not None


def test_task_status(tes_client, task):
task_id = tes_client.create_task(task)
assert task_id is not None

status = tes_client.get_task(task_id, view="MINIMAL").state
assert status in ["QUEUED", "INITIALIZING", "RUNNING", "COMPLETE", "CANCELED", "EXECUTOR_ERROR", "SYSTEM_ERROR", "UNKNOWN"]


def test_task_logs(tes_client, task):
task_id = tes_client.create_task(task)
assert task_id is not None

_ = tes_client.wait(task_id)

logs = tes_client.get_task(task_id, view="FULL").logs
assert logs is not None
assert len(logs) > 0
Loading

0 comments on commit d575a28

Please sign in to comment.