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

Move some of our test utilities to galsim.utilities #1240

Merged
merged 10 commits into from
Aug 22, 2023
Merged

Move some of our test utilities to galsim.utilities #1240

merged 10 commits into from
Aug 22, 2023

Conversation

rmjarvis
Copy link
Member

Some of the things that are in our galsim_test_helpers, I've used in other projects and just copied them over. It would be easier if these lived in galsim.utilities instead, so I could just use them directly. This PR puts the ones that I think are potentially useful for other project in our installed code base:

  • do_pickle
  • all_objs_diff
  • timer
  • profile
  • CaptureLog

@rmjarvis rmjarvis added this to the v2.5 milestone Aug 19, 2023
@rmjarvis rmjarvis requested a review from rmandelb August 19, 2023 01:54
Copy link
Member

@jmeyers314 jmeyers314 left a comment

Choose a reason for hiding this comment

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

LGTM. Minor comments.



# Context to make it easier to profile bits of the code
class profile:
Copy link
Member

Choose a reason for hiding this comment

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

FWIW, I'd actually love to rename this one so it doesn't conflict with using @profile via line_profiler.

Copy link
Member Author

Choose a reason for hiding this comment

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

OK. Suggestions? Maybe just capitalize? with Profile(): That would fit in with most of our GalSim style for classes.

Copy link
Member Author

@rmjarvis rmjarvis Aug 19, 2023

Choose a reason for hiding this comment

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

I was also thinking of renaming a couple others. do_pickle and all_objs_diff aren't great names either, tbh. I was thinking check_pickle and check_all_diff for those.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, these all sound better to me.

obj: The object to test
func: A function of obj to use to test for equivalence. [default: lambda x: x]
irreprable: Whether to skip the eval(repr(obj)) test. [default: False]
random: Whether the obj has some intrinsic randomness. [default: False, unless
Copy link
Member

Choose a reason for hiding this comment

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

Looks like default is None?

Copy link
Member Author

Choose a reason for hiding this comment

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

Right. I was describing what that default means, which is False normally, but tries to notice randomness.

@rmjarvis rmjarvis merged commit 7faaf33 into main Aug 22, 2023
9 checks passed
@rmjarvis rmjarvis deleted the test_utils branch August 22, 2023 21:34
@rmjarvis rmjarvis added admin Administrative stuff, rather than code tests Related to the test suite labels Oct 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
admin Administrative stuff, rather than code tests Related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants