Skip to content

Commit

Permalink
Fix nosetest for win, py3.8
Browse files Browse the repository at this point in the history
  • Loading branch information
Besler committed Dec 12, 2019
1 parent a56b170 commit ddb0c4e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
4 changes: 3 additions & 1 deletion conda-recipe/vtkbone/bld.bat
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,7 @@ set PATH=%PATH%;%PREFIX%\\Library\\lib;%PREFIX%\\Library\\bin
set PYTHONPATH=%PYTHONPATH%;%PREFIX%\\Lib\\site-packages

:: Run tests
nosetests "%SRC_DIR%\Testing\Python"
:: Note that for >=py3.8, DLL look up no longer goes through `PATH`.
:: This is a hack to make nose run by adding dll's inside python
python %RECIPE_DIR%/test_windows.py %SRC_DIR%/Testing/Python
if errorlevel 1 exit 1
27 changes: 27 additions & 0 deletions conda-recipe/vtkbone/test_windows.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# This is a custom implementation of nosetests for testing
# the conda build on Python 3.8. The %PATH% variable is no
# longer used for resolving DLLs so they must be added
# using `os.add_dll_directory("%PATH%)"`
#
# Assuming %PREFIX$ is a defined environment variable
# Pass the test to run as normal

# -*- coding: utf-8 -*-
import re
import sys
import os

from nose import run_exit

if __name__ == '__main__':
PREFIX = os.getenv('PREFIX')
if hasattr(os, 'add_dll_directory'):
os.add_dll_directory(os.path.join(
PREFIX, 'Library', 'lib'
))
os.add_dll_directory(os.path.join(
PREFIX, 'Library', 'bin'
))

sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
sys.exit(run_exit())

0 comments on commit ddb0c4e

Please sign in to comment.