-
Notifications
You must be signed in to change notification settings - Fork 42
Stuck on a mysterious error during CI?
Romain Hugonnet edited this page Aug 8, 2022
·
12 revisions
Sometimes, tests pass locally but not during CI in GitHub Actions. Those errors can be hard to track down because they are linked to building the documentation or checks of example codes.
Here's a short list of such known errors that can happen, to avoid being stuck on those again once we've lost track months (years?) later:
-
The typical: Package versions tend to change during CI's setup, updating to newest versions. Quite often those contain new warning about future deprecations or syntax changes. Those can be impossible to correct in our own package if they depend on another package (e.g.
numpy
warning in ascikit
package), and can result in failure during tests. Solution: list those in the exclusion list of specific tests or, in case of the documentation test, in a dedicated list found intests/test_docs.py
:
ignored_warnings = ["Starting a Matplotlib GUI outside of the main thread",
".*fetching the attribute.*Polygon.*",]
-
The sneaky: Defining a function with
def
in an example code (in/docs/source/code
, which is used to check that the code snapshots shown in our documentation do work or to create documentation-specific figures) will result in a failure of the CI in GitHub Actions. This failure happens for theexec()
in the functiontest_example_code
intests/test_docs.py
. This issue is related to defining global variables throughexec()
, details here. Solution: use alambda
function, or define the function directly inxdem
!
exec(infile.read().replace("plt.show()", "plt.close()"))
- The mysterious: Building sphinx during CI in GitHub Actions with several cores might result in failure. The cause is as-yet unknown (tried reverting to older sphinx versions without any success). Solution: use a single core.
sphinx.cmd.build.main(["-j", str(N_cores), os.path.join(self.docs_dir, "source/"), os.path.join(self.docs_dir, "build/html")])