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

Fix issues in tests (also after accidental commit to the master) #720

Merged
merged 4 commits into from
Mar 12, 2024

Conversation

grzanka
Copy link
Contributor

@grzanka grzanka commented Mar 12, 2024

No description provided.

@grzanka grzanka linked an issue Mar 12, 2024 that may be closed by this pull request
@grzanka grzanka self-assigned this Mar 12, 2024
@grzanka grzanka linked an issue Mar 12, 2024 that may be closed by this pull request
@grzanka grzanka changed the title Fix tests after accidental commit to the master Fix issues in tests (also after accidental commit to the master) Mar 12, 2024
@grzanka grzanka requested a review from nbassler March 12, 2024 10:00
@grzanka grzanka enabled auto-merge March 12, 2024 10:28
auto-merge was automatically disabled March 12, 2024 13:40

Merge queue setting changed

@grzanka grzanka enabled auto-merge (squash) March 12, 2024 13:41
Copy link
Member

@nbassler nbassler left a comment

Choose a reason for hiding this comment

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

you could assert against e.value.code == 0 according to chatGPT

"Both methods are correct for checking the exit code in a pytest context, but using e.value.code is more direct and semantically clear regarding what you are testing for. It directly reflects your intention to check the exit code. However, it's important to note that in some environments or under certain conditions, the SystemExit exception might not have a code attribute, or it might not be set as expected. In such cases, accessing e.value.args[0] would be a more generic approach that relies on the standard behavior of exceptions in Python.

In conclusion, if you are sure about the consistency of the environment and that the SystemExit exceptions will always have a code attribute correctly set, the first method (e.value.code) is preferable for its clarity and directness. Otherwise, the second method (e.value.args[0]) provides a good fallback and is slightly more generic. It's also worth mentioning that in real-world scenarios, either approach is commonly used and accepted in tests involving pytest and exit codes."

@grzanka grzanka merged commit 5585e8c into master Mar 12, 2024
12 checks passed
@grzanka grzanka deleted the 718-primary-particle-count-varies-for-the-same-run branch March 12, 2024 14:18
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.

primary particle count varies for the same run issues in testing
2 participants