summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Deegan <bill@baddogconsulting.com>2021-03-18 17:49:39 (GMT)
committerWilliam Deegan <bill@baddogconsulting.com>2021-03-18 17:49:39 (GMT)
commit0573abe24319cae16b5f607fd801903b384363be (patch)
treef0c2253fe6da910d29ba37de8c9a80e0a2d860d6
parent33830b36bc46540c2e85469b6fbab5a72a9c80c3 (diff)
downloadSCons-0573abe24319cae16b5f607fd801903b384363be.zip
SCons-0573abe24319cae16b5f607fd801903b384363be.tar.gz
SCons-0573abe24319cae16b5f607fd801903b384363be.tar.bz2
reorg tests a bit and move new relpath test's SConstruct to a fixture. Also fix copyright text block to be the current preferred version
-rw-r--r--test/File/File-relpath.py (renamed from test/relpath.py)30
-rw-r--r--test/File/File.py (renamed from test/File.py)0
-rw-r--r--test/File/fixture/SConstruct-relpath16
3 files changed, 25 insertions, 21 deletions
diff --git a/test/relpath.py b/test/File/File-relpath.py
index 352a776..e3569dc 100644
--- a/test/relpath.py
+++ b/test/File/File-relpath.py
@@ -1,6 +1,8 @@
#!/usr/bin/env python
#
-# __COPYRIGHT__
+# MIT License
+#
+# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -20,35 +22,21 @@
# 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__"
"""
-Verify ${TARGET.relpath}, ${SOURCE.relpath} match expected path
+Test that .relpath works on file nodes.
+Specifically ${TARGET.relpath}, ${SOURCE.relpath} match expected path
"""
-import TestSCons, os
+import os
+
+import TestSCons
test = TestSCons.TestSCons()
test.subdir('src', ['src', 'dir'])
-test.write('Sconstruct', """\
-import os
-import shutil
-
-import SCons.Defaults
-
-DefaultEnvironment(tools=[])
-Echo = Builder(action = '@echo ${TARGETS.relpath}; echo ${TARGETS.abspath}; echo ${SOURCES.relpath}; echo ${SOURCES.abspath}',
- target_scanner = SCons.Defaults.DirEntryScanner,
- target_factory = Entry,
- source_factory = Entry)
-
-env = Environment(tools=[], BUILDERS = {'Echo': Echo})
-env.Echo(['../foo/dir', 'build/file1'], ['src'])
-""")
+test.file_fixture('fixture/SConstruct-relpath', 'SConstruct')
test.run('-Q', status=0, stdout="""\
../foo/dir build/file1
diff --git a/test/File.py b/test/File/File.py
index bde4449..bde4449 100644
--- a/test/File.py
+++ b/test/File/File.py
diff --git a/test/File/fixture/SConstruct-relpath b/test/File/fixture/SConstruct-relpath
new file mode 100644
index 0000000..16a6e8f
--- /dev/null
+++ b/test/File/fixture/SConstruct-relpath
@@ -0,0 +1,16 @@
+import os
+
+import SCons.Defaults
+
+DefaultEnvironment(tools=[])
+Echo = Builder(action=['@echo ${TARGETS.relpath}',
+ 'echo ${TARGETS.abspath}',
+ 'echo ${SOURCES.relpath}',
+ 'echo ${SOURCES.abspath}'],
+ target_scanner=SCons.Defaults.DirEntryScanner,
+ target_factory=Entry,
+ source_factory=Entry
+ )
+
+env = Environment(tools=[], BUILDERS={'Echo': Echo})
+env.Echo(['../foo/dir', 'build/file1'], ['src'])