From bf8b7c0a3b40acceacc60ef373fd2005a48e9f50 Mon Sep 17 00:00:00 2001 From: Anthony Delosa Date: Mon, 24 Oct 2016 21:53:38 +1000 Subject: [PATCH 1/3] Fix to support Windows (tk0miya/testing.postgresql#16) * Assumes all other platforms work with sigint instead of sigterm * testcases are broken on Windows due to use of os.fork --- src/testing/postgresql.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/testing/postgresql.py b/src/testing/postgresql.py index 948fc3c..052860a 100644 --- a/src/testing/postgresql.py +++ b/src/testing/postgresql.py @@ -113,7 +113,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): From 5d1eac3e11313b38b842f0bc8d418797c0e25a67 Mon Sep 17 00:00:00 2001 From: Anthony Delosa Date: Mon, 24 Oct 2016 22:15:55 +1000 Subject: [PATCH 2/3] Merged in skip of tests containing os.fork for Window from windows _support branch. --- tests/test_postgresql.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/test_postgresql.py b/tests/test_postgresql.py index b3603a2..9d25e84 100644 --- a/tests/test_postgresql.py +++ b/tests/test_postgresql.py @@ -116,6 +116,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: @@ -127,6 +128,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: From 4d3ef9c6c948b0ef7acee3ec5073057c504d0223 Mon Sep 17 00:00:00 2001 From: Anthony Delosa Date: Mon, 24 Oct 2016 23:01:51 +1000 Subject: [PATCH 3/3] Updates py26 to use 2.6.0 version of flake8. Py26 +Windows is broken. --- tox.ini | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tox.ini b/tox.ini index c2d340c..bbd80fd 100644 --- a/tox.ini +++ b/tox.ini @@ -1,12 +1,16 @@ [tox] envlist=py26,py27,py32,py33,py34,py35 -[testenv] +[base] deps= nose - flake8 psycopg2 SQLAlchemy + +[testenv] +deps= + {[base]deps} + flake8 passenv= TRAVIS* commands= @@ -15,8 +19,9 @@ commands= [testenv:py26] deps= - {[testenv]deps} + {[base]deps} unittest2 + flake8==2.6.0 [testenv:coverage] deps=