Skip to content
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

DM-46179 Extend TCS readiness check to other image types beyond OBJECT #170

Merged
merged 2 commits into from
Oct 18, 2024

Conversation

iglesu
Copy link
Contributor

@iglesu iglesu commented Oct 11, 2024

No description provided.

Copy link
Member

@tribeiro tribeiro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It mostly look ok but I do have some comments about how you did the unit tests.

fake_tcs.fail = False
methods = self.image_types.get(img_type)
if not methods:
self.fail(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just raise an exception? You could do something like

assert not methods, f"Image type '{img_type}' not found in image_types mapping."

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, let me try that, I was trying to get around a mypy issue, that was thrown on the method signature type.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, by changing the assertion to specifically check for the None type quieted mypy.


assert_take_method = getattr(self, assert_method_name, None)
if assert_take_method is None:
self.fail(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment above.

with self.subTest(image_type=img_type):
methods = self.image_types.get(img_type)
if not methods:
self.fail(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment above.

with self.subTest(image_type=img_type):
methods = self.image_types.get(img_type)
if not methods:
self.fail(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment above

Copy link
Member

@tribeiro tribeiro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only have a few inline comments. Also, please add a second news fragment for the idl -> xml updates you did and for the fix to the MTRotator enumeration. I think the first one can be added in a file called DM-46179.removal.rst and the second one to DM-46179.bugfix.rst.

Also, I am ready to approve the PR after you make these updates so feel free to re-organize the git history.

if (
imgtype in ["OBJECT", "ENGTEST", "ACQ", "CWFS"]
and self.ready_to_take_data is not None
):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple line below (line 983) there is another elif that needs updating. It warns users that the TCS synchronization feature is not configured. You might want to extract the list into a variable to use in both places, e.g.:

sync_imgtypes = ["OBJECT", "ENGTEST", "ACQ", "CWFS"]

if imgtype in sync_imgtypes:
    ...

.- Added image types ENGTEST, ACQ and CWFS to take_imgtype method in the
 BaseCamera class for tcs readiness checks. This requires the camera
attribute: `tcs_ready_to_take_data` to be set.

.- enums: in mtcs_async_mock.py replace MTRotator.EnabledSubstate
   from INITIALIZING to STATIONARY and point enums from idl
   package to the new xml one.

.- Added unit tests methods for this logic.
Copy link
Member

@tribeiro tribeiro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@iglesu iglesu merged commit 5959b48 into develop Oct 18, 2024
5 checks passed
@iglesu iglesu deleted the tickets/DM-46179 branch October 18, 2024 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants