On Windows, os.access(path, os.X_OK) always returns True for any existing file (NTFS has no execute bit; executability is governed by file extension, not mode bits). So the test_non_executable_engine test — which chmods the engine to 0o644 and expects 'fail' — could never pass on Windows. Fixed doctor.py to use a platform-aware check: on Windows, any existing file is executable; on POSIX, honor the mode bits via os.access(X_OK). Fixed the test to assert the correct per-platform expectation: 'pass' on Windows (chmod is a no-op for executability), 'fail' on POSIX. Co-authored-by: woolcoxm <13604288+woolcoxm@users.noreply.github.com>
This commit is contained in:
@@ -104,7 +104,14 @@ class DoctorTest(unittest.TestCase):
|
||||
report = self.report(ram_gb=40)
|
||||
checks = self.checks_by_id(report)
|
||||
|
||||
self.assertEqual(checks["engine.binary"]["status"], "fail")
|
||||
# On Windows chmod(0o644) does not remove executability (NTFS has no
|
||||
# execute bit; os.access(X_OK) is always True for existing files), so
|
||||
# the engine.binary check stays "pass" there. The excessive-RAM check
|
||||
# (memory.ram) is platform-independent and must still fail. (#141)
|
||||
if sys.platform == "win32":
|
||||
self.assertEqual(checks["engine.binary"]["status"], "pass")
|
||||
else:
|
||||
self.assertEqual(checks["engine.binary"]["status"], "fail")
|
||||
self.assertEqual(checks["memory.ram"]["status"], "fail")
|
||||
self.assertEqual(report["status"], "error")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user