[PATCH 5 of 5 STABLE] tests: add daytime port have clause

Sean Farley sean at farley.io
Sun Apr 17 03:12:21 EDT 2016


# HG changeset patch
# User Sean Farley <sean at farley.io>
# Date 1460844307 25200
#      Sat Apr 16 15:05:07 2016 -0700
# Branch stable
# Node ID 4fdc9a491b58f472bf29ec81bf6f2acd3e108916
# Parent  aacc82cc8cde7803d9ff9d17452a67cde0610171
# EXP-Topic ppa
tests: add daytime port have clause

Apparently, some machines don't have this service (launchpad builders are one
such example). Let's add a simple guard around the test.

diff --git a/tests/hghave.py b/tests/hghave.py
--- a/tests/hghave.py
+++ b/tests/hghave.py
@@ -514,5 +514,14 @@ def has_hypothesis():
         import hypothesis
         hypothesis.given
         return True
     except ImportError:
         return False
+
+ at check("daytime", "daytime service exists")
+def has_daytime():
+    try:
+        with open('/etc/services') as fp:
+            return 'daytime' in fp.read()
+    except (IOError, OSError):
+        pass
+    return False
diff --git a/tests/test-serve.t b/tests/test-serve.t
--- a/tests/test-serve.t
+++ b/tests/test-serve.t
@@ -43,11 +43,11 @@ With -v and -p HGPORT2
   listening at http://localhost/ (bound to 127.0.0.1:HGPORT2)
   % errors
 
 With -v and -p daytime (should fail because low port)
 
-#if no-root
+#if no-root daytime
   $ KILLQUIETLY=Y
   $ hgserve -p daytime
   abort: cannot start server at 'localhost:13': Permission denied
   abort: child process failed to start
   % errors


More information about the Mercurial-devel mailing list