aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Turney <jon.turney@dronecode.org.uk>2018-02-09 13:35:07 +0000
committerJon Turney <jon.turney@dronecode.org.uk>2018-02-15 12:51:25 +0000
commit9e6d3f903c7e828823eb4544c83bf340ff593f95 (patch)
treea938e3128ad8374f3e05403fb82cc24d54fc9429
parentb78a01bcedb668158c97574d6a140d63a2a108e5 (diff)
downloadmeson-9e6d3f903c7e828823eb4544c83bf340ff593f95.zip
meson-9e6d3f903c7e828823eb4544c83bf340ff593f95.tar.gz
meson-9e6d3f903c7e828823eb4544c83bf340ff593f95.tar.bz2
Only expose exception() test function during unit tests
-rw-r--r--mesonbuild/interpreter.py3
-rwxr-xr-xrun_unittests.py1
2 files changed, 3 insertions, 1 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index 076ba7d..a542ff6 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -1470,7 +1470,6 @@ class Interpreter(InterpreterBase):
'disabler': self.func_disabler,
'environment': self.func_environment,
'error': self.func_error,
- 'exception': self.func_exception,
'executable': self.func_executable,
'generator': self.func_generator,
'gettext': self.func_gettext,
@@ -1504,6 +1503,8 @@ class Interpreter(InterpreterBase):
'test': self.func_test,
'vcs_tag': self.func_vcs_tag,
})
+ if 'MESON_UNIT_TEST' in os.environ:
+ self.funcs.update({'exception': self.func_exception})
def holderify(self, item):
if isinstance(item, list):
diff --git a/run_unittests.py b/run_unittests.py
index a520ad2..69f467b 100755
--- a/run_unittests.py
+++ b/run_unittests.py
@@ -1938,6 +1938,7 @@ class FailureTests(BasePlatformTests):
Test exit status on python exception
'''
tdir = os.path.join(self.unit_test_dir, '21 exit status')
+ os.environ['MESON_UNIT_TEST'] = '1'
with self.assertRaises(subprocess.CalledProcessError) as cm:
self.init(tdir, inprocess=False)
self.assertEqual(cm.exception.returncode, 2)