summaryrefslogtreecommitdiffstats
path: root/test/Configure
diff options
context:
space:
mode:
authorWilliam Deegan <bill@baddogconsulting.com>2020-02-16 04:36:39 (GMT)
committerWilliam Deegan <bill@baddogconsulting.com>2020-02-16 04:36:39 (GMT)
commit03dbdfc91995b4b9bd3360eafa0dead73a7019d3 (patch)
treefe233e12b5071d29d2a3fb2c10edebdbed614f4d /test/Configure
parent348f8d81b6aa49d8798eac268700806d121c5f4f (diff)
downloadSCons-03dbdfc91995b4b9bd3360eafa0dead73a7019d3.zip
SCons-03dbdfc91995b4b9bd3360eafa0dead73a7019d3.tar.gz
SCons-03dbdfc91995b4b9bd3360eafa0dead73a7019d3.tar.bz2
Fix Issue #2904 - add useful error message when more than one Configure() contexts are opened
Diffstat (limited to 'test/Configure')
-rw-r--r--test/Configure/fixture/SConstruct.issue-29065
-rw-r--r--test/Configure/issue-2906-useful-duplicate-configure-message.py57
2 files changed, 62 insertions, 0 deletions
diff --git a/test/Configure/fixture/SConstruct.issue-2906 b/test/Configure/fixture/SConstruct.issue-2906
new file mode 100644
index 0000000..7763653
--- /dev/null
+++ b/test/Configure/fixture/SConstruct.issue-2906
@@ -0,0 +1,5 @@
+env = Environment()
+conf1 = Configure(env)
+env2 = Environment()
+# Error right here. You can't have two configure contexts in flight at the same time.
+conf2 = Configure(env2) \ No newline at end of file
diff --git a/test/Configure/issue-2906-useful-duplicate-configure-message.py b/test/Configure/issue-2906-useful-duplicate-configure-message.py
new file mode 100644
index 0000000..716cb33
--- /dev/null
+++ b/test/Configure/issue-2906-useful-duplicate-configure-message.py
@@ -0,0 +1,57 @@
+#!/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__"
+
+"""
+Verify useful error message when you create a second Configure context without
+finalizing the previous one via conf.Finish()
+This addresses Issue 2906:
+https://github.com/SCons/scons/issues/2906
+"""
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+test.verbose_set(1)
+
+test.file_fixture('./fixture/SConstruct.issue-2906', 'SConstruct')
+
+test_SConstruct_path = test.workpath('SConstruct')
+
+expected_stdout = "scons: Reading SConscript files ...\n"
+
+expected_stderr = """
+scons: *** User Called Configure() when another Configure() exists.
+ Please call .Finish() before creating and second Configure() context
+File "%s", line 5, in <module>\n"""%test_SConstruct_path
+test.run(stderr=expected_stderr, stdout=expected_stdout, status=2)
+
+test.pass_test()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4: