From: Eli Bendersky Date: Mon, 8 Apr 2013 13:45:01 +0000 (-0700) Subject: better way to check if a dir exists X-Git-Tag: v0.21~5 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=69c3a90eeaef3237c46269a857617d72c6af4d68;p=pyelftools.git better way to check if a dir exists --- diff --git a/test/utils.py b/test/utils.py index 7a3b83f..908cfcc 100644 --- a/test/utils.py +++ b/test/utils.py @@ -36,8 +36,7 @@ def run_exe(exe_path, args): def is_in_rootdir(): """ Check whether the current dir is the root dir of pyelftools """ - dirstuff = os.listdir('.') - return 'test' in dirstuff and 'elftools' in dirstuff + return os.path.isdir('test') and os.path.isdir('elftools') def dump_output_to_temp_files(testlog, *args):