diff --git a/requirements.txt b/requirements.txt index 098616bb..9fc6f4b4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,5 @@ -urllib3[secure]>=1.19.1,!=1.21 +urllib3>=1.19.1,!=1.21 +ipaddress; python_version=="2.7" boto PyYAML six >= 1.7 diff --git a/setup.py b/setup.py index 3f7609cd..a9443022 100644 --- a/setup.py +++ b/setup.py @@ -23,7 +23,7 @@ KEYWORDS = 'etcd governor patroni postgresql postgres ha haproxy confd' +\ ' zookeeper exhibitor consul streaming replication kubernetes k8s' EXTRAS_REQUIRE = {'aws': ['boto'], 'etcd': ['python-etcd'], 'etcd3': ['python-etcd'], 'consul': ['python-consul'], - 'exhibitor': ['kazoo'], 'zookeeper': ['kazoo'], 'kubernetes': [], 'raft': ['pysyncobj']} + 'exhibitor': ['kazoo'], 'zookeeper': ['kazoo'], 'kubernetes': ['ipaddress'], 'raft': ['pysyncobj']} COVERAGE_XML = True COVERAGE_HTML = False @@ -143,9 +143,13 @@ class PyTest(Command): def run(self): from pkg_resources import evaluate_marker - requirements = self.distribution.install_requires + ['mock>=2.0.0', 'pytest-cov', 'pytest'] +\ - [v for k, v in self.distribution.extras_require.items() if not k.startswith(':') or evaluate_marker(k[1:])] - self.distribution.fetch_build_eggs(requirements) + + requirements = set(self.distribution.install_requires + ['mock>=2.0.0', 'pytest-cov', 'pytest']) + for k, v in self.distribution.extras_require.items(): + if not k.startswith(':') or evaluate_marker(k[1:]): + requirements.update(v) + + self.distribution.fetch_build_eggs(list(requirements)) self.run_tests() @@ -167,7 +171,7 @@ def setup_package(version): extra = False for e, v in EXTRAS_REQUIRE.items(): if v and r.startswith(v[0]): - EXTRAS_REQUIRE[e] = [r] + EXTRAS_REQUIRE[e] = [r] if e != 'kubernetes' or sys.version_info < (3, 0, 0) else [] extra = True if not extra: install_requires.append(r) diff --git a/tests/test_ha.py b/tests/test_ha.py index e3998203..b678a405 100644 --- a/tests/test_ha.py +++ b/tests/test_ha.py @@ -3,7 +3,7 @@ import etcd import os import sys -from mock import call, Mock, MagicMock, PropertyMock, patch, mock_open +from mock import Mock, MagicMock, PropertyMock, patch, mock_open from patroni.config import Config from patroni.dcs import Cluster, ClusterConfig, Failover, Leader, Member, get_dcs, SyncState, TimelineHistory from patroni.dcs.etcd import AbstractEtcdClientWithFailover @@ -902,9 +902,8 @@ class TestHa(PostgresInit): self.p.pick_synchronous_standby = Mock(return_value=(['other2', 'other3'], ['other2'])) self.ha.dcs.write_sync_state = Mock(return_value=True) self.ha.run_cycle() - # mock_set_sync.assert_called_once_with(['other2']) - calls = [call(['other2']), call(['other2', 'other3'])] - mock_set_sync.assert_has_calls(calls) + self.assertEqual(mock_set_sync.call_args_list[0][0], (['other2'],)) + self.assertEqual(mock_set_sync.call_args_list[1][0], (['other2', 'other3'],)) mock_set_sync.reset_mock() # Test sync standby is not disabled when updating dcs fails