-
Notifications
You must be signed in to change notification settings - Fork 6
Resolve some nits in the codebase #708
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
Open
DiamondJoseph
wants to merge
11
commits into
main
Choose a base branch
from
nits
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
328cc01
S5915 Unindent asserts in context blocks
DiamondJoseph e8c7ee3
Import from packages for non __init__ modules
DiamondJoseph 274b9b3
Annotated fixtures and use builtin tmp_path
DiamondJoseph efa6118
Remove type: ignore where possible
DiamondJoseph 6079079
Update Union typing
DiamondJoseph 359168c
Raise ValidationError correctly.
DiamondJoseph 417755f
noqa where type: ignore insufficient
DiamondJoseph bc3e69a
ruff enforce absolute imports
DiamondJoseph ec2ce4f
Annotate more mocks and remove unused mocks without side effects
DiamondJoseph 6ffefc8
test commit cast objects to mock when checking
DiamondJoseph b50fb79
Do not name fixture mock_
DiamondJoseph 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,3 +1,3 @@ | ||
from .cli import main | ||
from blueapi.cli.cli import main | ||
|
||
__all__ = ["main"] |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,3 +1,3 @@ | ||
from .model import DeviceModel, PlanModel | ||
from blueapi.service.model import DeviceModel, PlanModel | ||
|
||
__all__ = ["PlanModel", "DeviceModel"] |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
|
@@ -66,7 +66,7 @@ def test_get_plans_by_name(client: BlueapiClient, expected_plans: PlanResponse): | |
def test_get_non_existent_plan(client: BlueapiClient): | ||
with pytest.raises(KeyError) as exception: | ||
client.get_plan("Not exists") | ||
assert str(exception) == ("{'detail': 'Item not found'}") | ||
assert str(exception) == ("{'detail': 'Item not found'}") | ||
Comment on lines
67
to
+69
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. Could all these use
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. |
||
|
||
|
||
def test_get_devices(client: BlueapiClient, expected_devices: DeviceResponse): | ||
|
@@ -80,8 +80,8 @@ def test_get_device_by_name(client: BlueapiClient, expected_devices: DeviceRespo | |
|
||
def test_get_non_existent_device(client: BlueapiClient): | ||
with pytest.raises(KeyError) as exception: | ||
assert client.get_device("Not exists") | ||
assert str(exception) == ("{'detail': 'Item not found'}") | ||
client.get_device("Not exists") | ||
assert str(exception) == ("{'detail': 'Item not found'}") | ||
|
||
|
||
def test_create_task_and_delete_task_by_id(client: BlueapiClient): | ||
|
@@ -92,7 +92,7 @@ def test_create_task_and_delete_task_by_id(client: BlueapiClient): | |
def test_create_task_validation_error(client: BlueapiClient): | ||
with pytest.raises(KeyError) as exception: | ||
client.create_task(Task(name="Not-exists", params={"Not-exists": 0.0})) | ||
assert str(exception) == ("{'detail': 'Item not found'}") | ||
assert str(exception) == ("{'detail': 'Item not found'}") | ||
|
||
|
||
def test_get_all_tasks(client: BlueapiClient): | ||
|
@@ -128,13 +128,13 @@ def test_get_task_by_id(client: BlueapiClient): | |
def test_get_non_existent_task(client: BlueapiClient): | ||
with pytest.raises(KeyError) as exception: | ||
client.get_task("Not-exists") | ||
assert str(exception) == "{'detail': 'Item not found'}" | ||
assert str(exception) == "{'detail': 'Item not found'}" | ||
|
||
|
||
def test_delete_non_existent_task(client: BlueapiClient): | ||
with pytest.raises(KeyError) as exception: | ||
client.clear_task("Not-exists") | ||
assert str(exception) == "{'detail': 'Item not found'}" | ||
assert str(exception) == "{'detail': 'Item not found'}" | ||
|
||
|
||
def test_put_worker_task(client: BlueapiClient): | ||
|
@@ -155,7 +155,7 @@ def test_put_worker_task_fails_if_not_idle(client: BlueapiClient): | |
|
||
with pytest.raises(BlueskyRemoteControlError) as exception: | ||
client.start_task(WorkerTask(task_id=small_task.task_id)) | ||
assert str(exception) == "<Response [409]>" | ||
assert str(exception) == "<Response [409]>" | ||
client.abort() | ||
client.clear_task(small_task.task_id) | ||
client.clear_task(long_task.task_id) | ||
|
@@ -168,11 +168,11 @@ def test_get_worker_state(client: BlueapiClient): | |
def test_set_state_transition_error(client: BlueapiClient): | ||
with pytest.raises(BlueskyRemoteControlError) as exception: | ||
client.resume() | ||
assert str(exception) == "<Response [400]>" | ||
assert str(exception) == "<Response [400]>" | ||
|
||
with pytest.raises(BlueskyRemoteControlError) as exception: | ||
client.pause() | ||
assert str(exception) == "<Response [400]>" | ||
assert str(exception) == "<Response [400]>" | ||
|
||
|
||
def test_get_task_by_status(client: BlueapiClient): | ||
|
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.