Skip to content

Conversation

dpgeorge
Copy link
Member

Summary

Previously, any test needing an SSL certificate file would automatically skip if the file could not be found. But that makes it too easy to accidentally skip tests.

Instead, change it so that the test fails if the certificate file doesn't exist. That matches, for example, the fact that the test fails if networking (LAN, WiFi) is not active.

Testing

Tested on the unix port (files always available, passes), and PYBD_SF6 with and without the files on the local filesystem. It fails without them, passes with them.

Trade-offs and Alternatives

IMO this is a good improvement, it simplifies the test and makes it impossible to accidentally skip it. But it does require users to copy the files across first (as mentioned in the test README).

@dpgeorge dpgeorge added the tests Relates to tests/ directory in source label Aug 12, 2025
@dpgeorge dpgeorge requested a review from projectgus August 12, 2025 00:57
@dpgeorge
Copy link
Member Author

@projectgus I think you had an opinion on this the last time it came up?

Copy link

codecov bot commented Aug 12, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.38%. Comparing base (0ee3f99) to head (5b75bf7).

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #17897   +/-   ##
=======================================
  Coverage   98.38%   98.38%           
=======================================
  Files         171      171           
  Lines       22295    22295           
=======================================
  Hits        21936    21936           
  Misses        359      359           

☔ 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

@projectgus projectgus left a comment

Choose a reason for hiding this comment

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

I think this a good improvement, as it doesn't mask the failures.

IMO the best thing we could do would be to have the test runner check this (maybe by running on the host some well-formed multi_test_setup.py found in the directory before running any tests from that directory, and therefore avoid the whole problem of false-positive failures due to preconditions.

But this is still a good PR, I think. :)

@dpgeorge
Copy link
Member Author

IMO the best thing we could do would be to have the test runner check this (maybe by running on the host some well-formed multi_test_setup.py found in the directory before running any tests from that directory, and therefore avoid the whole problem of false-positive failures due to preconditions.

I guess we could add a multi_net/00_preconditions.py test which would run first and fail.

To actually copy across certificates, there is #16112 which does that.

But this is still a good PR, I think. :)

We can still make all those other improvements (eventually) on top of this PR.

Previously, any test needing an SSL certificate file would automatically
skip if the file could not be found.  But that makes it too easy to
accidentally skip tests.

Instead, change it so that the test fails if the certificate file doesn't
exist.  That matches, for example, the fact that the test fails if
networking (LAN, WiFi) is not active.

Signed-off-by: Damien George <damien@micropython.org>
@dpgeorge dpgeorge force-pushed the tests-ssl-certs-required branch from 5b75bf7 to 2bba507 Compare August 14, 2025 15:03
@dpgeorge dpgeorge merged commit 2bba507 into micropython:master Aug 14, 2025
31 checks passed
@dpgeorge dpgeorge deleted the tests-ssl-certs-required branch August 14, 2025 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests Relates to tests/ directory in source
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants