Fixed physics tests on linux (#5579)

* Fixed physics tests on linux

* Fixed unit tests because of new implementation

* Fixed bug in lock, fixed unit tests

Co-authored-by: aljanru <aljanru@uc5564ff5a5ee55.ant.amazon.com>
This commit is contained in:
AMZN-AlexOteiza
2021-11-12 16:09:09 +00:00
committed by GitHub
parent 8bbb99d741
commit cb93bafc4f
3 changed files with 24 additions and 6 deletions
@@ -219,7 +219,8 @@ def unlock_file(file_name):
:return: True if unlock succeeded, else False
"""
if not os.access(file_name, os.W_OK):
os.chmod(file_name, stat.S_IWRITE)
file_stat = os.stat(file_name)
os.chmod(file_name, file_stat.st_mode | stat.S_IWRITE)
logger.warning(f'Clearing write lock for file {file_name}.')
return True
else:
@@ -235,7 +236,8 @@ def lock_file(file_name):
:return: True if lock succeeded, else False
"""
if os.access(file_name, os.W_OK):
os.chmod(file_name, stat.S_IREAD)
file_stat = os.stat(file_name)
os.chmod(file_name, file_stat.st_mode & (~stat.S_IWRITE))
logger.warning(f'Write locking file {file_name}')
return True
else: