From 83452b75dd945d148c4a6c8c4b241a04b154339e Mon Sep 17 00:00:00 2001 From: Joe Rickerby Date: Thu, 5 Mar 2020 18:28:16 +0000 Subject: [PATCH] Apply suggestions from code review --- test/02_test/test/spam_test.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/02_test/test/spam_test.py b/test/02_test/test/spam_test.py index 4eb8ca1f..d26535fa 100644 --- a/test/02_test/test/spam_test.py +++ b/test/02_test/test/spam_test.py @@ -7,12 +7,18 @@ import spam def path_contains(parent, child): + ''' returns True if `child` is inside `parent`. + + Works around path-comparison bugs caused by short-paths on Windows e.g. + vssadm~1 instead of vssadministrator + ''' parent = os.path.abspath(parent) child = os.path.abspath(child) while child != os.path.dirname(child): child = os.path.dirname(child) if os.stat(parent) == os.stat(child): + # parent and child refer to the same directory on the filesystem return True return False