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 new ruff error in linting pipeline #4327

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

DanielYang59
Copy link
Contributor

@DanielYang59 DanielYang59 commented Mar 15, 2025

Summary

  • Fix new ruff error in linting pipeline
  • Avoid configuring the root logger

@@ -35,10 +34,6 @@ def main() -> int:
print("Chemical Environment package (ChemEnv)")
print(chemenv_config.package_options_description())

logging.basicConfig(
Copy link
Contributor Author

@DanielYang59 DanielYang59 Mar 15, 2025

Choose a reason for hiding this comment

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

I believe pymatgen as a library should not config the root logger?

@@ -2138,11 +2138,11 @@ def test_incar(self):

def test_kpoints(self):
kpoints1 = self.lobsterset1.kpoints
assert kpoints1.comment.split()[6], 6138
assert kpoints1.comment.split()[5] == "6138"
Copy link
Contributor Author

@DanielYang59 DanielYang59 Mar 15, 2025

Choose a reason for hiding this comment

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

@JaGeo perhaps you could help me check this? (not sure if the comment structure change is expected or not)

Looks like this test was not correctly working from the beginning 573642d, with pattern like:

self.assertTrue(kpoints1.comment.split(" ")[6], 6138)

assertTrue(expr, msg=None) doesn't compare the first arg with the second, it checks whether the first expression is truthy and the second arg is the exception message if not

@@ -220,6 +220,7 @@ ignore = [
"S603", # Check source for use of "subprocess" call
"S607", # Start process with relative path
"SIM105", # Use contextlib.suppress() instead of try-except-pass
"SIM905", # Split static strings
Copy link
Contributor Author

@DanielYang59 DanielYang59 Mar 15, 2025

Choose a reason for hiding this comment

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

I would ignore SIM905 for now as in our case it could avoid unnecessary super long multiline lists

Would go back to this if performance overhead has been a concern at some point

assert slabs[0].energy, 2.0
assert slabs[1].energy, 6.0
assert slabs[0].energy == approx(8.0)
assert slabs[1].energy == approx(24.0)
Copy link
Contributor Author

@DanielYang59 DanielYang59 Mar 15, 2025

Choose a reason for hiding this comment

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

@fyalcin it has been a while and I'm not sure if you could still remember this...But this test might not be working from the start (#2105) for the same reason as in #4327 (comment)

I have to change the value here for now

@DanielYang59 DanielYang59 marked this pull request as ready for review March 15, 2025 12:32
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.

1 participant