New Upstream Release - python-testing.common.database

Ready changes

Summary

Merged new upstream version: 2.0.3 (was: 2.0.0).

Resulting package

Built on 2022-03-09T06:11 (took 1m45s)

The resulting binary packages can be installed (if you have the apt repository enabled) by running one of:

apt install -t fresh-releases python3-testing.common.database

Lintian Result

Diff

diff --git a/PKG-INFO b/PKG-INFO
index d041a7b..c0812f4 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,11 +1,12 @@
 Metadata-Version: 1.1
 Name: testing.common.database
-Version: 2.0.0
+Version: 2.0.3
 Summary: utilities for testing.* packages
 Home-page: https://github.com/tk0miya/testing.common.database
 Author: Takeshi Komiya
-Author-email: i.tkomiya at gmail.com
+Author-email: i.tkomiya@gmail.com
 License: Apache License 2.0
+Description-Content-Type: UNKNOWN
 Description: About
         =====
         ``testing.common.database`` is utilities for testing.* package.
@@ -187,16 +188,39 @@ Description: About
         
         Requirements
         ============
-        * Python 2.6, 2.7, 3.2, 3.3, 3.4, 3.5
+        * Python 2.7, 3.4, 3.5, 3.6
         
         License
         =======
         Apache License 2.0
         
+        Release signatures
+        ==================
+        Releases are signed with following keys:
+        
+        * `498D6B9E <https://pgp.mit.edu/pks/lookup?op=vindex&search=0x102C2C17498D6B9E>`_
         
         History
         =======
         
+        2.0.3 (2017-10-24)
+        -------------------
+        * Fix a bug:
+        
+          - Handle exceptions from get_path_of()
+        
+        2.0.2 (2017-10-08)
+        -------------------
+        * Fix a bug:
+        
+          - #18: Fix launch when using cache_initialized_db without init_handler 
+        
+        2.0.1 (2017-07-15)
+        -------------------
+        * #9: Database always gets instantiated with correct settings
+        * #10: Remove explicit path to which
+        * #11: Make database server kill-timeout more configurable
+        
         2.0.0 (2016-08-20)
         -------------------
         * Use subprocess.Popen() instead of fork & exec
@@ -223,12 +247,12 @@ Classifier: Development Status :: 4 - Beta
 Classifier: Intended Audience :: Developers
 Classifier: License :: OSI Approved :: Apache Software License
 Classifier: Programming Language :: Python
-Classifier: Programming Language :: Python :: 2.6
+Classifier: Programming Language :: Python :: 2
 Classifier: Programming Language :: Python :: 2.7
-Classifier: Programming Language :: Python :: 3.2
-Classifier: Programming Language :: Python :: 3.3
+Classifier: Programming Language :: Python :: 3
 Classifier: Programming Language :: Python :: 3.4
 Classifier: Programming Language :: Python :: 3.5
+Classifier: Programming Language :: Python :: 3.6
 Classifier: Topic :: Database
 Classifier: Topic :: Software Development
 Classifier: Topic :: Software Development :: Testing
diff --git a/README.rst b/README.rst
index 7f01967..3329284 100644
--- a/README.rst
+++ b/README.rst
@@ -179,16 +179,39 @@ def get_path_of(name):
 
 Requirements
 ============
-* Python 2.6, 2.7, 3.2, 3.3, 3.4, 3.5
+* Python 2.7, 3.4, 3.5, 3.6
 
 License
 =======
 Apache License 2.0
 
+Release signatures
+==================
+Releases are signed with following keys:
+
+* `498D6B9E <https://pgp.mit.edu/pks/lookup?op=vindex&search=0x102C2C17498D6B9E>`_
 
 History
 =======
 
+2.0.3 (2017-10-24)
+-------------------
+* Fix a bug:
+
+  - Handle exceptions from get_path_of()
+
+2.0.2 (2017-10-08)
+-------------------
+* Fix a bug:
+
+  - #18: Fix launch when using cache_initialized_db without init_handler 
+
+2.0.1 (2017-07-15)
+-------------------
+* #9: Database always gets instantiated with correct settings
+* #10: Remove explicit path to which
+* #11: Make database server kill-timeout more configurable
+
 2.0.0 (2016-08-20)
 -------------------
 * Use subprocess.Popen() instead of fork & exec
diff --git a/debian/changelog b/debian/changelog
index 78f99b0..75b0d8f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-python-testing.common.database (2.0.0-3) UNRELEASED; urgency=medium
+python-testing.common.database (2.0.3-1) UNRELEASED; urgency=medium
 
   [ Debian Janitor ]
   * Bump debhelper from old 10 to 12.
