summaryrefslogtreecommitdiffstats
path: root/src/test_setup.py
diff options
context:
space:
mode:
authorMats Wichmann <mats@linux.com>2019-08-30 13:59:29 (GMT)
committerMats Wichmann <mats@linux.com>2019-08-30 14:04:23 (GMT)
commit49212c0d8dc8db6657735036028948bf3ab9ede0 (patch)
tree08f0ea34bbc36d51a8234a72ea5fe65d3f44c68e /src/test_setup.py
parent84843df640e34f83ebea25be851204f400a0d9ec (diff)
downloadSCons-49212c0d8dc8db6657735036028948bf3ab9ede0.zip
SCons-49212c0d8dc8db6657735036028948bf3ab9ede0.tar.gz
SCons-49212c0d8dc8db6657735036028948bf3ab9ede0.tar.bz2
Use "in" in preference to string find method
In places where only the found/not found status is needed, use the membership operator (in) for checks instead - makes for easier reading and is considered faster for shorter strings. Signed-off-by: Mats Wichmann <mats@linux.com>
Diffstat (limited to 'src/test_setup.py')
-rw-r--r--src/test_setup.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/test_setup.py b/src/test_setup.py
index 09865f5..d9fa5b5 100644
--- a/src/test_setup.py
+++ b/src/test_setup.py
@@ -176,7 +176,7 @@ tar_gz = os.path.join(cwd, 'build', 'dist', '%s.tar.gz' % scons_version)
zip = os.path.join(cwd, 'build', 'dist', '%s.zip' % scons_version)
if os.path.isfile(zip):
- try:
+ try:
import zipfile
except ImportError:
pass
@@ -185,9 +185,9 @@ if os.path.isfile(zip):
for name in zf.namelist():
dname = os.path.dirname(name)
- try:
+ try:
os.makedirs(dname)
- except FileExistsError:
+ except FileExistsError:
pass
# if the file exists, then delete it before writing
# to it so that we don't end up trying to write to a symlink:
@@ -325,8 +325,7 @@ test.must_have_installed(test.man_page_paths())
other_prefix = test.workpath('other-prefix')
test.subdir(other_prefix)
test.run(arguments = 'setup.py install --prefix=%s' % other_prefix)
-test.fail_test(test.stderr().find("you'll have to change the search path yourself")
- != -1)
+test.fail_test("you'll have to change the search path yourself" in test.stderr())
# All done.
test.pass_test()