From 1decdf999c430803a7ab3abb2a9042217a8e5bd4 Mon Sep 17 00:00:00 2001 From: aramis_acg Date: Tue, 19 Apr 2011 20:51:59 +0000 Subject: [PATCH] + really add rudimentary test script to batch-load all test files using pyassimp git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@952 67173fc5-114c-0410-ac8e-9d2fd5bffc1f --- port/PyAssimp/quicktest.py | 45 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100755 port/PyAssimp/quicktest.py diff --git a/port/PyAssimp/quicktest.py b/port/PyAssimp/quicktest.py new file mode 100755 index 000000000..e01a49fa5 --- /dev/null +++ b/port/PyAssimp/quicktest.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python +#-*- coding: UTF-8 -*- + +""" +This module uses the sample.py script to load all test models it finds. + +Note: this is not an exhaustive test suite, it does not check the +data structures in detail. It just verifies whether basic +loading and querying of 3d models using pyassimp works. +""" + + +import sys,os +import sample +from pyassimp import pyassimp,errors + +# paths to be walkd recursively +basepaths = [os.path.join('..','..','test','models'), os.path.join('..','..','test','models-nonbsd')] + +# file extensions to be considered +extensions = ['.3ds','.x','.lwo','.obj','.md5mesh','.dxf','.ply','.stl','.dae','.md5anim','.lws','.irrmesh','.nff','.off','.blend'] + +def run_tests(): + ok,err = 0,0 + for path in basepaths: + for root, dirs, files in os.walk(path): + for afile in files: + base,ext = os.path.splitext(afile) + if ext in extensions: + try: + sample.main(os.path.join(root,afile)) + ok += 1 + except errors.AssimpError as error: + # assimp error is fine, this is a controlled case + print error + err += 1 + print '** Loaded %s models, got controlled errors for %s files' % (ok,err) + + +if __name__ == '__main__': + run_tests() + + + +