-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pytest Tweaks, Part III - Test Isolation (#277)
* feat: isolate tests better * fix: lint * fix: unwind fixture, seemed to not work in CI for some reason * Revert "fix: unwind fixture, seemed to not work in CI for some reason" This reverts commit 0c694e9. * fix: re-add manual wait
- Loading branch information
1 parent
70b1c88
commit 26764a3
Showing
18 changed files
with
81 additions
and
115 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 |
---|---|---|
|
@@ -112,4 +112,4 @@ volumes: | |
hatchet_rabbitmq_data: | ||
hatchet_rabbitmq.conf: | ||
hatchet_config: | ||
hatchet_certs: | ||
hatchet_certs: |
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
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
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
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 |
---|---|---|
@@ -1,22 +1,21 @@ | ||
import pytest | ||
|
||
from hatchet_sdk import Hatchet | ||
from tests.utils import fixture_bg_worker | ||
|
||
worker = fixture_bg_worker(["poetry", "run", "async"]) | ||
|
||
|
||
# requires scope module or higher for shared event loop | ||
@pytest.mark.asyncio(scope="session") | ||
async def test_run(hatchet: Hatchet): | ||
@pytest.mark.parametrize("worker", ["async"], indirect=True) | ||
async def test_run(hatchet: Hatchet, worker): | ||
run = hatchet.admin.run_workflow("AsyncWorkflow", {}) | ||
result = await run.result() | ||
assert result["step1"]["test"] == "test" | ||
|
||
|
||
@pytest.mark.parametrize("worker", ["async"], indirect=True) | ||
@pytest.mark.skip(reason="Skipping this test until we can dedicate more time to debug") | ||
@pytest.mark.asyncio(scope="session") | ||
async def test_run_async(aiohatchet: Hatchet): | ||
async def test_run_async(aiohatchet: Hatchet, worker): | ||
run = await aiohatchet.admin.aio.run_workflow("AsyncWorkflow", {}) | ||
result = await run.result() | ||
assert result["step1"]["test"] == "test" |
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 |
---|---|---|
@@ -1,22 +1,21 @@ | ||
import pytest | ||
|
||
from hatchet_sdk import Hatchet | ||
from tests.utils import fixture_bg_worker | ||
|
||
worker = fixture_bg_worker(["poetry", "run", "bulk_fanout"]) | ||
|
||
|
||
# requires scope module or higher for shared event loop | ||
@pytest.mark.asyncio(scope="session") | ||
async def test_run(hatchet: Hatchet): | ||
@pytest.mark.parametrize("worker", ["bulk_fanout"], indirect=True) | ||
async def test_run(hatchet: Hatchet, worker): | ||
run = hatchet.admin.run_workflow("BulkParent", {"n": 12}) | ||
result = await run.result() | ||
assert len(result["spawn"]["results"]) == 12 | ||
|
||
|
||
# requires scope module or higher for shared event loop | ||
@pytest.mark.asyncio(scope="session") | ||
async def test_run2(hatchet: Hatchet): | ||
@pytest.mark.parametrize("worker", ["bulk_fanout"], indirect=True) | ||
async def test_run2(hatchet: Hatchet, worker): | ||
run = hatchet.admin.run_workflow("BulkParent", {"n": 10}) | ||
result = await run.result() | ||
assert len(result["spawn"]["results"]) == 10 |
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
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
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
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
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 |
---|---|---|
@@ -1,22 +1,21 @@ | ||
import pytest | ||
|
||
from hatchet_sdk import Hatchet | ||
from tests.utils import fixture_bg_worker | ||
|
||
worker = fixture_bg_worker(["poetry", "run", "fanout"]) | ||
|
||
|
||
# requires scope module or higher for shared event loop | ||
@pytest.mark.asyncio(scope="session") | ||
async def test_run(hatchet: Hatchet): | ||
@pytest.mark.parametrize("worker", ["fanout"], indirect=True) | ||
async def test_run(hatchet: Hatchet, worker): | ||
run = hatchet.admin.run_workflow("Parent", {"n": 2}) | ||
result = await run.result() | ||
assert len(result["spawn"]["results"]) == 2 | ||
|
||
|
||
# requires scope module or higher for shared event loop | ||
@pytest.mark.asyncio(scope="session") | ||
async def test_run2(hatchet: Hatchet): | ||
@pytest.mark.parametrize("worker", ["fanout"], indirect=True) | ||
async def test_run2(hatchet: Hatchet, worker): | ||
run = hatchet.admin.run_workflow("Parent", {"n": 2}) | ||
result = await run.result() | ||
assert len(result["spawn"]["results"]) == 2 |
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 |
---|---|---|
@@ -1,14 +1,12 @@ | ||
import pytest | ||
|
||
from hatchet_sdk import Hatchet | ||
from tests.utils import fixture_bg_worker | ||
|
||
worker = fixture_bg_worker(["poetry", "run", "logger"]) | ||
|
||
|
||
# requires scope module or higher for shared event loop | ||
@pytest.mark.asyncio(scope="session") | ||
async def test_run(hatchet: Hatchet): | ||
@pytest.mark.parametrize("worker", ["logger"], indirect=True) | ||
async def test_run(hatchet: Hatchet, worker): | ||
run = hatchet.admin.run_workflow("LoggingWorkflow", {}) | ||
result = await run.result() | ||
assert result["step1"]["status"] == "success" |
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
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
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
Empty file.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.