Skip to content

Commit

Permalink
Merge pull request #2 from tk0miya/master
Browse files Browse the repository at this point in the history
Keep up to date with head
  • Loading branch information
pierluca authored Mar 8, 2017
2 parents d611c0a + 9951ad7 commit 14420c4
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 16 deletions.
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ language: python
python: 3.5
env:
matrix:
- TOXENV=py26
- TOXENV=py27
- TOXENV=py33
- TOXENV=py34
- TOXENV=py35
- TOXENV=coverage
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ If you want to insert fixtures to the cached database, use ``initdb_handler`` op

Requirements
============
* Python 2.6, 2.7, 3.2, 3.3, 3.4, 3.5
* Python 2.7, 3.4, 3.5, 3.6
* pg8000 1.10

License
Expand Down
3 changes: 2 additions & 1 deletion src/testing/postgresql.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
__all__ = ['Postgresql', 'skipIfNotFound']

SEARCH_PATHS = (['/usr/local/pgsql', '/usr/local'] +
glob('/usr/pgsql-*') + # for CentOS/RHEL
glob('/usr/lib/postgresql/*') + # for Debian/Ubuntu
glob('/opt/local/lib/postgresql*')) # for MacPorts

Expand Down Expand Up @@ -115,7 +116,7 @@ def is_server_available(self):

def terminate(self, *args):
# send SIGINT instead of SIGTERM
super(Postgresql, self).terminate(signal.SIGINT)
super(Postgresql, self).terminate(signal.SIGINT if os.name != 'nt' else None)


class PostgresqlFactory(DatabaseFactory):
Expand Down
9 changes: 3 additions & 6 deletions tests/test_postgresql.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# -*- coding: utf-8 -*-

import os
import sys
import signal
import tempfile
import unittest
import testing.postgresql
from time import sleep
from shutil import rmtree
Expand All @@ -12,11 +12,6 @@
import sqlalchemy
from contextlib import closing

if sys.version_info < (2, 7):
import unittest2 as unittest
else:
import unittest


class TestPostgresql(unittest.TestCase):
def test_basic(self):
Expand Down Expand Up @@ -116,6 +111,7 @@ def test_postgresql_is_not_found(self):
testing.postgresql.SEARCH_PATHS = search_paths
os.environ['PATH'] = path_env

@unittest.skipIf(os.name == 'nt', 'Windows does not have fork()')
def test_fork(self):
pgsql = testing.postgresql.Postgresql()
if os.fork() == 0:
Expand All @@ -127,6 +123,7 @@ def test_fork(self):
sleep(1)
self.assertTrue(pgsql.is_alive()) # process is alive (delete pgsql obj in child does not effect)

@unittest.skipIf(os.name == 'nt', 'Windows does not have fork()')
def test_stop_on_child_process(self):
pgsql = testing.postgresql.Postgresql()
if os.fork() == 0:
Expand Down
7 changes: 1 addition & 6 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist=py26,py27,py32,py33,py34,py35
envlist=py27,py34,py35,py36

[testenv]
deps=
Expand All @@ -13,11 +13,6 @@ commands=
nosetests
flake8 --exclude=.tox/

[testenv:py26]
deps=
{[testenv]deps}
unittest2

[testenv:coverage]
deps=
{[testenv]deps}
Expand Down

0 comments on commit 14420c4

Please sign in to comment.