You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: add instructions for test coverage in integration tests (#967)
This update adds a new section to the troubleshooting documentation
explaining how to collect code coverage from worker subprocesses
when using executorlib. It also adds a link to this new section
in the main README.
The solution involves configuring coverage.py with the subprocess
patch and using 'coverage combine' to merge results from the main
process and workers.
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Co-authored-by: jan-janssen <3854739+jan-janssen@users.noreply.github.com>
Copy file name to clipboardExpand all lines: docs/trouble_shooting.md
+19Lines changed: 19 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -31,6 +31,25 @@ Typical error messages related to missing dependencies are `ModuleNotFoundError`
31
31
*`ModuleNotFoundError: No module named 'h5py'` - Install [h5py](https://www.h5py.org/) as explained in the [Caching](https://executorlib.readthedocs.io/en/latest/installation.html#caching) section of the installation.
32
32
*`ModuleNotFoundError: No module named 'networkx'` - Install [networkx](https://networkx.org/) as explained in the [Visualisation](https://executorlib.readthedocs.io/en/latest/installation.html#visualisation) section of the installation.
33
33
34
+
## Test Coverage for Integration Tests
35
+
When Python functions are executed with executorlib, they run in subprocesses started via `sys.executable`. As a result, `coverage run`
36
+
only tracks the main test process by default and can miss function execution inside executorlib workers.
37
+
38
+
To collect coverage from both the main process and executorlib subprocesses, enable the subprocess patch in your project configuration:
39
+
```toml
40
+
[tool.coverage.run]
41
+
patch = ["subprocess"]
42
+
```
43
+
44
+
Then execute:
45
+
```bash
46
+
coverage run -m unittest discover
47
+
coverage combine
48
+
coverage report
49
+
```
50
+
51
+
The `coverage combine` command merges the data from the main process and subprocesses.
52
+
34
53
## Python Version
35
54
Executorlib supports all current Python version ranging from 3.9 to 3.13. Still some of the dependencies and especially
36
55
the [flux](http://flux-framework.org) job scheduler are currently limited to Python 3.12 and below. Consequently for high
0 commit comments