-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update tests to use pytest "style/format" tests
- Loading branch information
1 parent
553ed63
commit d575a28
Showing
5 changed files
with
946 additions
and
349 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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", | ||
|
@@ -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" | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Oops, something went wrong.