Skip to content

Cleanup warnings in tests #6911

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

Merged
merged 10 commits into from
Jul 17, 2025
Merged

Conversation

danielhollas
Copy link
Collaborator

@danielhollas danielhollas commented Jun 9, 2025

Split from #6883.

Changes here bring down the number of warnings when running presto tests from over 100 to 30.

See inline comments for more details, most of the changes are straightforward, just removing usage of deprecated methods.

Copy link

codecov bot commented Jun 9, 2025

Codecov Report

Attention: Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 78.99%. Comparing base (b235b3a) to head (586747e).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/aiida/manage/manager.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6911      +/-   ##
==========================================
- Coverage   79.20%   78.99%   -0.20%     
==========================================
  Files         566      566              
  Lines       43461    43461              
==========================================
- Hits        34417    34327      -90     
- Misses       9044     9134      +90     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@danielhollas danielhollas force-pushed the cleanup-click-tests branch from bb462bf to 9103cc8 Compare June 9, 2025 14:35
@@ -2095,7 +2095,7 @@ def test_1(self):
)
tmpf.flush()
pymatgen_parser = CifParser(tmpf.name)
pymatgen_struct = pymatgen_parser.get_structures()[0]
pymatgen_struct = pymatgen_parser.parse_structures(primitive=True)[0]
Copy link
Collaborator Author

@danielhollas danielhollas Jun 9, 2025

Choose a reason for hiding this comment

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

tests/test_dataclasses.py::TestStructureDataFromPymatgen::test_1
tests/test_dataclasses.py:2098: FutureWarning: get_structures is deprecated;
use parse_structures in pymatgen.io.cif instead.

The only difference is that primitive defaults to False in the new parse_structures method.
So parse_structures(primitive=True) is equivalent to the old behavior of get_structures().
pymatgen_struct = pymatgen_parser.get_structures()[0]

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the explanation, since they are equivalent is there a specific reason for change?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The only reason is to get rid of the warning.

tests/test_dataclasses.py::TestStructureDataFromPymatgen::test_1
  tests/test_dataclasses.py:2098: FutureWarning: get_structures is deprecated;
use parse_structures in pymatgen.io.cif instead.
The only difference is that primitive defaults to False in the new parse_structures method.
So parse_structures(primitive=True) is equivalent to the old behavior of get_structures().
  pymatgen_struct = pymatgen_parser.get_structures()[0]
@danielhollas danielhollas force-pushed the cleanup-click-tests branch from 2b9dd8b to e494510 Compare July 17, 2025 15:34
@danielhollas danielhollas changed the title Cleanup click tests Cleanup warnings in tests Jul 17, 2025
@@ -95,14 +95,11 @@ async def exponential_backoff_retry_fail_kill(fct: t.Callable[..., t.Any], *args


@pytest.fixture(scope='function')
@pytest.mark.usefixtures('started_daemon_client')
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This was throwing a warning since usefixtures decorator should be used on tests, not on fixtures.

@@ -378,7 +378,7 @@ ignore_errors = true
module = 'plumpy'

[tool.pytest.ini_options]
addopts = '--benchmark-skip --durations=50 --durations-min=1 --strict-config --strict-markers -ra --cov-report xml --cov-append '
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I removed the --durations parameter as a default (which reports on slow tests), it just creates noise most of the time imho. If you need it you can specify on the command line.

Copy link
Contributor

Choose a reason for hiding this comment

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

MAybe at least keep 10, or 5
So that future developers can be reminded of performance, etc.
I'm also fine to remove it, no strong opinions..

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Okay, I've kept 5, so that when developing a new test one can easily see how long it takes. Thanks!

@danielhollas danielhollas marked this pull request as ready for review July 17, 2025 15:39
@danielhollas danielhollas requested a review from khsrali July 17, 2025 15:39
Copy link
Contributor

@khsrali khsrali left a comment

Choose a reason for hiding this comment

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

All good @danielhollas
Thanks a lot!

I've put two minor comments.

@@ -2095,7 +2095,7 @@ def test_1(self):
)
tmpf.flush()
pymatgen_parser = CifParser(tmpf.name)
pymatgen_struct = pymatgen_parser.get_structures()[0]
pymatgen_struct = pymatgen_parser.parse_structures(primitive=True)[0]
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the explanation, since they are equivalent is there a specific reason for change?

@@ -378,7 +378,7 @@ ignore_errors = true
module = 'plumpy'

[tool.pytest.ini_options]
addopts = '--benchmark-skip --durations=50 --durations-min=1 --strict-config --strict-markers -ra --cov-report xml --cov-append '
Copy link
Contributor

Choose a reason for hiding this comment

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

MAybe at least keep 10, or 5
So that future developers can be reminded of performance, etc.
I'm also fine to remove it, no strong opinions..

@danielhollas
Copy link
Collaborator Author

One failing test was a case of this flake: #6853 (comment)

@danielhollas danielhollas merged commit cb5348e into aiidateam:main Jul 17, 2025
44 of 47 checks passed
@danielhollas danielhollas deleted the cleanup-click-tests branch July 17, 2025 23:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants