add_test_setup: Treat no env as empty env

Otherwise env is {} and we get a traceback trying to use the setup:

$ /home/cassidy/dev/meson/mesontest.py -C build --setup valgrind
ninja: Entering directory `/home/cassidy/dev/gst/master/gst-build/build'
ninja: no work to do.
Traceback (most recent call last):
  File "/home/cassidy/dev/meson/mesontest.py", line 579, in <module>
    sys.exit(run(sys.argv[1:]))
  File "/home/cassidy/dev/meson/mesontest.py", line 575, in run
    return th.doit()
  File "/home/cassidy/dev/meson/mesontest.py", line 337, in doit
    self.run_tests(tests)
  File "/home/cassidy/dev/meson/mesontest.py", line 485, in run_tests
    self.drain_futures(futures, logfile, jsonlogfile)
  File "/home/cassidy/dev/meson/mesontest.py", line 504, in drain_futures
    self.print_stats(numlen, tests, name, result.result(), i, logfile, jsonlogfile)
  File "/usr/lib64/python3.5/concurrent/futures/_base.py", line 398, in result
    return self.__get_result()
  File "/usr/lib64/python3.5/concurrent/futures/_base.py", line 357, in __get_result
    raise self._exception
  File "/usr/lib64/python3.5/concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/cassidy/dev/meson/mesontest.py", line 216, in run_single_test
    child_env.update(self.options.global_env.get_env(child_env))
AttributeError: 'dict' object has no attribute 'get_env'

There is no harm in doing this, and this is the simplest fix for this.

Closes https://github.com/mesonbuild/meson/issues/1371
pull/1402/head
Nirbheek Chauhan 8 years ago
parent f1fe823763
commit d1bc5c3404
  1. 2
      mesonbuild/interpreter.py

@ -2060,7 +2060,7 @@ requirements use the version keyword argument instead.''')
self.add_test(node, args, kwargs, True) self.add_test(node, args, kwargs, True)
def unpack_env_kwarg(self, kwargs): def unpack_env_kwarg(self, kwargs):
envlist = kwargs.get('env', []) envlist = kwargs.get('env', EnvironmentVariablesHolder())
if isinstance(envlist, EnvironmentVariablesHolder): if isinstance(envlist, EnvironmentVariablesHolder):
env = envlist.held_object env = envlist.held_object
else: else:

Loading…
Cancel
Save