tests/hghave: test that the inotify unix socket actually can be created
authorMads Kiilerich <mads@kiilerich.com>
Fri, 15 Jun 2012 00:02:27 +0200
changeset 16970 8be2a28cc782
parent 16969 6d1673107143
child 16971 8aeb2f1ae94c
tests/hghave: test that the inotify unix socket actually can be created Inotify do not work on FAT filesystems.
tests/hghave.py
--- a/tests/hghave.py	Fri Jun 15 00:02:27 2012 +0200
+++ b/tests/hghave.py	Fri Jun 15 00:02:27 2012 +0200
@@ -1,4 +1,4 @@
-import os, stat
+import os, stat, socket
 import re
 import sys
 import tempfile
@@ -95,9 +95,17 @@
 def has_inotify():
     try:
         import hgext.inotify.linux.watcher
-        return True
     except ImportError:
         return False
+    name = tempfile.mktemp(dir='.', prefix=tempprefix)
+    sock = socket.socket(socket.AF_UNIX)
+    try:
+        sock.bind(name)
+    except socket.error, err:
+        return False
+    sock.close()
+    os.unlink(name)
+    return True
 
 def has_fifo():
     if getattr(os, "mkfifo", None) is None: