Skip to content

Add system tests for default handling + ruff + pyright#135

Merged
Tom-Willemsen merged 4 commits intomasterfrom
Ticket8445_Add_system_tests_for_new_default_handling
Apr 7, 2026
Merged

Add system tests for default handling + ruff + pyright#135
Tom-Willemsen merged 4 commits intomasterfrom
Ticket8445_Add_system_tests_for_new_default_handling

Conversation

@LowriJenkins
Copy link
Copy Markdown
Contributor

Description of work

Add system test for the new macro default handling. Also ran ruff+pyright

Ticket

ISISComputingGroup/IBEX#8445

Acceptance criteria

System test passes and correctly tests default handling

Unit tests

Give an overview of unit tests you have added or modified, if applicable. The aim is provide information to help the reviewer

System tests

Mention any automated tests or manual tests that you have added or modified, if applicable. The aim is provide information to help the reviewer

Documentation

Highlight and provide a link to any additions or changes to the documentation, if applicable. The aim is provide information to help the reviewer


Code Review

  • Is the code of an acceptable quality?
  • Do the changes function as described and is it robust?
  • Have the changes been documented in the release notes?

Final Steps

  • Reviewer has moved the release notes entry for this ticket in the "Changes merged into master" section

Comment thread test_blockserver.py Fixed
Comment thread test_blockserver.py Fixed
Copy link
Copy Markdown
Member

@Tom-Willemsen Tom-Willemsen left a comment

Choose a reason for hiding this comment

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

The tests are failing for me with errors like:

======================================================================
ERROR [91.215s]: test_WHEN_ioc_has_macros_THEN_defaults_handled_correctly_0___No_Vals_All_Default_True_True_True_ (test_blockserver.TestBlockserver.test_WHEN_ioc_has_macros_THEN_defaults_handled_correctly_0___No_Vals_All_Default_True_True_True_)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Instrument\Apps\Python3\Lib\site-packages\parameterized\parameterized.py", line 620, in standalone_func
    return func(*(a + p.args), **p.kwargs, **kw)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Instrument\dev\system_tests\test_blockserver.py", line 479, in test_WHEN_ioc_has_macros_THEN_defaults_handled_correctly
    macros_in_config = utilities.get_config_details()["iocs"][0]["macros"]
                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^
IndexError: list index out of range

======================================================================
ERROR [91.151s]: test_WHEN_ioc_has_macros_THEN_defaults_handled_correctly_1___No_Vals_No_Default_False_False_False_ (test_blockserver.TestBlockserver.test_WHEN_ioc_has_macros_THEN_defaults_handled_correctly_1___No_Vals_No_Default_False_False_False_)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Instrument\Apps\Python3\Lib\site-packages\parameterized\parameterized.py", line 620, in standalone_func
    return func(*(a + p.args), **p.kwargs, **kw)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Instrument\dev\system_tests\test_blockserver.py", line 479, in test_WHEN_ioc_has_macros_THEN_defaults_handled_correctly
    macros_in_config = utilities.get_config_details()["iocs"][0]["macros"]
                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^
IndexError: list index out of range

(this is after correcting the g.set_instrument from "" to None). Blockserver contains a few of these:

MAJOR: Odd-length string

which implies we're sending it the config in the wrong format (str instead of bytes?)

Comment thread test_blockserver.py Outdated

def setUp(self) -> None:
g.set_instrument(None, import_instrument_init=False)
g.set_instrument("", import_instrument_init=False)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is this right?

https://github.com/ISISComputingGroup/genie/blob/19cdfeedaf5ec9107f0328a69204b621858c859a/src/genie_python/genie_epics_api.py#L141 allows None (and checks against it...)

I think set_instrument might be type-hinted incorrectly.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This also looked to just break the tests for me as it looked for a PV prefix of TE::...

@LowriJenkins
Copy link
Copy Markdown
Contributor Author

LowriJenkins commented Jan 21, 2026

Hmmm it appears all the actual issues with hte system tests were caused by pyright fixes, specifically from imports from genie python, the major one seems to be that g.set_pv() needs to accept bytes, something that PVValue doesn't currently support.

@LowriJenkins
Copy link
Copy Markdown
Contributor Author

pyright failure should be fixed by ISISComputingGroup/genie#78

@Tom-Willemsen Tom-Willemsen merged commit 170247c into master Apr 7, 2026
8 of 10 checks passed
@Tom-Willemsen Tom-Willemsen deleted the Ticket8445_Add_system_tests_for_new_default_handling branch April 7, 2026 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants