Skip to content

Conversation

robertapplin
Copy link
Contributor

@robertapplin robertapplin commented Nov 1, 2024

Description of work

This PR does a refactor of the elemental_analysis_eagroup_context_test to improve its readability and its speed. There are several changes made to this test:

  • The detector workspaces are only created once inside the setUpClass method (previously they were created 4 times).
  • The Context and MuonLoadData objects are cleared in the tearDown method to avoid code duplication
  • The Given-When-Then structure is used to improve the readability of the test https://pythontest.com/strategy/given-when-then-2/
  • I avoid storing the workspaces in the ADS immediately until they are required. This makes it more explicitely obvious that the workspaces are required in the ADS (because the context is unfortunately currently dependent on the ADS)

To test:

Code review and check the test is passing on all PR operating systems jobs

This does not require release notes because it is a refactor of a unit test

Reviewer

Please comment on the points listed below (full description).
Your comments will be used as part of the gatekeeper process, so please comment clearly on what you have checked during your review. If changes are made to the PR during the review process then your final comment will be the most important for gatekeepers. In this comment you should make it clear why any earlier review is still valid, or confirm that all requested changes have been addressed.

Code Review

  • Is the code of an acceptable quality?
  • Does the code conform to the coding standards?
  • Are the unit tests small and test the class in isolation?
  • If there is GUI work does it follow the GUI standards?
  • If there are changes in the release notes then do they describe the changes appropriately?
  • Do the release notes conform to the release notes guide?

Functional Tests

  • Do changes function as described? Add comments below that describe the tests performed?
  • Do the changes handle unexpected situations, e.g. bad input?
  • Has the relevant (user and developer) documentation been added/updated?

Does everything look good? Mark the review as Approve. A member of @mantidproject/gatekeepers will take care of it.

Gatekeeper

If you need to request changes to a PR then please add a comment and set the review status to "Request changes". This will stop the PR from showing up in the list for other gatekeepers.

The detector workspaces are now only created once. They are added
back into the ADS at the start of each test because the eagroup_context
is currently dependent on the ADS. The context and MuonLoadData are
cleared in the tearDown method and we assert they are clear.
@robertapplin robertapplin added Muon Issues and pull requests related to muons Maintenance Unassigned issues to be addressed in the next maintenance period. ISIS: Spectroscopy Issue and pull requests relating to Muons, Indirect and Inelastic at ISIS labels Nov 1, 2024
@robertapplin robertapplin added this to the Release 6.12 milestone Nov 1, 2024
@robertapplin robertapplin marked this pull request as ready for review November 1, 2024 11:40
@robertapplin robertapplin force-pushed the 0-refactor-eagroup-context-test branch from ea324af to 6438df9 Compare November 1, 2024 11:43
Copy link
Collaborator

@Despiix Despiix left a comment

Choose a reason for hiding this comment

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

Had a look at the changes and it looks good! Good to go if it passes all tests.

@sf1919 sf1919 self-assigned this Nov 1, 2024
@sf1919
Copy link
Contributor

sf1919 commented Nov 1, 2024

I've looked through the code and the changes make sense to me. The tests pass so I will merge it in.

@sf1919 sf1919 merged commit 856b3c1 into mantidproject:main Nov 1, 2024
10 checks passed
peterfpeterson pushed a commit to peterfpeterson/mantid that referenced this pull request Nov 4, 2024
The detector workspaces are now only created once. They are added
back into the ADS at the start of each test because the eagroup_context
is currently dependent on the ADS. The context and MuonLoadData are
cleared in the tearDown method and we assert they are clear.

This is a version of mantidproject#38343 into `ornl-next`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ISIS: Spectroscopy Issue and pull requests relating to Muons, Indirect and Inelastic at ISIS Maintenance Unassigned issues to be addressed in the next maintenance period. Muon Issues and pull requests related to muons
Projects
Status: Merged
Development

Successfully merging this pull request may close these issues.

3 participants