For roughly the past month, I have collected data on flaky CI tests. The initial idea was to mark them as flaky, but as per pytest's docs on flaky tests, that should never be a long-term solution. Instead, tests should be (randomly) re-ordered, re-written for more atomic assertions, or split up into different groups to find the root cause of the flaky behavior and eliminate it. We will have to see when time permits this. For now, we could mark them as flaky to save us from re-running them manually.
Here are the flaky tests of this repository I gathered so far:
Flaky tests
Auxiliary
Some error message are common and so long that they would render the table even more complex than it already is. They are included here and referenced by their names in the table below.
nbclient.exceptions.CellTimeoutError: A cell timed out while it was being executed, after 10 seconds.
The message was: Cell execution timed out.
Here is a preview of the cell contents:
-------------------
# Load reticulate, used to access the Python API from R
library(reticulate)
# Import ixmp and message_ix, just as in Python
ixmp <- import("ixmp")
-------------------
nbclient.exceptions.CellTimeoutError: A cell timed out while it was being executed, after 10 seconds.
The message was: Cell execution timed out.
Here is a preview of the cell contents:
-------------------
# load required packages
import pandas as pd
import ixmp
-------------------
nbclient.exceptions.CellTimeoutError: A cell timed out while it was being executed, after 10 seconds.
The message was: Cell execution timed out.
Here is a preview of the cell contents:
-------------------
# launch the ix modeling platform using the local default database
mp <- ixmp$Platform()
-------------------
Runtime error DB connection {#runtime-error-db-connection}
DB connection cannot be closed {#db-connection-cannot-be-closed}
AssertionError: assert 'Database connection could not be closed or was already closed' in ''
+ where '' = CaptureResult(out='', err='').out
DB connection message wrong {#db-connection-message-wrong}
assert "connected to database 'jdbc:hsqldb:mem://ixmptest' (user: ixmp)..." in ''
+ where '' = CaptureResult(out='', err='').out
Note that windows-latest-py3.10 had this additional information once:
where '' = CaptureResult(out='', err="2023-07-03 12:58:22,174 INFO at.ac.iiasa.ixmp.Platform:182 - closed the connection to database 'jdbc:hsqldb:mem://ixmptest'\r\n2023-07-03 12:58:22,180 INFO at.ac.iiasa.ixmp.Platform:165 - Welcome to the IX modeling platform!\r\n2023-07-03 12:58:22,180 INFO at.ac.iiasa.ixmp.Platform:166 - connected to database 'jdbc:hsqldb:mem://ixmptest' (user: ixmp)...\r\n").out
Names are shortened to ixmp/tests as the starting directory. Grouping the tests by names shows commonalities between them. All notebook cell timeout originate on macos, while ubuntu and windows only struggle with DB connections. Windows in particular seems to have trouble closing the DB connection either too early or not at all.
For future reference: the flaky tests on the backend seem to be related to pytest's capfd not capturing stdout and stderr reliably on Windows. See also https://github.com/pytest-dev/pytest/issues/10843.
For roughly the past month, I have collected data on flaky CI tests. The initial idea was to mark them as flaky, but as per pytest's docs on flaky tests, that should never be a long-term solution. Instead, tests should be (randomly) re-ordered, re-written for more atomic assertions, or split up into different groups to find the root cause of the flaky behavior and eliminate it. We will have to see when time permits this. For now, we could mark them as flaky to save us from re-running them manually. Here are the flaky tests of this repository I gathered so far:
Flaky tests
Auxiliary
Some error message are common and so long that they would render the table even more complex than it already is. They are included here and referenced by their names in the table below.
Notebook cell timeout reticulate {#notebook-cell-timeout-reticulate}
Notebook cell timeout import packages {#notebook-cell-timeout-import-packages}
Notebook cell timeout platform {#notebook-cell-timeout-platform}
Runtime error DB connection {#runtime-error-db-connection}
DB connection cannot be closed {#db-connection-cannot-be-closed}
DB connection message wrong {#db-connection-message-wrong}
Note that windows-latest-py3.10 had this additional information once:
Names are shortened to
ixmp/tests
as the starting directory. Grouping the tests by names shows commonalities between them. All notebook cell timeout originate on macos, while ubuntu and windows only struggle with DB connections. Windows in particular seems to have trouble closing the DB connection either too early or not at all.ConnectionRefusedError: [Errno 61] Connection refused
AssertionError: ResourceWarning("unclosed file <_io.BufferedReader name='/tmp/pytest-of-runner/pytest-0/test_read_excel_big0/output.xlsx'>") assert 1 == 0 where 1 = len(WarningsRecorder(record=True))