Skip to content

Commit

Permalink
doc: Add troubleshooting for Cythonized code and pytest (#293069)
Browse files Browse the repository at this point in the history
Cython is a Python compiler that emits native .so modules. By default, python derivations run tests in the wrong directory to see these modules and tests fail.

Issue #255262 documents the root cause and solution for this problem.

This PR adds a description of the problem and the most common solution to the test troubleshooting list.
  • Loading branch information
sarahec authored Mar 20, 2024
1 parent d60c069 commit 2f7f71e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions doc/languages-frameworks/python.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -2014,6 +2014,10 @@ example of such a situation is when `py.test` is used.

* Tests that attempt to access `$HOME` can be fixed by using the following
work-around before running tests (e.g. `preCheck`): `export HOME=$(mktemp -d)`
* Compiling with Cython causes tests to fail with a `ModuleNotLoadedError`.
This can be fixed with two changes in the derivation: 1) replacing `pytest` with
`pytestCheckHook` and 2) adding a `preCheck` containing `cd $out` to run
tests within the built output.

## Contributing {#contributing}

Expand Down

0 comments on commit 2f7f71e

Please sign in to comment.