diff --git a/openscad_testing.py b/openscad_testing.py index 64d96c7..cadbc2f 100644 --- a/openscad_testing.py +++ b/openscad_testing.py @@ -1,5 +1,5 @@ import py - +import os.path from openscad_utils import * @@ -8,12 +8,14 @@ temppath = py.test.ensuretemp('MCAD') def pytest_generate_tests(metafunc): if "modpath" in metafunc.funcargnames: for fpath, modnames in collect_test_modules().items(): + basename = os.path.splitext(os.path.split(str(fpath))[1])[0] #os.system("cp %s %s/" % (fpath, temppath)) if "modname" in metafunc.funcargnames: for modname in modnames: - metafunc.addcall(funcargs=dict(modname=modname, modpath=fpath)) + print modname + metafunc.addcall(id=basename+"/"+modname, funcargs=dict(modname=modname, modpath=fpath)) else: - metafunc.addcall(funcargs=dict(modpath=fpath)) + metafunc.addcall(id=os.path.split(str(fpath))[1], funcargs=dict(modpath=fpath)) def test_module_compile(modname, modpath): diff --git a/openscad_utils.py b/openscad_utils.py index 3f2875e..00d8dd9 100644 --- a/openscad_utils.py +++ b/openscad_utils.py @@ -1,4 +1,4 @@ -import py, re, os, signal, time, commands +import py, re, os, signal, time, commands, sys from subprocess import Popen, PIPE mod_re = (r"\bmodule\s+(", r")\s*\(\s*") @@ -30,7 +30,9 @@ def collect_test_modules(dirpath=None): class Timeout(Exception): pass def call_openscad(path, stlpath, timeout=5): - command = ['openscad', '-s', str(stlpath), str(path)] + if sys.platform == 'darwin': exe = 'OpenSCAD.app/Contents/MacOS/OpenSCAD' + else: exe = 'openscad' + command = [exe, '-s', str(stlpath), str(path)] print command if timeout: try: diff --git a/test_docs.py b/test_docs.py index 043be9a..cbf9b11 100644 --- a/test_docs.py +++ b/test_docs.py @@ -1,15 +1,16 @@ import py +import os.path dirpath = py.path.local("./") def pytest_generate_tests(metafunc): if "filename" in metafunc.funcargnames: for fpath in dirpath.visit('*.scad'): - metafunc.addcall(funcargs=dict(filename=fpath.basename)) + metafunc.addcall(id=fpath.basename, funcargs=dict(filename=fpath.basename)) for fpath in dirpath.visit('*.py'): name = fpath.basename if not (name.startswith('test_') or name.startswith('_')): - metafunc.addcall(funcargs=dict(filename=fpath.basename)) + metafunc.addcall(id=fpath.basename, funcargs=dict(filename=fpath.basename)) def test_README(filename): README = dirpath.join('README').read() diff --git a/triangles.scad b/triangles.scad index 2482d06..357f7d4 100644 --- a/triangles.scad +++ b/triangles.scad @@ -56,7 +56,7 @@ module test_triangles() // Generate a bunch of triangles by angle for (i = [1:85/5]) { - translate([i*7, 20, i*7]) + translate([i*7, 22, i*7]) { a_triangle(i*5, 10, 5); }