From 5fa8009133ed8bd61828fafae4f0a14869fc8c23 Mon Sep 17 00:00:00 2001 From: Joachim Kuebart Date: Tue, 11 Aug 2020 20:50:31 +0200 Subject: Convert new e2e test to file fixture. --- test/SConscript/fixture/SConstruct | 17 +++++++++++++++++ test/SConscript/must_exist_deprecation.py | 20 +------------------- 2 files changed, 18 insertions(+), 19 deletions(-) create mode 100644 test/SConscript/fixture/SConstruct diff --git a/test/SConscript/fixture/SConstruct b/test/SConscript/fixture/SConstruct new file mode 100644 index 0000000..a955efc --- /dev/null +++ b/test/SConscript/fixture/SConstruct @@ -0,0 +1,17 @@ +import SCons +from SCons.Warnings import _warningOut +import sys + +DefaultEnvironment(tools=[]) +# 1. call should succeed without deprecation warning +try: + SConscript('missing/SConscript', must_exist=False) +except SCons.Errors.UserError as e: + if _warningOut: + _warningOut(e) +# 2. call should succeed with deprecation warning +try: + SConscript('missing/SConscript') +except SCons.Errors.UserError as e: + if _warningOut: + _warningOut(e) diff --git a/test/SConscript/must_exist_deprecation.py b/test/SConscript/must_exist_deprecation.py index 86f753b..8b267ce 100644 --- a/test/SConscript/must_exist_deprecation.py +++ b/test/SConscript/must_exist_deprecation.py @@ -36,25 +36,7 @@ test = TestSCons.TestSCons() # catch the exception if is raised, send it on as a warning # this gives us traceability of the line responsible SConstruct_path = test.workpath('SConstruct') -test.write(SConstruct_path, """\ -import SCons -from SCons.Warnings import _warningOut -import sys - -DefaultEnvironment(tools=[]) -# 1. call should succeed without deprecation warning -try: - SConscript('missing/SConscript', must_exist=False) -except SCons.Errors.UserError as e: - if _warningOut: - _warningOut(e) -# 2. call should succeed with deprecation warning -try: - SConscript('missing/SConscript') -except SCons.Errors.UserError as e: - if _warningOut: - _warningOut(e) -""") +test.file_fixture("fixture/SConstruct") # we should see two warnings, the second being the deprecation message. # need to build the path in the expected msg in an OS-agnostic way -- cgit v0.12