Merge pull request #416 from olitheolix/python3_quicktest

Python3 quicktest
pull/419/head
Alexander Gessler 2014-11-23 09:56:29 +01:00
commit e707a07ff9
2 changed files with 23 additions and 18 deletions

View File

@ -177,7 +177,7 @@ def _init(self, target = None, parent = None):
"and quads. Try to load your mesh with" "and quads. Try to load your mesh with"
" a post-processing to triangulate your" " a post-processing to triangulate your"
" faces.") " faces.")
sys.exit(1) raise e
else: # starts with 'm' but not iterable else: # starts with 'm' but not iterable

View File

@ -9,16 +9,23 @@ data structures in detail. It just verifies whether basic
loading and querying of 3d models using pyassimp works. loading and querying of 3d models using pyassimp works.
""" """
import os
import sys
# Make the development (ie. GIT repo) version of PyAssimp available for import.
sys.path.insert(0, '..')
import sys,os
import sample import sample
from pyassimp import errors from pyassimp import errors
# paths to be walkd recursively # Paths to model files.
basepaths = [os.path.join('..','..','..','test','models'), os.path.join('..','..','..','test','models-nonbsd')] basepaths = [os.path.join('..', '..', '..', 'test', 'models'),
os.path.join('..', '..', '..', 'test', 'models-nonbsd')]
# Valid extensions for 3D model files.
extensions = ['.3ds', '.x', '.lwo', '.obj', '.md5mesh', '.dxf', '.ply', '.stl',
'.dae', '.md5anim', '.lws', '.irrmesh', '.nff', '.off', '.blend']
# file extensions to be considered
extensions = ['.3ds','.x','.lwo','.obj','.md5mesh','.dxf','.ply','.stl','.dae','.md5anim','.lws','.irrmesh','.nff','.off','.blend']
def run_tests(): def run_tests():
ok, err = 0, 0 ok, err = 0, 0
@ -32,17 +39,15 @@ def run_tests():
sample.main(os.path.join(root, afile)) sample.main(os.path.join(root, afile))
ok += 1 ok += 1
except errors.AssimpError as error: except errors.AssimpError as error:
# assimp error is fine, this is a controlled case # Assimp error is fine; this is a controlled case.
print error print(error)
err += 1 err += 1
except Exception: except Exception:
print("Error encountered while loading <%s>"%os.path.join(root,afile)) print("Error encountered while loading <%s>"
print('** Loaded %s models, got controlled errors for %s files' % (ok,err)) % os.path.join(root, afile))
print('** Loaded %s models, got controlled errors for %s files'
% (ok, err))
if __name__ == '__main__': if __name__ == '__main__':
run_tests() run_tests()