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

Run pytest on macos in GH actions #262

Merged
merged 8 commits into from
Jul 29, 2024
Merged

Run pytest on macos in GH actions #262

merged 8 commits into from
Jul 29, 2024

Conversation

reuterbal
Copy link
Collaborator

@reuterbal reuterbal commented Mar 26, 2024

With people using Loki locally on their MacBooks, it seems useful to test this as part of the CI.

Copy link

Documentation for this branch can be viewed at https://sites.ecmwf.int/docs/loki/262/index.html

@reuterbal reuterbal marked this pull request as draft March 28, 2024 11:54
@reuterbal reuterbal force-pushed the nabr-macos-ci branch 4 times, most recently from 774a192 to e24b02e Compare April 20, 2024 19:18
Copy link

codecov bot commented Apr 20, 2024

Codecov Report

Attention: Patch coverage is 91.66667% with 3 lines in your changes missing coverage. Please review.

Project coverage is 95.35%. Comparing base (2b3b206) to head (3e41177).

Files Patch % Lines
loki/tools/tests/test_tools.py 50.00% 2 Missing ⚠️
loki/tests/test_cmake.py 95.45% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #262   +/-   ##
=======================================
  Coverage   95.35%   95.35%           
=======================================
  Files         171      171           
  Lines       36801    36805    +4     
=======================================
+ Hits        35090    35094    +4     
  Misses       1711     1711           
Flag Coverage Δ
lint_rules 96.39% <ø> (ø)
loki 95.33% <91.66%> (+<0.01%) ⬆️

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.

@reuterbal reuterbal force-pushed the nabr-macos-ci branch 6 times, most recently from 8990cee to 68ee1be Compare April 20, 2024 21:58
@reuterbal reuterbal force-pushed the nabr-macos-ci branch 2 times, most recently from 5e6ca02 to 2b37aed Compare May 3, 2024 14:47
@reuterbal reuterbal force-pushed the nabr-macos-ci branch 3 times, most recently from f947673 to 623ba41 Compare June 17, 2024 07:56
@reuterbal reuterbal changed the title Run pytest on macos in GH actions, update OS Run pytest on macos in GH actions Jul 27, 2024
@reuterbal reuterbal marked this pull request as ready for review July 27, 2024 18:09
@reuterbal
Copy link
Collaborator Author

I think this is ready for a look. I had to do a few things in addition to ensure compatibility with MacOS, but I think it generally helps to increase being platform-agnostic.

In detail:

  • Improved the CMake recipes, using CMake-internal utilities for the Python environment hacking instead of relying on GNU sed syntax
  • CMake install now ensures it picks a Python version that is supported
  • Added installation instructions for MacOS and updated them for Linux, too
  • I had to add a bit more tolerance in the timeout test
  • I had to disable test_transform_normalize_array_shape_and_access on MacOS. This looks like it might be a genuine memory corruption problem that only triggers on MacOS - documented in Suspected memory corruption in test_transform_normalize_array_shape_and_access #352 for further investigation (but orthogonal to this PR, I think).

Copy link
Collaborator

@mlange05 mlange05 left a comment

Choose a reason for hiding this comment

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

Looks good to me, and very useful in general. Thanks for grinding this one out! 🙏

Only question I have a is about the tuple-comparison changes, but otherwise this looks great. GTG from me once that is answered.

@@ -249,7 +249,7 @@ def test_file_item2(testdir):
)

# Files don't have dependencies (direct dependencies, anyway)
assert item.dependencies is ()
assert isinstance(item.dependencies, tuple) and not item.dependencies
Copy link
Collaborator

Choose a reason for hiding this comment

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

🤨 I'd be curious to know why this is necessary?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Pytest doesn't like is comparison against literals:

 /home/runner/work/loki/loki/loki/batch/tests/test_batch.py:252: SyntaxWarning: "is" with a literal. Did you mean "=="?
  assert item.dependencies is ()

See for example here: https://github.com/ecmwf-ifs/loki/actions/runs/10124810197/job/27999587354#step:8:120

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ok, good to know. Thanks.

@mlange05 mlange05 merged commit 4648105 into main Jul 29, 2024
13 checks passed
@mlange05 mlange05 deleted the nabr-macos-ci branch July 29, 2024 08:21
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.

2 participants