add_dll_directory to specify dll paths on windows #10692
-
hello, I've been working on update of a (somewhat complex) program from python 3.7 to 3.10. Our application uses a swig to generate a number of pyd files that reference dlls on windows. Due to quirks of our build, the pyd and dll files are not in the same directory. In python 3.8+, this causes some issues as our previous method of adding the paths to This is fine for our normal executable. I can add the directories as required in the main python module and python is able to import the dlls in the pyd libraries. However, for pytest, I'm seeing errors such as these when I attempt to use existing unittests with python 3.10:
The pyd file can't find the dll dependency. Adding Does anybody know where I should define the paths such that pytest can load the module? Reading the doc, I do see that there's a Just to confirm, all my unittests do pass if I copy my dlls into the same directory as the pyd files. I can update my builds to do this, but I was hoping to keep my updates to a minimum. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi, Try adding your |
Beta Was this translation helpful? Give feedback.
Hi,
Try adding your
os.add_dll_directory
call to your top-mostconftest.py
file. pytest loads the top-mostconftest.py
file before starting to load the test modules, so this should work.