@@ -14,8 +14,9 @@ python-testing.common.database (2.0.0-3) UNRELEASED; urgency=medium
 
   [ Debian Janitor ]
   * Bump debhelper from old 12 to 13.
+  * New upstream release.
 
- -- Debian Janitor <janitor@jelmer.uk>  Tue, 07 Jan 2020 23:48:12 +0000
+ -- Debian Janitor <janitor@jelmer.uk>  Wed, 09 Mar 2022 06:09:25 -0000
 
 python-testing.common.database (2.0.0-2) unstable; urgency=medium
 
diff --git a/setup.cfg b/setup.cfg
index fe6c155..12065b6 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,7 +1,6 @@
 [egg_info]
 tag_build = 
 tag_date = 0
-tag_svn_revision = 0
 
 [build]
 build-base = _build
@@ -13,7 +12,7 @@ formats = gztar
 universal = 1
 
 [aliases]
-release = check -r -s register sdist bdist_wheel upload
+release = check -r -s register sdist bdist_wheel upload --sign --identity=498D6B9E
 
 [check]
 strict = 1
diff --git a/setup.py b/setup.py
index 5e8b821..67b2d68 100644
--- a/setup.py
+++ b/setup.py
@@ -7,12 +7,12 @@ classifiers = [
     "Intended Audience :: Developers",
     "License :: OSI Approved :: Apache Software License",
     "Programming Language :: Python",
-    "Programming Language :: Python :: 2.6",
+    "Programming Language :: Python :: 2",
     "Programming Language :: Python :: 2.7",
-    "Programming Language :: Python :: 3.2",
-    "Programming Language :: Python :: 3.3",
+    "Programming Language :: Python :: 3",
     "Programming Language :: Python :: 3.4",
     "Programming Language :: Python :: 3.5",
+    "Programming Language :: Python :: 3.6",
     "Topic :: Database",
     "Topic :: Software Development",
     "Topic :: Software Development :: Testing",
@@ -25,13 +25,13 @@ if sys.version_info < (2, 7):
 
 setup(
     name='testing.common.database',
-    version='2.0.0',
+    version='2.0.3',
     description='utilities for testing.* packages',
     long_description=open('README.rst').read(),
     classifiers=classifiers,
     keywords=[],
     author='Takeshi Komiya',
-    author_email='i.tkomiya at gmail.com',
+    author_email='i.tkomiya@gmail.com',
     url='https://github.com/tk0miya/testing.common.database',
     license='Apache License 2.0',
     packages=find_packages('src'),
diff --git a/src/testing.common.database.egg-info/PKG-INFO b/src/testing.common.database.egg-info/PKG-INFO
index d041a7b..c0812f4 100644
--- a/src/testing.common.database.egg-info/PKG-INFO
+++ b/src/testing.common.database.egg-info/PKG-INFO
@@ -1,11 +1,12 @@
 Metadata-Version: 1.1
 Name: testing.common.database
-Version: 2.0.0
+Version: 2.0.3
 Summary: utilities for testing.* packages
 Home-page: https://github.com/tk0miya/testing.common.database
 Author: Takeshi Komiya
-Author-email: i.tkomiya at gmail.com
+Author-email: i.tkomiya@gmail.com
 License: Apache License 2.0
+Description-Content-Type: UNKNOWN
 Description: About
         =====
         ``testing.common.database`` is utilities for testing.* package.
@@ -187,16 +188,39 @@ Description: About
         
         Requirements
         ============
-        * Python 2.6, 2.7, 3.2, 3.3, 3.4, 3.5
+        * Python 2.7, 3.4, 3.5, 3.6
         
         License
         =======
         Apache License 2.0
         
+        Release signatures
+        ==================
+        Releases are signed with following keys:
+        
+        * `498D6B9E <https://pgp.mit.edu/pks/lookup?op=vindex&search=0x102C2C17498D6B9E>`_
         
         History
         =======
         
+        2.0.3 (2017-10-24)
+        -------------------
+        * Fix a bug:
+        
+          - Handle exceptions from get_path_of()
+        
+        2.0.2 (2017-10-08)
+        -------------------
+        * Fix a bug:
+        
+          - #18: Fix launch when using cache_initialized_db without init_handler 
+        
+        2.0.1 (2017-07-15)
+        -------------------
+        * #9: Database always gets instantiated with correct settings
+        * #10: Remove explicit path to which
+        * #11: Make database server kill-timeout more configurable
+        
         2.0.0 (2016-08-20)
         -------------------
         * Use subprocess.Popen() instead of fork & exec
@@ -223,12 +247,12 @@ Classifier: Development Status :: 4 - Beta
 Classifier: Intended Audience :: Developers
 Classifier: License :: OSI Approved :: Apache Software License
 Classifier: Programming Language :: Python
-Classifier: Programming Language :: Python :: 2.6
+Classifier: Programming Language :: Python :: 2
 Classifier: Programming Language :: Python :: 2.7
-Classifier: Programming Language :: Python :: 3.2
-Classifier: Programming Language :: Python :: 3.3
+Classifier: Programming Language :: Python :: 3
 Classifier: Programming Language :: Python :: 3.4
 Classifier: Programming Language :: Python :: 3.5
+Classifier: Programming Language :: Python :: 3.6
 Classifier: Topic :: Database
 Classifier: Topic :: Software Development
 Classifier: Topic :: Software Development :: Testing
diff --git a/src/testing/common/database.py b/src/testing/common/database.py
index db8da20..5ba8c5e 100644
--- a/src/testing/common/database.py
+++ b/src/testing/common/database.py
@@ -13,6 +13,7 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
 
+import copy
 import os
 import sys
 import signal
@@ -36,9 +37,9 @@ class DatabaseFactory(object):
         if self.settings.pop('cache_initialized_db', None):
             if init_handler:
                 try:
-                    self.cache = self.target_class()
+                    self.cache = self.target_class(**self.settings)
                     init_handler(self.cache)
-                except:
+                except Exception:
                     if self.cache:
                         self.cache.stop()
                     raise
@@ -46,7 +47,9 @@ class DatabaseFactory(object):
                     if self.cache:
                         self.cache.terminate()
             else:
-                self.cache = self.target_class(auto_start=0)
+                settings_noautostart = copy.deepcopy(self.settings)
+                settings_noautostart.update({"auto_start": 0})
+                self.cache = self.target_class(**settings_noautostart)
                 self.cache.setup()
             self.settings['copy_data_from'] = self.cache.get_data_directory()
 
@@ -61,6 +64,7 @@ class DatabaseFactory(object):
 
 class Database(object):
     DEFAULT_BOOT_TIMEOUT = 10.0
+    DEFAULT_KILL_TIMEOUT = 10.0
     DEFAULT_SETTINGS = {}
     subdirectories = []
     terminate_signal = signal.SIGTERM
@@ -92,7 +96,7 @@ class Database(object):
                     self.setup()
 
                 self.start()
-        except:
+        except Exception:
             self.cleanup()
             raise
 
@@ -119,7 +123,7 @@ class Database(object):
 
         try:
             self.initialize_database()
-        except:
+        except Exception:
             self.cleanup()
             raise
 
@@ -149,7 +153,7 @@ class Database(object):
             try:
                 self.wait_booting()
                 self.poststart()
-            except:
+            except Exception:
                 self.stop()
                 raise
         finally:
@@ -212,8 +216,8 @@ class Database(object):
             self.child_process.send_signal(_signal)
             killed_at = datetime.now()
             while self.child_process.poll() is None:
-                if (datetime.now() - killed_at).seconds > 10.0:
-                    os.child_process.kill()
+                if (datetime.now() - killed_at).seconds > self.DEFAULT_KILL_TIMEOUT:
+                    self.child_process.kill()
                     raise RuntimeError("*** failed to shutdown postgres (timeout) ***\n" + self.read_bootlog())
 
                 sleep(0.1)
@@ -240,13 +244,13 @@ class Database(object):
     def __del__(self):
         try:
             self.stop()
-        except:
+        except Exception:
             errmsg = ('ERROR: testing.common.database: failed to shutdown the server automatically.\n'
                       'Any server processes and files might have been leaked. Please remove them and '
                       'call the stop() certainly')
             try:
                 sys.__stderr__.write(errmsg)
-            except:
+            except Exception:
                 # if sys module is already unloaded by GC
                 print(errmsg)
 
@@ -276,7 +280,7 @@ class SkipIfNotInstalledDecorator(object):
                 try:
                     self.search_server()
                     cond = False  # found
-                except:
+                except Exception:
                     cond = True  # not found
 
             return skipIf(cond, "%s not found" % self.name)(fn)
@@ -300,11 +304,14 @@ def get_path_of(name):
     if os.name == 'nt':
         which = 'where'
     else:
-        which = '/usr/bin/which'
-    path = subprocess.Popen([which, name],
-                            stdout=subprocess.PIPE,
-                            stderr=subprocess.PIPE).communicate()[0]
-    if path:
-        return path.rstrip().decode('utf-8')
-    else:
+        which = 'which'
+    try:
+        path = subprocess.Popen([which, name],
+                                stdout=subprocess.PIPE,
+                                stderr=subprocess.PIPE).communicate()[0]
+        if path:
+            return path.rstrip().decode('utf-8')
+        else:
+            return None
+    except Exception:
         return None

More details

Full run details