diff options
Diffstat (limited to 'test/toolpath')
19 files changed, 94 insertions, 140 deletions
diff --git a/test/toolpath/nested.py b/test/toolpath/nested.py deleted file mode 100644 index 88104a4..0000000 --- a/test/toolpath/nested.py +++ /dev/null @@ -1,140 +0,0 @@ -#!/usr/bin/env python -# -# __COPYRIGHT__ -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" - -import os.path -import TestSCons - -test = TestSCons.TestSCons() - - -test.write('SConstruct', """ -# Test where tools are located under site_scons/site_tools -env1 = Environment(tools=['subdir1.Site_TestTool1', 'subdir1.subdir2.Site_TestTool2', 'subdir1.Site_TestTool3']) -print("env1['Site_TestTool1'] =", env1.get('Site_TestTool1')) -print("env1['Site_TestTool2'] =", env1.get('Site_TestTool2')) -print("env1['Site_TestTool3'] =", env1.get('Site_TestTool3')) - -# Test where toolpath is set in the env constructor -env2 = Environment(tools=['subdir1.Toolpath_TestTool1', 'subdir1.subdir2.Toolpath_TestTool2', 'subdir1.Toolpath_TestTool3'], toolpath=['tools']) -print("env2['Toolpath_TestTool1'] =", env2.get('Toolpath_TestTool1')) -print("env2['Toolpath_TestTool2'] =", env2.get('Toolpath_TestTool2')) -print("env2['Toolpath_TestTool3'] =", env2.get('Toolpath_TestTool3')) - -base = Environment(tools=[], toolpath=['tools']) -derived = base.Clone(tools=['subdir1.Toolpath_TestTool1']) -print("derived['Toolpath_TestTool1'] =", derived.get('Toolpath_TestTool1')) -""") - - -# Test where tools are located under site_scons/site_tools -test.subdir('site_scons', ['site_scons', 'site_tools']) - -# One level down - site_scons/site_tools -test.subdir(['site_scons', 'site_tools', 'subdir1']) -test.write(['site_scons', 'site_tools', 'subdir1', '__init__.py'], '') -test.write(['site_scons', 'site_tools', 'subdir1', 'Site_TestTool1.py'], r"""\ -def generate(env): - env['Site_TestTool1'] = 1 -def exists(env): - return 1 -""") - -# Two levels down - site_scons/site_tools -test.subdir(['site_scons', 'site_tools', 'subdir1', 'subdir2']) -test.write(['site_scons', 'site_tools', 'subdir1', 'subdir2', '__init__.py'], '') -test.write(['site_scons', 'site_tools', 'subdir1', 'subdir2', 'Site_TestTool2.py'], r"""\ -def generate(env): - env['Site_TestTool2'] = 1 -def exists(env): - return 1 -""") - -# Two levels down - site_scons/site_tools - using __init__.py within a directory -test.subdir(['site_scons', 'site_tools', 'subdir1', 'Site_TestTool3']) -test.write(['site_scons', 'site_tools', 'subdir1', 'Site_TestTool3', '__init__.py'], r"""\ -def generate(env): - env['Site_TestTool3'] = 1 -def exists(env): - return 1 -""") - - -# Test where toolpath is set in the env constructor -test.subdir('tools') - -# One level down - tools -test.subdir(['tools', 'subdir1']) -test.write(['tools', 'subdir1', '__init__.py'], '') -test.write(['tools', 'subdir1', 'Toolpath_TestTool1.py'], r"""\ -def generate(env): - env['Toolpath_TestTool1'] = 1 -def exists(env): - return 1 -""") - -# Two levels down - tools -test.subdir(['tools', 'subdir1', 'subdir2']) -test.write(['tools', 'subdir1', 'subdir2', '__init__.py'], '') -test.write(['tools', 'subdir1', 'subdir2', 'Toolpath_TestTool2.py'], r"""\ -def generate(env): - env['Toolpath_TestTool2'] = 1 -def exists(env): - return 1 -""") - -# Two levels down - tools - using __init__.py within a directory -test.subdir(['tools', 'subdir1', 'Toolpath_TestTool3']) -test.write(['tools', 'subdir1', 'Toolpath_TestTool3', '__init__.py'], r"""\ -def generate(env): - env['Toolpath_TestTool3'] = 1 -def exists(env): - return 1 -""") - - - -test.run(arguments = '.', stdout = """\ -scons: Reading SConscript files ... -env1['Site_TestTool1'] = 1 -env1['Site_TestTool2'] = 1 -env1['Site_TestTool3'] = 1 -env2['Toolpath_TestTool1'] = 1 -env2['Toolpath_TestTool2'] = 1 -env2['Toolpath_TestTool3'] = 1 -derived['Toolpath_TestTool1'] = 1 -scons: done reading SConscript files. -scons: Building targets ... -scons: `.' is up to date. -scons: done building targets. -""") - -test.pass_test() - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/toolpath/nested/image/SConstruct b/test/toolpath/nested/image/SConstruct new file mode 100644 index 0000000..284f21c --- /dev/null +++ b/test/toolpath/nested/image/SConstruct @@ -0,0 +1,15 @@ +# Test where tools are located under site_scons/site_tools
+env1 = Environment(tools=['subdir1.Site_TestTool1', 'subdir1.subdir2.Site_TestTool2', 'subdir1.Site_TestTool3'])
+print("env1['Site_TestTool1'] =", env1.get('Site_TestTool1'))
+print("env1['Site_TestTool2'] =", env1.get('Site_TestTool2'))
+print("env1['Site_TestTool3'] =", env1.get('Site_TestTool3'))
+
+# Test where toolpath is set in the env constructor
+env2 = Environment(tools=['subdir1.Toolpath_TestTool1', 'subdir1.subdir2.Toolpath_TestTool2', 'subdir1.Toolpath_TestTool3'], toolpath=['tools'])
+print("env2['Toolpath_TestTool1'] =", env2.get('Toolpath_TestTool1'))
+print("env2['Toolpath_TestTool2'] =", env2.get('Toolpath_TestTool2'))
+print("env2['Toolpath_TestTool3'] =", env2.get('Toolpath_TestTool3'))
+
+base = Environment(tools=[], toolpath=['tools'])
+derived = base.Clone(tools=['subdir1.Toolpath_TestTool1'])
+print("derived['Toolpath_TestTool1'] =", derived.get('Toolpath_TestTool1'))
diff --git a/test/toolpath/nested/image/site_scons/site_tools/subdir1/Site_TestTool1.py b/test/toolpath/nested/image/site_scons/site_tools/subdir1/Site_TestTool1.py new file mode 100644 index 0000000..d4a19a8 --- /dev/null +++ b/test/toolpath/nested/image/site_scons/site_tools/subdir1/Site_TestTool1.py @@ -0,0 +1,4 @@ +def generate(env):
+ env['Site_TestTool1'] = 1
+def exists(env):
+ return 1
diff --git a/test/toolpath/nested/image/site_scons/site_tools/subdir1/Site_TestTool3/__init__.py b/test/toolpath/nested/image/site_scons/site_tools/subdir1/Site_TestTool3/__init__.py new file mode 100644 index 0000000..60bbd02 --- /dev/null +++ b/test/toolpath/nested/image/site_scons/site_tools/subdir1/Site_TestTool3/__init__.py @@ -0,0 +1,4 @@ +def generate(env):
+ env['Site_TestTool3'] = 1
+def exists(env):
+ return 1
diff --git a/test/toolpath/nested/image/site_scons/site_tools/subdir1/Site_TestTool3/sconstest.skip b/test/toolpath/nested/image/site_scons/site_tools/subdir1/Site_TestTool3/sconstest.skip new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/toolpath/nested/image/site_scons/site_tools/subdir1/Site_TestTool3/sconstest.skip diff --git a/test/toolpath/nested/image/site_scons/site_tools/subdir1/__init__.py b/test/toolpath/nested/image/site_scons/site_tools/subdir1/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/toolpath/nested/image/site_scons/site_tools/subdir1/__init__.py diff --git a/test/toolpath/nested/image/site_scons/site_tools/subdir1/sconstest.skip b/test/toolpath/nested/image/site_scons/site_tools/subdir1/sconstest.skip new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/toolpath/nested/image/site_scons/site_tools/subdir1/sconstest.skip diff --git a/test/toolpath/nested/image/site_scons/site_tools/subdir1/subdir2/Site_TestTool2.py b/test/toolpath/nested/image/site_scons/site_tools/subdir1/subdir2/Site_TestTool2.py new file mode 100644 index 0000000..adae55b --- /dev/null +++ b/test/toolpath/nested/image/site_scons/site_tools/subdir1/subdir2/Site_TestTool2.py @@ -0,0 +1,4 @@ +def generate(env):
+ env['Site_TestTool2'] = 1
+def exists(env):
+ return 1
diff --git a/test/toolpath/nested/image/site_scons/site_tools/subdir1/subdir2/__init__.py b/test/toolpath/nested/image/site_scons/site_tools/subdir1/subdir2/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/toolpath/nested/image/site_scons/site_tools/subdir1/subdir2/__init__.py diff --git a/test/toolpath/nested/image/site_scons/site_tools/subdir1/subdir2/sconstest.skip b/test/toolpath/nested/image/site_scons/site_tools/subdir1/subdir2/sconstest.skip new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/toolpath/nested/image/site_scons/site_tools/subdir1/subdir2/sconstest.skip diff --git a/test/toolpath/nested/image/tools/subdir1/Toolpath_TestTool1.py b/test/toolpath/nested/image/tools/subdir1/Toolpath_TestTool1.py new file mode 100644 index 0000000..072daf0 --- /dev/null +++ b/test/toolpath/nested/image/tools/subdir1/Toolpath_TestTool1.py @@ -0,0 +1,4 @@ +def generate(env):
+ env['Toolpath_TestTool1'] = 1
+def exists(env):
+ return 1
diff --git a/test/toolpath/nested/image/tools/subdir1/Toolpath_TestTool3/__init__.py b/test/toolpath/nested/image/tools/subdir1/Toolpath_TestTool3/__init__.py new file mode 100644 index 0000000..26bc748 --- /dev/null +++ b/test/toolpath/nested/image/tools/subdir1/Toolpath_TestTool3/__init__.py @@ -0,0 +1,4 @@ +def generate(env):
+ env['Toolpath_TestTool3'] = 1
+def exists(env):
+ return 1
diff --git a/test/toolpath/nested/image/tools/subdir1/Toolpath_TestTool3/sconstest.skip b/test/toolpath/nested/image/tools/subdir1/Toolpath_TestTool3/sconstest.skip new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/toolpath/nested/image/tools/subdir1/Toolpath_TestTool3/sconstest.skip diff --git a/test/toolpath/nested/image/tools/subdir1/__init__.py b/test/toolpath/nested/image/tools/subdir1/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/toolpath/nested/image/tools/subdir1/__init__.py diff --git a/test/toolpath/nested/image/tools/subdir1/sconstest.skip b/test/toolpath/nested/image/tools/subdir1/sconstest.skip new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/toolpath/nested/image/tools/subdir1/sconstest.skip diff --git a/test/toolpath/nested/image/tools/subdir1/subdir2/Toolpath_TestTool2.py b/test/toolpath/nested/image/tools/subdir1/subdir2/Toolpath_TestTool2.py new file mode 100644 index 0000000..f4ccefe --- /dev/null +++ b/test/toolpath/nested/image/tools/subdir1/subdir2/Toolpath_TestTool2.py @@ -0,0 +1,4 @@ +def generate(env):
+ env['Toolpath_TestTool2'] = 1
+def exists(env):
+ return 1
diff --git a/test/toolpath/nested/image/tools/subdir1/subdir2/__init__.py b/test/toolpath/nested/image/tools/subdir1/subdir2/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/toolpath/nested/image/tools/subdir1/subdir2/__init__.py diff --git a/test/toolpath/nested/image/tools/subdir1/subdir2/sconstest.skip b/test/toolpath/nested/image/tools/subdir1/subdir2/sconstest.skip new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/toolpath/nested/image/tools/subdir1/subdir2/sconstest.skip diff --git a/test/toolpath/nested/nested.py b/test/toolpath/nested/nested.py new file mode 100644 index 0000000..7304dd5 --- /dev/null +++ b/test/toolpath/nested/nested.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +import os.path +import TestSCons + +test = TestSCons.TestSCons() + +test.dir_fixture('image') + +test.run(arguments = '.', stdout = """\ +scons: Reading SConscript files ... +env1['Site_TestTool1'] = 1 +env1['Site_TestTool2'] = 1 +env1['Site_TestTool3'] = 1 +env2['Toolpath_TestTool1'] = 1 +env2['Toolpath_TestTool2'] = 1 +env2['Toolpath_TestTool3'] = 1 +derived['Toolpath_TestTool1'] = 1 +scons: done reading SConscript files. +scons: Building targets ... +scons: `.' is up to date. +scons: done building targets. +""") + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: |