We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f2f855a commit f208d37Copy full SHA for f208d37
1 file changed
test/conftest.py
@@ -5,11 +5,26 @@
5
# SPDX-License-Identifier: LGPL-3.0-or-later
6
"""Test configuration."""
7
8
+import os
9
import sys
10
11
import pytest
12
13
14
+@pytest.fixture(autouse=True, scope="session")
15
+def add_cwd_to_syspath():
16
+ """Ensure the current working directory is in sys.path.
17
+
18
+ CFFI and ffcx.main compile/generate files into CWD by default. Without
19
+ this, importlib.import_module cannot find those files when pytest is invoked
20
+ from a directory that is not already on sys.path (e.g. the project root
21
+ rather than the test/ subdirectory).
22
+ """
23
+ cwd = os.getcwd()
24
+ if cwd not in sys.path:
25
+ sys.path.insert(0, cwd)
26
27
28
@pytest.fixture(scope="module")
29
def compile_args():
30
"""Compiler arguments."""
0 commit comments