about summary refs log tree commit diff
path: root/doc/languages-frameworks
diff options
context:
space:
mode:
authorSarah Clark <seclark@nextquestion.net>2024-03-20 06:21:09 -0700
committerGitHub <noreply@github.com>2024-03-20 14:21:09 +0100
commit2f7f71ea58687ca173ef6b972027e22e09542437 (patch)
tree7416bd1c210bad101239986f57e19bac23875f35 /doc/languages-frameworks
parentd60c069a65f49ef90f969f215d23d7ef0478337c (diff)
doc: Add troubleshooting for Cythonized code and pytest (#293069)
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.
Diffstat (limited to 'doc/languages-frameworks')
-rw-r--r--doc/languages-frameworks/python.section.md4
1 files changed, 4 insertions, 0 deletions
diff --git a/doc/languages-frameworks/python.section.md b/doc/languages-frameworks/python.section.md
index fa7f3eddf72c6..4ca177bcdd260 100644
--- a/doc/languages-frameworks/python.section.md
+++ b/doc/languages-frameworks/python.section.md
@@ -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}