Fix problems running tests with newer SCons version (deprecated env.has_key())
diff --git a/tests/fuzztest/SConscript b/tests/fuzztest/SConscript
index 7c0d6e2..a5df905 100644
--- a/tests/fuzztest/SConscript
+++ b/tests/fuzztest/SConscript
@@ -80,12 +80,12 @@
count = 0
args = [str(source[0])]
- if env.has_key("TEST_RUNNER"):
+ if "TEST_RUNNER" in env:
args = [env["TEST_RUNNER"]] + args
- if env.has_key("FUZZTEST_CORPUS_SAMPLESIZE"):
+ if "FUZZTEST_CORPUS_SAMPLESIZE" in env:
samplesize = int(env["FUZZTEST_CORPUS_SAMPLESIZE"])
- elif env.has_key("EMBEDDED"):
+ elif env.get('EMBEDDED'):
samplesize = 100
else:
samplesize = 4096
diff --git a/tests/site_scons/site_init.py b/tests/site_scons/site_init.py
index ce8f7e1..676b0fb 100644
--- a/tests/site_scons/site_init.py
+++ b/tests/site_scons/site_init.py
@@ -32,15 +32,15 @@
else:
infile = None
- if env.has_key("COMMAND"):
+ if "COMMAND" in env:
args = [env["COMMAND"]]
else:
args = [str(source[0])]
- if env.has_key('ARGS'):
+ if 'ARGS' in env:
args.extend(env['ARGS'])
- if env.has_key("TEST_RUNNER"):
+ if "TEST_RUNNER" in env:
args = [env["TEST_RUNNER"]] + args
print('Command line: ' + str(args))
diff --git a/tests/site_scons/site_tools/nanopb.py b/tests/site_scons/site_tools/nanopb.py
index 1a25808..37b8e20 100644
--- a/tests/site_scons/site_tools/nanopb.py
+++ b/tests/site_scons/site_tools/nanopb.py
@@ -46,7 +46,7 @@
def _detect_nanopb(env):
'''Find the path to nanopb root directory.'''
- if env.has_key('NANOPB'):
+ if 'NANOPB' in env:
# Use nanopb dir given by user
return env['NANOPB']
@@ -60,7 +60,7 @@
def _detect_python(env):
'''Find Python executable to use.'''
- if env.has_key('PYTHON'):
+ if 'PYTHON' in env:
return env['PYTHON']
p = env.WhereIs('python3')
@@ -85,7 +85,7 @@
def _detect_protoc(env):
'''Find the path to the protoc compiler.'''
- if env.has_key('PROTOC'):
+ if 'PROTOC' in env:
# Use protoc defined by user
return env['PROTOC']
@@ -113,7 +113,7 @@
def _detect_protocflags(env):
'''Find the options to use for protoc.'''
- if env.has_key('PROTOCFLAGS'):
+ if 'PROTOCFLAGS' in env:
return env['PROTOCFLAGS']
p = _detect_protoc(env)