[Python-modules-commits] [systemfixtures] 01/03: New upstream version 0.6.3

Free Ekanayaka freee at moszumanska.debian.org
Sun Jan 8 10:55:28 UTC 2017


This is an automated email from the git hooks/post-receive script.

freee pushed a commit to branch master
in repository systemfixtures.

commit bc4c719f19d1aa407a324aa811e38bd54b305a46
Author: Free Ekanayaka <freee at debian.org>
Date:   Sun Jan 8 07:46:48 2017 +0000

    New upstream version 0.6.3
---
 ChangeLog                               |  5 +++++
 PKG-INFO                                |  2 +-
 setup.cfg                               |  2 +-
 systemfixtures.egg-info/PKG-INFO        |  2 +-
 systemfixtures.egg-info/pbr.json        |  2 +-
 systemfixtures/executable.py            |  8 +++++++-
 systemfixtures/tests/test_executable.py | 13 ++++++++++---
 7 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 4ec6a1b..88de0a8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,11 @@
 CHANGES
 =======
 
+0.6.3
+-----
+
+* Add FakeExecutable.log method and include timestamps in test_listen
+
 0.6.2
 -----
 
diff --git a/PKG-INFO b/PKG-INFO
index a677058..7bf2629 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: systemfixtures
-Version: 0.6.2
+Version: 0.6.3
 Summary: Test fixtures for providing fake versions of various system resources (processes, users, groups, etc.)
 Home-page: https://github.com/freeekanayaka/systemfixtures
 Author: Free Ekanayaka
diff --git a/setup.cfg b/setup.cfg
index 938cea5..2b4d5da 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -32,7 +32,7 @@ all_files = 1
 upload-dir = docs/_build/html
 
 [egg_info]
-tag_svn_revision = 0
 tag_build = 
+tag_svn_revision = 0
 tag_date = 0
 
diff --git a/systemfixtures.egg-info/PKG-INFO b/systemfixtures.egg-info/PKG-INFO
index a677058..7bf2629 100644
--- a/systemfixtures.egg-info/PKG-INFO
+++ b/systemfixtures.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: systemfixtures
-Version: 0.6.2
+Version: 0.6.3
 Summary: Test fixtures for providing fake versions of various system resources (processes, users, groups, etc.)
 Home-page: https://github.com/freeekanayaka/systemfixtures
 Author: Free Ekanayaka
diff --git a/systemfixtures.egg-info/pbr.json b/systemfixtures.egg-info/pbr.json
index 2893350..2ad5233 100644
--- a/systemfixtures.egg-info/pbr.json
+++ b/systemfixtures.egg-info/pbr.json
@@ -1 +1 @@
-{"git_version": "556c8fe", "is_release": true}
\ No newline at end of file
+{"is_release": true, "git_version": "b06694c"}
\ No newline at end of file
diff --git a/systemfixtures/executable.py b/systemfixtures/executable.py
index b85fd18..3ae433a 100644
--- a/systemfixtures/executable.py
+++ b/systemfixtures/executable.py
@@ -23,6 +23,9 @@ class FakeExecutable(Fixture):
     def _setUp(self):
         self.path = self.useFixture(TempDir()).join("executable")
         self.line("#!/usr/bin/env python")
+        self.line("import logging")
+        self.line("logging.basicConfig("
+                      "format='%(asctime)s %(message)s', level=logging.DEBUG)")
         os.chmod(self.path, 0o0755)
 
         self._process = None
@@ -39,6 +42,9 @@ class FakeExecutable(Fixture):
         self.line("sys.stdout.write('{}\\n')".format(text))
         self.line("sys.stdout.flush()")
 
+    def log(self, message):
+        self.line("logging.info('{}')".format(message))
+
     def sleep(self, seconds):
         self.line("import time")
         self.line("time.sleep({})".format(seconds))
@@ -71,7 +77,7 @@ class FakeExecutable(Fixture):
         self.line("import socket")
         self.line("sock = socket.socket()")
         self.line("sock.bind(('localhost', {}))".format(self.port))
-        self.out("listening: %d" % self.port)
+        self.log("listening: %d" % self.port)
         self.line("sock.listen(0)")
 
     def line(self, line):
diff --git a/systemfixtures/tests/test_executable.py b/systemfixtures/tests/test_executable.py
index 2d59474..71cb1f1 100644
--- a/systemfixtures/tests/test_executable.py
+++ b/systemfixtures/tests/test_executable.py
@@ -2,9 +2,13 @@ import os
 import time
 import errno
 import socket
+import logging
 import subprocess
 
+from fixtures import FakeLogger
+
 from testtools import TestCase
+from testtools.content import text_content
 from testtools.matchers import (
     Contains,
     FileContains,
@@ -35,6 +39,7 @@ class FakeExecutableTest(TestCase):
         self.assertIsNotNone(self.executable.port)
 
     def test_listen(self):
+        logger = self.useFixture(FakeLogger(format="%(asctime)s %(message)s"))
         self.executable.listen(6666)
         self.executable.sleep(1)
         self.executable.spawn()
@@ -43,13 +48,15 @@ class FakeExecutableTest(TestCase):
         sock = socket.socket()
         transient = (errno.ECONNREFUSED, errno.ECONNRESET)
 
-        for i in range(5):
+        attempts = 10
+        for i in range(1, attempts + 1):
             try:
                 sock.connect(("127.0.0.1", self.executable.port))
             except socket.error as error:  # pragma: no cover
-                if error.errno in transient and i != 4:
-                    time.sleep(0.01 * i)
+                if error.errno in transient and i != attempts:
+                    time.sleep(0.05 * i)
                     continue
+                logging.error("connection attempt %d failed", i)
                 raise error
             break
         self.assertEqual("127.0.0.1", sock.getsockname()[0])

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/systemfixtures.git



More information about the Python-modules-commits mailing list