helpers/postgresql.py

Replace os.system with subprocess.call
This commit is contained in:
Alexander Kukushkin
2015-05-27 11:08:06 +02:00
parent 56daec0d6c
commit 9968a66048
2 changed files with 8 additions and 6 deletions
+4 -3
View File
@@ -1,14 +1,15 @@
import os
import psycopg2
import unittest
import requests
import subprocess
import sys
import time
import unittest
import yaml
from governor import Governor, main, sigchld_handler, sigterm_handler
from test_ha import true, false
from test_postgresql import Postgresql, os_system, psycopg2_connect
from test_postgresql import Postgresql, subprocess_call, psycopg2_connect
from test_etcd import requests_get, requests_put, requests_delete
if sys.hexversion >= 0x03000000:
@@ -38,7 +39,7 @@ class TestGovernor(unittest.TestCase):
def set_up(self):
self.touched = False
os.system = os_system
subprocess.call = subprocess_call
psycopg2.connect = psycopg2_connect
requests.get = requests_get
requests.put = requests_put
+4 -3
View File
@@ -1,13 +1,14 @@
import os
import psycopg2
import unittest
import shutil
import subprocess
import unittest
from helpers.etcd import Cluster, Member
from helpers.postgresql import Postgresql
def os_system(cmd):
def subprocess_call(cmd, shell=False):
return 0
@@ -89,7 +90,7 @@ class TestPostgresql(unittest.TestCase):
super(TestPostgresql, self).__init__(method_name)
def set_up(self):
os.system = os_system
subprocess.call = subprocess_call
self.p = Postgresql({'name': 'test0', 'data_dir': 'data/test0', 'listen': '127.0.0.1, 127.0.0.2:5432', 'connect_address': '127.0.0.2:5432', 'replication': {
'username': 'replicator', 'password': 'rep-pass', 'network': '127.0.0.1/32'}, 'parameters': {'foo': 'bar'}, 'recovery_conf': {'foo': 'bar'}})
psycopg2.connect = psycopg2_connect