From 4e10d188042815c5285edf00ea96896b862e0863 Mon Sep 17 00:00:00 2001 From: aurium Date: Thu, 9 Apr 2009 15:02:04 +0000 Subject: [PATCH] more one step for the extension tests --- share/extensions/Makefile.am | 4 +- .../{foldable-box.inx => foldablebox.inx} | 4 +- .../{foldable-box.py => foldablebox.py} | 0 share/extensions/test/foldablebox.test.py | 21 +++++++++ share/extensions/test/run-all-extension-tests | 45 +++++++++++++++++++ 5 files changed, 70 insertions(+), 4 deletions(-) rename share/extensions/{foldable-box.inx => foldablebox.inx} (87%) rename share/extensions/{foldable-box.py => foldablebox.py} (100%) create mode 100755 share/extensions/test/foldablebox.test.py create mode 100755 share/extensions/test/run-all-extension-tests diff --git a/share/extensions/Makefile.am b/share/extensions/Makefile.am index 7fac49c5c..e168082d8 100644 --- a/share/extensions/Makefile.am +++ b/share/extensions/Makefile.am @@ -54,7 +54,7 @@ extensions = \ ffgeom.py\ fig2dev-ext.py \ flatten.py \ - foldable-box.py \ + foldablebox.py \ fractalize.py \ funcplot.py \ gears.py\ @@ -174,7 +174,7 @@ modules = \ extrude.inx \ fig_input.inx \ flatten.inx \ - foldable-box.inx \ + foldablebox.inx \ fractalize.inx \ funcplot.inx \ gears.inx\ diff --git a/share/extensions/foldable-box.inx b/share/extensions/foldablebox.inx similarity index 87% rename from share/extensions/foldable-box.inx rename to share/extensions/foldablebox.inx index e53bc8b74..1935a7a88 100644 --- a/share/extensions/foldable-box.inx +++ b/share/extensions/foldablebox.inx @@ -2,7 +2,7 @@ <_name>Foldable Box org.inkscape.render.foldable-box - foldable-box.py + foldablebox.py inkex.py 10.0 15.0 @@ -24,6 +24,6 @@ diff --git a/share/extensions/foldable-box.py b/share/extensions/foldablebox.py similarity index 100% rename from share/extensions/foldable-box.py rename to share/extensions/foldablebox.py diff --git a/share/extensions/test/foldablebox.test.py b/share/extensions/test/foldablebox.test.py new file mode 100755 index 000000000..814f10eae --- /dev/null +++ b/share/extensions/test/foldablebox.test.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python + +import sys +sys.path.append('..') # this line allows to import the extension code + +import unittest, calendar +from foldablebox import * + +class FoldableBoxArguments(unittest.TestCase): + + #def setUp(self): + + def test_default_names_list(self): + args = [ 'minimal-blank.svg' ] + e = FoldableBox() + e.affect( args, False ) + self.assertEqual( e.options.width, 10.0 ) + +if __name__ == '__main__': + unittest.main() + diff --git a/share/extensions/test/run-all-extension-tests b/share/extensions/test/run-all-extension-tests new file mode 100755 index 000000000..db3ddd9c2 --- /dev/null +++ b/share/extensions/test/run-all-extension-tests @@ -0,0 +1,45 @@ +#!/bin/bash + +echo " + ######################### + Extension Tests + #########################" + +cd "$(dirname "$0")" + +has_py_coverage=false +py_cover_files=$( mktemp ) + +if coverage.py -e >/dev/null 2>/dev/null; then + has_py_coverage=true + cover_py_cmd=coverage.py +else + if coverage -e >/dev/null 2>/dev/null; then + has_py_coverage=true + cover_py_cmd=coverage + fi +fi + +#if $has_py_coverage; then +# $cover_py_cmd -e +#fi + +function run_py_test() { + echo -e "\n>> Testing $1" + if $has_py_coverage; then + $cover_py_cmd -x "$1.test.py" + echo "../$1.py" >> $py_cover_files + else + python "$1.test.py" + fi +} + +run_py_test svgcalendar +run_py_test foldablebox + +echo "" +if $has_py_coverage; then + cat $py_cover_files | xargs $cover_py_cmd -r +fi + +rm $py_cover_files -- 2.30.2