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

Reduce test warnings #202

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open

Reduce test warnings #202

wants to merge 16 commits into from

Conversation

pnuu
Copy link
Member

@pnuu pnuu commented Feb 28, 2024

This PR aims at reducing warnings emitted when running the tests.

Needs rebasing after #201 has been merged.

  • Closes #xxxx
  • Tests added
  • Tests passed
  • Passes flake8 trollflow2
  • Fully documented
  • Add your name to AUTHORS.md if not there already

@pnuu pnuu added the enhancement New feature or request label Feb 28, 2024
@pnuu pnuu self-assigned this Feb 28, 2024
@pnuu pnuu requested a review from mraspaud as a code owner February 28, 2024 12:06
@pnuu
Copy link
Member Author

pnuu commented Feb 28, 2024

I'm not actually sure we can start using timezone-aware datetimes before Satpy and everything else is doing that.

@pnuu pnuu marked this pull request as draft February 28, 2024 13:32
Copy link

codecov bot commented Feb 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.86%. Comparing base (146757d) to head (643b5c7).
Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #202      +/-   ##
==========================================
+ Coverage   95.80%   95.86%   +0.06%     
==========================================
  Files          13       13              
  Lines        3000     3000              
==========================================
+ Hits         2874     2876       +2     
+ Misses        126      124       -2     
Flag Coverage Δ
unittests 95.86% <100.00%> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@pnuu
Copy link
Member Author

pnuu commented Mar 6, 2024

See also pytroll/satpy#2752

@pnuu pnuu marked this pull request as ready for review April 19, 2024 07:22
@pnuu
Copy link
Member Author

pnuu commented Apr 19, 2024

For Python 3.12 the number of warnings dropped from 897 to 17 (locally, 16 on CI where there's a newer dateutils). For 3.11 the figures are 880 -> 4 (5 in CI, can't spot where the difference is).

The AttributeError: 'NoneType' object has no attribute 'setsockopt' needs to be fixed in Posttroll.

@pnuu
Copy link
Member Author

pnuu commented Apr 19, 2024

The leftover warnings:

trollflow2/tests/test_trollflow2.py::TestFilePublisher::test_filepublisher_with_compose
trollflow2/tests/test_trollflow2.py::TestFilePublisher::test_filepublisher_without_compose
  /home/lahtinep/mambaforge/envs/py311/lib/python3.11/site-packages/_pytest/unraisableexception.py:78: PytestUnraisableExceptionWarning: Exception ignored in: <function FilePublisher.__del__ at 0x7ceffb6184a0>
  
  Traceback (most recent call last):
    File "/home/lahtinep/Software/pytroll/pytroll_packages/trollflow2/trollflow2/plugins/__init__.py", line 560, in __del__
      self.stop()
    File "/home/lahtinep/Software/pytroll/pytroll_packages/trollflow2/trollflow2/plugins/__init__.py", line 555, in stop
      self.pub.stop()
    File "/home/lahtinep/Software/pytroll/pytroll_packages/posttroll/posttroll/publisher.py", line 144, in stop
      self.publish_socket.setsockopt(zmq.LINGER, 1)
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  AttributeError: 'NoneType' object has no attribute 'setsockopt'

Easy to get rid off by adding if self.publish.socket: in posttroll.publisher.Publisher.stop, which I tested locally and works for this. I'm not sure why the patching in posttroll.testing.patched_publisher doesn't already handle this.

@pnuu
Copy link
Member Author

pnuu commented Apr 19, 2024

The warning about losing projection information was actually coming from area_def.proj_dict usage in Trollflow2. This is now replaced with area_def.is_geostationary and the only leftover warnings are the above setsockopt and the few timezone awareness warnings from other libraries for Python 3.12.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants