-
Notifications
You must be signed in to change notification settings - Fork 18
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
Pytest Tweaks, Part III - Test Isolation #277
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
8eedf95
feat: isolate tests better
hatchet-temporary 38c5b0e
fix: lint
hatchet-temporary 0c694e9
fix: unwind fixture, seemed to not work in CI for some reason
hatchet-temporary 8471859
Revert "fix: unwind fixture, seemed to not work in CI for some reason"
hatchet-temporary f7fedb9
fix: re-add manual wait
hatchet-temporary File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,15 +5,13 @@ | |
|
||
from hatchet_sdk import Hatchet | ||
from hatchet_sdk.workflow_run import WorkflowRunRef | ||
from tests.utils import fixture_bg_worker | ||
|
||
worker = fixture_bg_worker(["poetry", "run", "concurrency_limit_rr"]) | ||
|
||
|
||
# requires scope module or higher for shared event loop | ||
@pytest.mark.parametrize("worker", ["concurrency_limit_rr"], indirect=True) | ||
@pytest.mark.skip(reason="The timing for this test is not reliable") | ||
@pytest.mark.asyncio(scope="session") | ||
async def test_run(aiohatchet: Hatchet): | ||
async def test_run(aiohatchet: Hatchet, worker): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we have to explicitly request the fixture now |
||
num_groups = 2 | ||
runs: list[WorkflowRunRef] = [] | ||
|
||
|
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parametrizing the fixture with the example to run