summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgrbd <garlicbready@googlemail.com>2017-06-20 19:09:22 +0100
committergrbd <garlicbready@googlemail.com>2017-06-20 19:09:22 +0100
commitc7e8750d36e818f04fb4c5780c704d504cf2be6d (patch)
tree26cc1c45e53b6935f68d78d728cde9371834e311
parent671d0be2edf7390050b9c32d705f953295f617c7 (diff)
downloadscons-c7e8750d36e818f04fb4c5780c704d504cf2be6d.tar.gz
Moved the test for nested tools to using fixtures
-rw-r--r--test/toolpath/nested.py140
-rw-r--r--test/toolpath/nested/image/SConstruct15
-rw-r--r--test/toolpath/nested/image/site_scons/site_tools/subdir1/Site_TestTool1.py4
-rw-r--r--test/toolpath/nested/image/site_scons/site_tools/subdir1/Site_TestTool3/__init__.py4
-rw-r--r--test/toolpath/nested/image/site_scons/site_tools/subdir1/Site_TestTool3/sconstest.skip0
-rw-r--r--test/toolpath/nested/image/site_scons/site_tools/subdir1/__init__.py0
-rw-r--r--test/toolpath/nested/image/site_scons/site_tools/subdir1/sconstest.skip0
-rw-r--r--test/toolpath/nested/image/site_scons/site_tools/subdir1/subdir2/Site_TestTool2.py4
-rw-r--r--test/toolpath/nested/image/site_scons/site_tools/subdir1/subdir2/__init__.py0
-rw-r--r--test/toolpath/nested/image/site_scons/site_tools/subdir1/subdir2/sconstest.skip0
-rw-r--r--test/toolpath/nested/image/tools/subdir1/Toolpath_TestTool1.py4
-rw-r--r--test/toolpath/nested/image/tools/subdir1/Toolpath_TestTool3/__init__.py4
-rw-r--r--test/toolpath/nested/image/tools/subdir1/Toolpath_TestTool3/sconstest.skip0
-rw-r--r--test/toolpath/nested/image/tools/subdir1/__init__.py0
-rw-r--r--test/toolpath/nested/image/tools/subdir1/sconstest.skip0
-rw-r--r--test/toolpath/nested/image/tools/subdir1/subdir2/Toolpath_TestTool2.py4
-rw-r--r--test/toolpath/nested/image/tools/subdir1/subdir2/__init__.py0
-rw-r--r--test/toolpath/nested/image/tools/subdir1/subdir2/sconstest.skip0
-rw-r--r--test/toolpath/nested/nested.py55
19 files changed, 94 insertions, 140 deletions
diff --git a/test/toolpath/nested.py b/test/toolpath/nested.py
deleted file mode 100644
index 88104a4c..00000000
--- 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 00000000..284f21c5
--- /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 00000000..d4a19a82
--- /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 00000000..60bbd02f
--- /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 00000000..e69de29b
--- /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 00000000..e69de29b
--- /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 00000000..e69de29b
--- /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 00000000..adae55bb
--- /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 00000000..e69de29b
--- /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 00000000..e69de29b
--- /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 00000000..072daf0f
--- /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 00000000..26bc7482
--- /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 00000000..e69de29b
--- /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 00000000..e69de29b
--- /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 00000000..e69de29b
--- /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 00000000..f4ccefee
--- /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 00000000..e69de29b
--- /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 00000000..e69de29b
--- /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 00000000..7304dd57
--- /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: