|
|
15f218 |
From 60a297aa6a1e2d31619da281d843235edcaa43bb Mon Sep 17 00:00:00 2001
|
|
|
15f218 |
From: Ivan Devat <idevat@redhat.com>
|
|
|
15f218 |
Date: Wed, 14 Sep 2016 09:04:57 +0200
|
|
|
15f218 |
Subject: [PATCH] squash test corrections
|
|
|
15f218 |
|
|
|
15f218 |
test: import correct unittest version
|
|
|
15f218 |
|
|
|
15f218 |
test: merge modules importing unittest with version care
|
|
|
15f218 |
|
|
|
15f218 |
test: factor out recurring fixture in tests
|
|
|
15f218 |
---
|
|
|
15f218 |
pcs/cli/booth/test/test_command.py | 4 ++--
|
|
|
15f218 |
pcs/cli/booth/test/test_env.py | 4 ++--
|
|
|
15f218 |
pcs/cli/common/test/test_completion.py | 2 +-
|
|
|
15f218 |
pcs/cli/common/test/test_console_report.py | 2 +-
|
|
|
15f218 |
pcs/cli/common/test/test_lib_wrapper.py | 4 ++--
|
|
|
15f218 |
pcs/cli/common/test/test_middleware.py | 2 +-
|
|
|
15f218 |
pcs/cli/common/test/test_parse_args.py | 2 +-
|
|
|
15f218 |
pcs/cli/constraint/test/test_command.py | 4 ++--
|
|
|
15f218 |
pcs/cli/constraint/test/test_console_report.py | 2 +-
|
|
|
15f218 |
pcs/cli/constraint/test/test_parse_args.py | 9 ++-------
|
|
|
15f218 |
pcs/cli/constraint_all/test/test_console_report.py | 4 ++--
|
|
|
15f218 |
pcs/cli/constraint_ticket/test/test_command.py | 4 ++--
|
|
|
15f218 |
pcs/cli/constraint_ticket/test/test_console_report.py | 2 +-
|
|
|
15f218 |
pcs/cli/constraint_ticket/test/test_parse_args.py | 2 +-
|
|
|
15f218 |
pcs/lib/booth/test/test_config_exchange.py | 2 +-
|
|
|
15f218 |
pcs/lib/booth/test/test_config_files.py | 10 ++++------
|
|
|
15f218 |
pcs/lib/booth/test/test_config_structure.py | 4 ++--
|
|
|
15f218 |
pcs/lib/booth/test/test_env.py | 11 ++++-------
|
|
|
15f218 |
pcs/lib/booth/test/test_resource.py | 4 ++--
|
|
|
15f218 |
pcs/lib/booth/test/test_status.py | 4 ++--
|
|
|
15f218 |
pcs/lib/booth/test/test_sync.py | 4 ++--
|
|
|
15f218 |
pcs/lib/cib/test/test_alert.py | 4 ++--
|
|
|
15f218 |
pcs/lib/cib/test/test_constraint.py | 4 ++--
|
|
|
15f218 |
pcs/lib/cib/test/test_constraint_colocation.py | 4 ++--
|
|
|
15f218 |
pcs/lib/cib/test/test_constraint_order.py | 4 ++--
|
|
|
15f218 |
pcs/lib/cib/test/test_constraint_ticket.py | 4 ++--
|
|
|
15f218 |
pcs/lib/cib/test/test_nvpair.py | 2 +-
|
|
|
15f218 |
pcs/lib/cib/test/test_resource.py | 2 +-
|
|
|
15f218 |
pcs/lib/cib/test/test_resource_set.py | 4 ++--
|
|
|
15f218 |
pcs/lib/commands/test/test_alert.py | 4 ++--
|
|
|
15f218 |
pcs/lib/commands/test/test_booth.py | 10 ++++------
|
|
|
15f218 |
pcs/lib/commands/test/test_constraint_common.py | 4 ++--
|
|
|
15f218 |
pcs/lib/commands/test/test_ticket.py | 2 +-
|
|
|
15f218 |
pcs/lib/test/misc.py | 2 +-
|
|
|
15f218 |
pcs/lib/test/test_env_file.py | 4 ++--
|
|
|
15f218 |
pcs/lib/test/test_errors.py | 2 +-
|
|
|
15f218 |
pcs/lib/test/test_pacemaker_values.py | 2 +-
|
|
|
15f218 |
pcs/test/test_acl.py | 2 +-
|
|
|
15f218 |
pcs/test/test_cluster.py | 2 +-
|
|
|
15f218 |
pcs/test/test_common_tools.py | 2 +-
|
|
|
15f218 |
pcs/test/test_constraints.py | 2 +-
|
|
|
15f218 |
pcs/test/test_lib_cib_acl.py | 2 +-
|
|
|
15f218 |
pcs/test/test_lib_cib_tools.py | 4 ++--
|
|
|
15f218 |
pcs/test/test_lib_commands_qdevice.py | 4 ++--
|
|
|
15f218 |
pcs/test/test_lib_commands_quorum.py | 4 ++--
|
|
|
15f218 |
pcs/test/test_lib_commands_sbd.py | 4 ++--
|
|
|
15f218 |
pcs/test/test_lib_corosync_config_facade.py | 2 +-
|
|
|
15f218 |
pcs/test/test_lib_corosync_config_parser.py | 2 +-
|
|
|
15f218 |
pcs/test/test_lib_corosync_live.py | 4 ++--
|
|
|
15f218 |
pcs/test/test_lib_corosync_qdevice_client.py | 4 ++--
|
|
|
15f218 |
pcs/test/test_lib_corosync_qdevice_net.py | 4 ++--
|
|
|
15f218 |
pcs/test/test_lib_env.py | 4 ++--
|
|
|
15f218 |
pcs/test/test_lib_external.py | 4 ++--
|
|
|
15f218 |
pcs/test/test_lib_node.py | 2 +-
|
|
|
15f218 |
pcs/test/test_lib_nodes_task.py | 4 ++--
|
|
|
15f218 |
pcs/test/test_lib_pacemaker.py | 4 ++--
|
|
|
15f218 |
pcs/test/test_lib_pacemaker_state.py | 2 +-
|
|
|
15f218 |
pcs/test/test_lib_resource_agent.py | 4 ++--
|
|
|
15f218 |
pcs/test/test_lib_sbd.py | 4 ++--
|
|
|
15f218 |
pcs/test/test_lib_tools.py | 2 +-
|
|
|
15f218 |
pcs/test/test_node.py | 2 +-
|
|
|
15f218 |
pcs/test/test_properties.py | 2 +-
|
|
|
15f218 |
pcs/test/test_quorum.py | 2 +-
|
|
|
15f218 |
pcs/test/test_resource.py | 2 +-
|
|
|
15f218 |
pcs/test/test_rule.py | 2 +-
|
|
|
15f218 |
pcs/test/test_stonith.py | 2 +-
|
|
|
15f218 |
pcs/test/test_utils.py | 2 +-
|
|
|
15f218 |
pcs/test/tools/misc.py | 14 ++++++++++++++
|
|
|
15f218 |
pcs/test/tools/pcs_mock.py | 13 -------------
|
|
|
15f218 |
pcs/test/tools/pcs_unittest.py | 19 +++++++++++++++++++
|
|
|
15f218 |
70 files changed, 142 insertions(+), 134 deletions(-)
|
|
|
15f218 |
delete mode 100644 pcs/test/tools/pcs_mock.py
|
|
|
15f218 |
|
|
|
15f218 |
diff --git a/pcs/cli/booth/test/test_command.py b/pcs/cli/booth/test/test_command.py
|
|
|
15f218 |
index 019a74f..44d7a12 100644
|
|
|
15f218 |
--- a/pcs/cli/booth/test/test_command.py
|
|
|
15f218 |
+++ b/pcs/cli/booth/test/test_command.py
|
|
|
15f218 |
@@ -5,10 +5,10 @@ from __future__ import (
|
|
|
15f218 |
unicode_literals,
|
|
|
15f218 |
)
|
|
|
15f218 |
|
|
|
15f218 |
-from unittest import TestCase
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import TestCase
|
|
|
15f218 |
|
|
|
15f218 |
from pcs.cli.booth import command
|
|
|
15f218 |
-from pcs.test.tools.pcs_mock import mock
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import mock
|
|
|
15f218 |
|
|
|
15f218 |
|
|
|
15f218 |
class ConfigSetupTest(TestCase):
|
|
|
15f218 |
diff --git a/pcs/cli/booth/test/test_env.py b/pcs/cli/booth/test/test_env.py
|
|
|
15f218 |
index 1ead6f2..b1d80aa 100644
|
|
|
15f218 |
--- a/pcs/cli/booth/test/test_env.py
|
|
|
15f218 |
+++ b/pcs/cli/booth/test/test_env.py
|
|
|
15f218 |
@@ -5,12 +5,12 @@ from __future__ import (
|
|
|
15f218 |
unicode_literals,
|
|
|
15f218 |
)
|
|
|
15f218 |
|
|
|
15f218 |
-from unittest import TestCase
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import TestCase
|
|
|
15f218 |
|
|
|
15f218 |
from pcs.cli.booth.env import middleware_config
|
|
|
15f218 |
from pcs.common import report_codes, env_file_role_codes
|
|
|
15f218 |
from pcs.lib.errors import LibraryEnvError, ReportItem
|
|
|
15f218 |
-from pcs.test.tools.pcs_mock import mock
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import mock
|
|
|
15f218 |
|
|
|
15f218 |
|
|
|
15f218 |
class BoothConfTest(TestCase):
|
|
|
15f218 |
diff --git a/pcs/cli/common/test/test_completion.py b/pcs/cli/common/test/test_completion.py
|
|
|
15f218 |
index 865da2c..daec1bc 100644
|
|
|
15f218 |
--- a/pcs/cli/common/test/test_completion.py
|
|
|
15f218 |
+++ b/pcs/cli/common/test/test_completion.py
|
|
|
15f218 |
@@ -5,7 +5,7 @@ from __future__ import (
|
|
|
15f218 |
unicode_literals,
|
|
|
15f218 |
)
|
|
|
15f218 |
|
|
|
15f218 |
-from unittest import TestCase
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import TestCase
|
|
|
15f218 |
|
|
|
15f218 |
from pcs.cli.common.completion import (
|
|
|
15f218 |
_find_suggestions,
|
|
|
15f218 |
diff --git a/pcs/cli/common/test/test_console_report.py b/pcs/cli/common/test/test_console_report.py
|
|
|
15f218 |
index 23cf8e9..63fe55c 100644
|
|
|
15f218 |
--- a/pcs/cli/common/test/test_console_report.py
|
|
|
15f218 |
+++ b/pcs/cli/common/test/test_console_report.py
|
|
|
15f218 |
@@ -5,7 +5,7 @@ from __future__ import (
|
|
|
15f218 |
unicode_literals,
|
|
|
15f218 |
)
|
|
|
15f218 |
|
|
|
15f218 |
-from unittest import TestCase
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import TestCase
|
|
|
15f218 |
from pcs.cli.common.console_report import indent
|
|
|
15f218 |
|
|
|
15f218 |
class IndentTest(TestCase):
|
|
|
15f218 |
diff --git a/pcs/cli/common/test/test_lib_wrapper.py b/pcs/cli/common/test/test_lib_wrapper.py
|
|
|
15f218 |
index c10bb62..149e612 100644
|
|
|
15f218 |
--- a/pcs/cli/common/test/test_lib_wrapper.py
|
|
|
15f218 |
+++ b/pcs/cli/common/test/test_lib_wrapper.py
|
|
|
15f218 |
@@ -4,10 +4,10 @@ from __future__ import (
|
|
|
15f218 |
print_function,
|
|
|
15f218 |
unicode_literals,
|
|
|
15f218 |
)
|
|
|
15f218 |
-from unittest import TestCase
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import TestCase
|
|
|
15f218 |
|
|
|
15f218 |
from pcs.cli.common.lib_wrapper import Library, bind
|
|
|
15f218 |
-from pcs.test.tools.pcs_mock import mock
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import mock
|
|
|
15f218 |
from pcs.lib.errors import ReportItem
|
|
|
15f218 |
from pcs.lib.errors import LibraryEnvError
|
|
|
15f218 |
|
|
|
15f218 |
diff --git a/pcs/cli/common/test/test_middleware.py b/pcs/cli/common/test/test_middleware.py
|
|
|
15f218 |
index c030cd9..7eefbca 100644
|
|
|
15f218 |
--- a/pcs/cli/common/test/test_middleware.py
|
|
|
15f218 |
+++ b/pcs/cli/common/test/test_middleware.py
|
|
|
15f218 |
@@ -5,7 +5,7 @@ from __future__ import (
|
|
|
15f218 |
unicode_literals,
|
|
|
15f218 |
)
|
|
|
15f218 |
|
|
|
15f218 |
-from unittest import TestCase
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import TestCase
|
|
|
15f218 |
|
|
|
15f218 |
from pcs.cli.common import middleware
|
|
|
15f218 |
|
|
|
15f218 |
diff --git a/pcs/cli/common/test/test_parse_args.py b/pcs/cli/common/test/test_parse_args.py
|
|
|
15f218 |
index eb358a5..23704b9 100644
|
|
|
15f218 |
--- a/pcs/cli/common/test/test_parse_args.py
|
|
|
15f218 |
+++ b/pcs/cli/common/test/test_parse_args.py
|
|
|
15f218 |
@@ -5,7 +5,7 @@ from __future__ import (
|
|
|
15f218 |
unicode_literals,
|
|
|
15f218 |
)
|
|
|
15f218 |
|
|
|
15f218 |
-from unittest import TestCase
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import TestCase
|
|
|
15f218 |
from pcs.cli.common.parse_args import(
|
|
|
15f218 |
split_list,
|
|
|
15f218 |
prepare_options,
|
|
|
15f218 |
diff --git a/pcs/cli/constraint/test/test_command.py b/pcs/cli/constraint/test/test_command.py
|
|
|
15f218 |
index 5b493cd..6a79e00 100644
|
|
|
15f218 |
--- a/pcs/cli/constraint/test/test_command.py
|
|
|
15f218 |
+++ b/pcs/cli/constraint/test/test_command.py
|
|
|
15f218 |
@@ -5,10 +5,10 @@ from __future__ import (
|
|
|
15f218 |
unicode_literals,
|
|
|
15f218 |
)
|
|
|
15f218 |
|
|
|
15f218 |
-from unittest import TestCase
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import TestCase
|
|
|
15f218 |
from pcs.cli.constraint import command
|
|
|
15f218 |
|
|
|
15f218 |
-from pcs.test.tools.pcs_mock import mock
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import mock
|
|
|
15f218 |
|
|
|
15f218 |
def fixture_constraint():
|
|
|
15f218 |
return {
|
|
|
15f218 |
diff --git a/pcs/cli/constraint/test/test_console_report.py b/pcs/cli/constraint/test/test_console_report.py
|
|
|
15f218 |
index b20bc80..084124c 100644
|
|
|
15f218 |
--- a/pcs/cli/constraint/test/test_console_report.py
|
|
|
15f218 |
+++ b/pcs/cli/constraint/test/test_console_report.py
|
|
|
15f218 |
@@ -5,7 +5,7 @@ from __future__ import (
|
|
|
15f218 |
unicode_literals,
|
|
|
15f218 |
)
|
|
|
15f218 |
|
|
|
15f218 |
-from unittest import TestCase
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import TestCase
|
|
|
15f218 |
from pcs.cli.constraint import console_report
|
|
|
15f218 |
|
|
|
15f218 |
class OptionsTest(TestCase):
|
|
|
15f218 |
diff --git a/pcs/cli/constraint/test/test_parse_args.py b/pcs/cli/constraint/test/test_parse_args.py
|
|
|
15f218 |
index 7673023..484cb8d 100644
|
|
|
15f218 |
--- a/pcs/cli/constraint/test/test_parse_args.py
|
|
|
15f218 |
+++ b/pcs/cli/constraint/test/test_parse_args.py
|
|
|
15f218 |
@@ -5,16 +5,11 @@ from __future__ import (
|
|
|
15f218 |
unicode_literals,
|
|
|
15f218 |
)
|
|
|
15f218 |
|
|
|
15f218 |
-from unittest import TestCase
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import TestCase
|
|
|
15f218 |
|
|
|
15f218 |
from pcs.cli.common.errors import CmdLineInputError
|
|
|
15f218 |
from pcs.cli.constraint.parse_args import prepare_set_args, prepare_resource_sets
|
|
|
15f218 |
-
|
|
|
15f218 |
-
|
|
|
15f218 |
-try:
|
|
|
15f218 |
- import unittest.mock as mock
|
|
|
15f218 |
-except ImportError:
|
|
|
15f218 |
- import mock
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import mock
|
|
|
15f218 |
|
|
|
15f218 |
|
|
|
15f218 |
@mock.patch("pcs.cli.common.parse_args.prepare_options")
|
|
|
15f218 |
diff --git a/pcs/cli/constraint_all/test/test_console_report.py b/pcs/cli/constraint_all/test/test_console_report.py
|
|
|
15f218 |
index 1cf5721..61be2cc 100644
|
|
|
15f218 |
--- a/pcs/cli/constraint_all/test/test_console_report.py
|
|
|
15f218 |
+++ b/pcs/cli/constraint_all/test/test_console_report.py
|
|
|
15f218 |
@@ -5,8 +5,8 @@ from __future__ import (
|
|
|
15f218 |
unicode_literals,
|
|
|
15f218 |
)
|
|
|
15f218 |
|
|
|
15f218 |
-from unittest import TestCase
|
|
|
15f218 |
-from pcs.test.tools.pcs_mock import mock
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import TestCase
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import mock
|
|
|
15f218 |
from pcs.cli.constraint_all import console_report
|
|
|
15f218 |
|
|
|
15f218 |
class ConstraintTest(TestCase):
|
|
|
15f218 |
diff --git a/pcs/cli/constraint_ticket/test/test_command.py b/pcs/cli/constraint_ticket/test/test_command.py
|
|
|
15f218 |
index 045d336..d40d421 100644
|
|
|
15f218 |
--- a/pcs/cli/constraint_ticket/test/test_command.py
|
|
|
15f218 |
+++ b/pcs/cli/constraint_ticket/test/test_command.py
|
|
|
15f218 |
@@ -5,9 +5,9 @@ from __future__ import (
|
|
|
15f218 |
unicode_literals,
|
|
|
15f218 |
)
|
|
|
15f218 |
|
|
|
15f218 |
-from unittest import TestCase
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import TestCase
|
|
|
15f218 |
|
|
|
15f218 |
-from pcs.test.tools.pcs_mock import mock
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import mock
|
|
|
15f218 |
from pcs.cli.common.errors import CmdLineInputError
|
|
|
15f218 |
from pcs.cli.constraint_ticket import command
|
|
|
15f218 |
|
|
|
15f218 |
diff --git a/pcs/cli/constraint_ticket/test/test_console_report.py b/pcs/cli/constraint_ticket/test/test_console_report.py
|
|
|
15f218 |
index b352287..11af2e2 100644
|
|
|
15f218 |
--- a/pcs/cli/constraint_ticket/test/test_console_report.py
|
|
|
15f218 |
+++ b/pcs/cli/constraint_ticket/test/test_console_report.py
|
|
|
15f218 |
@@ -5,7 +5,7 @@ from __future__ import (
|
|
|
15f218 |
unicode_literals,
|
|
|
15f218 |
)
|
|
|
15f218 |
|
|
|
15f218 |
-from unittest import TestCase
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import TestCase
|
|
|
15f218 |
from pcs.cli.constraint_ticket import console_report
|
|
|
15f218 |
|
|
|
15f218 |
class ConstraintPlainTest(TestCase):
|
|
|
15f218 |
diff --git a/pcs/cli/constraint_ticket/test/test_parse_args.py b/pcs/cli/constraint_ticket/test/test_parse_args.py
|
|
|
15f218 |
index 9d23167..4a592c2 100644
|
|
|
15f218 |
--- a/pcs/cli/constraint_ticket/test/test_parse_args.py
|
|
|
15f218 |
+++ b/pcs/cli/constraint_ticket/test/test_parse_args.py
|
|
|
15f218 |
@@ -5,7 +5,7 @@ from __future__ import (
|
|
|
15f218 |
unicode_literals,
|
|
|
15f218 |
)
|
|
|
15f218 |
|
|
|
15f218 |
-from unittest import TestCase
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import TestCase
|
|
|
15f218 |
from pcs.cli.constraint_ticket import parse_args
|
|
|
15f218 |
from pcs.cli.common.errors import CmdLineInputError
|
|
|
15f218 |
|
|
|
15f218 |
diff --git a/pcs/lib/booth/test/test_config_exchange.py b/pcs/lib/booth/test/test_config_exchange.py
|
|
|
15f218 |
index eb1885c..9717a96 100644
|
|
|
15f218 |
--- a/pcs/lib/booth/test/test_config_exchange.py
|
|
|
15f218 |
+++ b/pcs/lib/booth/test/test_config_exchange.py
|
|
|
15f218 |
@@ -4,7 +4,7 @@ from __future__ import (
|
|
|
15f218 |
print_function,
|
|
|
15f218 |
unicode_literals,
|
|
|
15f218 |
)
|
|
|
15f218 |
-from unittest import TestCase
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import TestCase
|
|
|
15f218 |
from pcs.lib.booth import config_structure, config_exchange
|
|
|
15f218 |
|
|
|
15f218 |
|
|
|
15f218 |
diff --git a/pcs/lib/booth/test/test_config_files.py b/pcs/lib/booth/test/test_config_files.py
|
|
|
15f218 |
index 8266cac..d0df256 100644
|
|
|
15f218 |
--- a/pcs/lib/booth/test/test_config_files.py
|
|
|
15f218 |
+++ b/pcs/lib/booth/test/test_config_files.py
|
|
|
15f218 |
@@ -6,7 +6,7 @@ from __future__ import (
|
|
|
15f218 |
)
|
|
|
15f218 |
|
|
|
15f218 |
import os.path
|
|
|
15f218 |
-from unittest import TestCase
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import TestCase
|
|
|
15f218 |
|
|
|
15f218 |
from pcs.common import report_codes, env_file_role_codes as file_roles
|
|
|
15f218 |
from pcs.lib.booth import config_files
|
|
|
15f218 |
@@ -14,12 +14,10 @@ from pcs.lib.errors import ReportItemSeverity as severities
|
|
|
15f218 |
from pcs.settings import booth_config_dir as BOOTH_CONFIG_DIR
|
|
|
15f218 |
from pcs.test.tools.assertions import assert_raise_library_error, assert_report_item_list_equal
|
|
|
15f218 |
from pcs.test.tools.custom_mock import MockLibraryReportProcessor
|
|
|
15f218 |
-from pcs.test.tools.pcs_mock import mock
|
|
|
15f218 |
+from pcs.test.tools.misc import create_patcher
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import mock
|
|
|
15f218 |
|
|
|
15f218 |
-def patch_config_files(target, *args, **kwargs):
|
|
|
15f218 |
- return mock.patch(
|
|
|
15f218 |
- "pcs.lib.booth.config_files.{0}".format(target), *args, **kwargs
|
|
|
15f218 |
- )
|
|
|
15f218 |
+patch_config_files = create_patcher("pcs.lib.booth.config_files")
|
|
|
15f218 |
|
|
|
15f218 |
@mock.patch("os.path.isdir")
|
|
|
15f218 |
@mock.patch("os.listdir")
|
|
|
15f218 |
diff --git a/pcs/lib/booth/test/test_config_structure.py b/pcs/lib/booth/test/test_config_structure.py
|
|
|
15f218 |
index 1dd07cb..5e7ac68 100644
|
|
|
15f218 |
--- a/pcs/lib/booth/test/test_config_structure.py
|
|
|
15f218 |
+++ b/pcs/lib/booth/test/test_config_structure.py
|
|
|
15f218 |
@@ -5,13 +5,13 @@ from __future__ import (
|
|
|
15f218 |
unicode_literals,
|
|
|
15f218 |
)
|
|
|
15f218 |
|
|
|
15f218 |
-from unittest import TestCase
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import TestCase
|
|
|
15f218 |
|
|
|
15f218 |
from pcs.common import report_codes
|
|
|
15f218 |
from pcs.lib.booth import config_structure
|
|
|
15f218 |
from pcs.lib.errors import ReportItemSeverity as severities
|
|
|
15f218 |
from pcs.test.tools.assertions import assert_raise_library_error
|
|
|
15f218 |
-from pcs.test.tools.pcs_mock import mock
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import mock
|
|
|
15f218 |
|
|
|
15f218 |
|
|
|
15f218 |
class ValidateTicketExistsTest(TestCase):
|
|
|
15f218 |
diff --git a/pcs/lib/booth/test/test_env.py b/pcs/lib/booth/test/test_env.py
|
|
|
15f218 |
index 77e0944..993d709 100644
|
|
|
15f218 |
--- a/pcs/lib/booth/test/test_env.py
|
|
|
15f218 |
+++ b/pcs/lib/booth/test/test_env.py
|
|
|
15f218 |
@@ -8,20 +8,17 @@ from __future__ import (
|
|
|
15f218 |
import grp
|
|
|
15f218 |
import os
|
|
|
15f218 |
import pwd
|
|
|
15f218 |
-from unittest import TestCase
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import TestCase
|
|
|
15f218 |
|
|
|
15f218 |
from pcs import settings
|
|
|
15f218 |
from pcs.common import report_codes
|
|
|
15f218 |
from pcs.lib.booth import env
|
|
|
15f218 |
from pcs.lib.errors import ReportItemSeverity as severities
|
|
|
15f218 |
from pcs.test.tools.assertions import assert_raise_library_error
|
|
|
15f218 |
-from pcs.test.tools.misc import get_test_resource as rc
|
|
|
15f218 |
-from pcs.test.tools.pcs_mock import mock
|
|
|
15f218 |
+from pcs.test.tools.misc import get_test_resource as rc, create_patcher
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import mock
|
|
|
15f218 |
|
|
|
15f218 |
-def patch_env(target, *args, **kwargs):
|
|
|
15f218 |
- return mock.patch(
|
|
|
15f218 |
- "pcs.lib.booth.env.{0}".format(target), *args, **kwargs
|
|
|
15f218 |
- )
|
|
|
15f218 |
+patch_env = create_patcher("pcs.lib.booth.env")
|
|
|
15f218 |
|
|
|
15f218 |
class GetConfigFileNameTest(TestCase):
|
|
|
15f218 |
@patch_env("os.path.exists")
|
|
|
15f218 |
diff --git a/pcs/lib/booth/test/test_resource.py b/pcs/lib/booth/test/test_resource.py
|
|
|
15f218 |
index dd72c1e..8971438 100644
|
|
|
15f218 |
--- a/pcs/lib/booth/test/test_resource.py
|
|
|
15f218 |
+++ b/pcs/lib/booth/test/test_resource.py
|
|
|
15f218 |
@@ -5,12 +5,12 @@ from __future__ import (
|
|
|
15f218 |
unicode_literals,
|
|
|
15f218 |
)
|
|
|
15f218 |
|
|
|
15f218 |
-from unittest import TestCase
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import TestCase
|
|
|
15f218 |
|
|
|
15f218 |
from lxml import etree
|
|
|
15f218 |
|
|
|
15f218 |
import pcs.lib.booth.resource as booth_resource
|
|
|
15f218 |
-from pcs.test.tools.pcs_mock import mock
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import mock
|
|
|
15f218 |
from pcs.test.tools.misc import get_test_resource as rc
|
|
|
15f218 |
|
|
|
15f218 |
|
|
|
15f218 |
diff --git a/pcs/lib/booth/test/test_status.py b/pcs/lib/booth/test/test_status.py
|
|
|
15f218 |
index 0ea837a..d47ffca 100644
|
|
|
15f218 |
--- a/pcs/lib/booth/test/test_status.py
|
|
|
15f218 |
+++ b/pcs/lib/booth/test/test_status.py
|
|
|
15f218 |
@@ -5,7 +5,7 @@ from __future__ import (
|
|
|
15f218 |
unicode_literals,
|
|
|
15f218 |
)
|
|
|
15f218 |
|
|
|
15f218 |
-from unittest import TestCase
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import TestCase
|
|
|
15f218 |
|
|
|
15f218 |
try:
|
|
|
15f218 |
# python 2
|
|
|
15f218 |
@@ -15,7 +15,7 @@ except ImportError:
|
|
|
15f218 |
# python 3
|
|
|
15f218 |
from urllib.parse import parse_qs as url_decode
|
|
|
15f218 |
|
|
|
15f218 |
-from pcs.test.tools.pcs_mock import mock
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import mock
|
|
|
15f218 |
from pcs.test.tools.assertions import assert_raise_library_error
|
|
|
15f218 |
|
|
|
15f218 |
from pcs import settings
|
|
|
15f218 |
diff --git a/pcs/lib/booth/test/test_sync.py b/pcs/lib/booth/test/test_sync.py
|
|
|
15f218 |
index 9ba6e80..701b086 100644
|
|
|
15f218 |
--- a/pcs/lib/booth/test/test_sync.py
|
|
|
15f218 |
+++ b/pcs/lib/booth/test/test_sync.py
|
|
|
15f218 |
@@ -5,7 +5,7 @@ from __future__ import (
|
|
|
15f218 |
unicode_literals,
|
|
|
15f218 |
)
|
|
|
15f218 |
|
|
|
15f218 |
-from unittest import TestCase
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import TestCase
|
|
|
15f218 |
|
|
|
15f218 |
import json
|
|
|
15f218 |
import base64
|
|
|
15f218 |
@@ -16,7 +16,7 @@ except ImportError:
|
|
|
15f218 |
# python 3
|
|
|
15f218 |
from urllib.parse import parse_qs as url_decode
|
|
|
15f218 |
|
|
|
15f218 |
-from pcs.test.tools.pcs_mock import mock
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import mock
|
|
|
15f218 |
from pcs.test.tools.assertions import (
|
|
|
15f218 |
assert_report_item_list_equal,
|
|
|
15f218 |
assert_raise_library_error,
|
|
|
15f218 |
diff --git a/pcs/lib/cib/test/test_alert.py b/pcs/lib/cib/test/test_alert.py
|
|
|
15f218 |
index 50eaef6..c47dd1e 100644
|
|
|
15f218 |
--- a/pcs/lib/cib/test/test_alert.py
|
|
|
15f218 |
+++ b/pcs/lib/cib/test/test_alert.py
|
|
|
15f218 |
@@ -5,7 +5,7 @@ from __future__ import (
|
|
|
15f218 |
unicode_literals,
|
|
|
15f218 |
)
|
|
|
15f218 |
|
|
|
15f218 |
-from unittest import TestCase
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import TestCase
|
|
|
15f218 |
|
|
|
15f218 |
from lxml import etree
|
|
|
15f218 |
|
|
|
15f218 |
@@ -17,7 +17,7 @@ from pcs.test.tools.assertions import(
|
|
|
15f218 |
assert_xml_equal,
|
|
|
15f218 |
assert_report_item_list_equal,
|
|
|
15f218 |
)
|
|
|
15f218 |
-from pcs.test.tools.pcs_mock import mock
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import mock
|
|
|
15f218 |
from pcs.test.tools.custom_mock import MockLibraryReportProcessor
|
|
|
15f218 |
|
|
|
15f218 |
|
|
|
15f218 |
diff --git a/pcs/lib/cib/test/test_constraint.py b/pcs/lib/cib/test/test_constraint.py
|
|
|
15f218 |
index 961f8b0..a4ee636 100644
|
|
|
15f218 |
--- a/pcs/lib/cib/test/test_constraint.py
|
|
|
15f218 |
+++ b/pcs/lib/cib/test/test_constraint.py
|
|
|
15f218 |
@@ -6,7 +6,7 @@ from __future__ import (
|
|
|
15f218 |
)
|
|
|
15f218 |
|
|
|
15f218 |
from functools import partial
|
|
|
15f218 |
-from unittest import TestCase
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import TestCase
|
|
|
15f218 |
|
|
|
15f218 |
from lxml import etree
|
|
|
15f218 |
|
|
|
15f218 |
@@ -18,7 +18,7 @@ from pcs.test.tools.assertions import(
|
|
|
15f218 |
assert_xml_equal,
|
|
|
15f218 |
)
|
|
|
15f218 |
from pcs.test.tools.custom_mock import MockLibraryReportProcessor
|
|
|
15f218 |
-from pcs.test.tools.pcs_mock import mock
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import mock
|
|
|
15f218 |
from pcs.test.tools.assertions import (
|
|
|
15f218 |
assert_report_item_list_equal,
|
|
|
15f218 |
)
|
|
|
15f218 |
diff --git a/pcs/lib/cib/test/test_constraint_colocation.py b/pcs/lib/cib/test/test_constraint_colocation.py
|
|
|
15f218 |
index 377b981..6a85d8a 100644
|
|
|
15f218 |
--- a/pcs/lib/cib/test/test_constraint_colocation.py
|
|
|
15f218 |
+++ b/pcs/lib/cib/test/test_constraint_colocation.py
|
|
|
15f218 |
@@ -5,13 +5,13 @@ from __future__ import (
|
|
|
15f218 |
unicode_literals,
|
|
|
15f218 |
)
|
|
|
15f218 |
|
|
|
15f218 |
-from unittest import TestCase
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import TestCase
|
|
|
15f218 |
|
|
|
15f218 |
from pcs.common import report_codes
|
|
|
15f218 |
from pcs.lib.cib.constraint import colocation
|
|
|
15f218 |
from pcs.lib.errors import ReportItemSeverity as severities
|
|
|
15f218 |
from pcs.test.tools.assertions import assert_raise_library_error
|
|
|
15f218 |
-from pcs.test.tools.pcs_mock import mock
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import mock
|
|
|
15f218 |
|
|
|
15f218 |
|
|
|
15f218 |
#Patch check_new_id_applicable is always desired when working with
|
|
|
15f218 |
diff --git a/pcs/lib/cib/test/test_constraint_order.py b/pcs/lib/cib/test/test_constraint_order.py
|
|
|
15f218 |
index 02d1c5f..3cb33d1 100644
|
|
|
15f218 |
--- a/pcs/lib/cib/test/test_constraint_order.py
|
|
|
15f218 |
+++ b/pcs/lib/cib/test/test_constraint_order.py
|
|
|
15f218 |
@@ -5,13 +5,13 @@ from __future__ import (
|
|
|
15f218 |
unicode_literals,
|
|
|
15f218 |
)
|
|
|
15f218 |
|
|
|
15f218 |
-from unittest import TestCase
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import TestCase
|
|
|
15f218 |
|
|
|
15f218 |
from pcs.common import report_codes
|
|
|
15f218 |
from pcs.lib.cib.constraint import order
|
|
|
15f218 |
from pcs.lib.errors import ReportItemSeverity as severities
|
|
|
15f218 |
from pcs.test.tools.assertions import assert_raise_library_error
|
|
|
15f218 |
-from pcs.test.tools.pcs_mock import mock
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import mock
|
|
|
15f218 |
|
|
|
15f218 |
|
|
|
15f218 |
#Patch check_new_id_applicable is always desired when working with
|
|
|
15f218 |
diff --git a/pcs/lib/cib/test/test_constraint_ticket.py b/pcs/lib/cib/test/test_constraint_ticket.py
|
|
|
15f218 |
index 87fd1e5..ede748e 100644
|
|
|
15f218 |
--- a/pcs/lib/cib/test/test_constraint_ticket.py
|
|
|
15f218 |
+++ b/pcs/lib/cib/test/test_constraint_ticket.py
|
|
|
15f218 |
@@ -6,13 +6,13 @@ from __future__ import (
|
|
|
15f218 |
)
|
|
|
15f218 |
|
|
|
15f218 |
from functools import partial
|
|
|
15f218 |
-from unittest import TestCase
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import TestCase
|
|
|
15f218 |
|
|
|
15f218 |
from pcs.common import report_codes
|
|
|
15f218 |
from pcs.lib.cib.constraint import ticket
|
|
|
15f218 |
from pcs.lib.errors import ReportItemSeverity as severities
|
|
|
15f218 |
from pcs.test.tools.assertions import assert_raise_library_error
|
|
|
15f218 |
-from pcs.test.tools.pcs_mock import mock
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import mock
|
|
|
15f218 |
|
|
|
15f218 |
|
|
|
15f218 |
@mock.patch("pcs.lib.cib.constraint.ticket.tools.check_new_id_applicable")
|
|
|
15f218 |
diff --git a/pcs/lib/cib/test/test_nvpair.py b/pcs/lib/cib/test/test_nvpair.py
|
|
|
15f218 |
index 6907f25..56ba4d1 100644
|
|
|
15f218 |
--- a/pcs/lib/cib/test/test_nvpair.py
|
|
|
15f218 |
+++ b/pcs/lib/cib/test/test_nvpair.py
|
|
|
15f218 |
@@ -5,7 +5,7 @@ from __future__ import (
|
|
|
15f218 |
unicode_literals,
|
|
|
15f218 |
)
|
|
|
15f218 |
|
|
|
15f218 |
-from unittest import TestCase
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import TestCase
|
|
|
15f218 |
|
|
|
15f218 |
from lxml import etree
|
|
|
15f218 |
|
|
|
15f218 |
diff --git a/pcs/lib/cib/test/test_resource.py b/pcs/lib/cib/test/test_resource.py
|
|
|
15f218 |
index ef33ef6..c1e21a0 100644
|
|
|
15f218 |
--- a/pcs/lib/cib/test/test_resource.py
|
|
|
15f218 |
+++ b/pcs/lib/cib/test/test_resource.py
|
|
|
15f218 |
@@ -5,7 +5,7 @@ from __future__ import (
|
|
|
15f218 |
unicode_literals,
|
|
|
15f218 |
)
|
|
|
15f218 |
|
|
|
15f218 |
-from unittest import TestCase
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import TestCase
|
|
|
15f218 |
from lxml import etree
|
|
|
15f218 |
from pcs.lib.cib.resource import find_by_id
|
|
|
15f218 |
|
|
|
15f218 |
diff --git a/pcs/lib/cib/test/test_resource_set.py b/pcs/lib/cib/test/test_resource_set.py
|
|
|
15f218 |
index 7b77ac4..e4fd8e4 100644
|
|
|
15f218 |
--- a/pcs/lib/cib/test/test_resource_set.py
|
|
|
15f218 |
+++ b/pcs/lib/cib/test/test_resource_set.py
|
|
|
15f218 |
@@ -5,7 +5,7 @@ from __future__ import (
|
|
|
15f218 |
unicode_literals,
|
|
|
15f218 |
)
|
|
|
15f218 |
|
|
|
15f218 |
-from unittest import TestCase
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import TestCase
|
|
|
15f218 |
|
|
|
15f218 |
from lxml import etree
|
|
|
15f218 |
|
|
|
15f218 |
@@ -16,7 +16,7 @@ from pcs.test.tools.assertions import(
|
|
|
15f218 |
assert_raise_library_error,
|
|
|
15f218 |
assert_xml_equal
|
|
|
15f218 |
)
|
|
|
15f218 |
-from pcs.test.tools.pcs_mock import mock
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import mock
|
|
|
15f218 |
|
|
|
15f218 |
|
|
|
15f218 |
class PrepareSetTest(TestCase):
|
|
|
15f218 |
diff --git a/pcs/lib/commands/test/test_alert.py b/pcs/lib/commands/test/test_alert.py
|
|
|
15f218 |
index bced45e..bc68baf 100644
|
|
|
15f218 |
--- a/pcs/lib/commands/test/test_alert.py
|
|
|
15f218 |
+++ b/pcs/lib/commands/test/test_alert.py
|
|
|
15f218 |
@@ -8,9 +8,9 @@ from __future__ import (
|
|
|
15f218 |
import logging
|
|
|
15f218 |
from lxml import etree
|
|
|
15f218 |
|
|
|
15f218 |
-from unittest import TestCase
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import TestCase
|
|
|
15f218 |
|
|
|
15f218 |
-from pcs.test.tools.pcs_mock import mock
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import mock
|
|
|
15f218 |
from pcs.test.tools.assertions import (
|
|
|
15f218 |
assert_raise_library_error,
|
|
|
15f218 |
assert_xml_equal,
|
|
|
15f218 |
diff --git a/pcs/lib/commands/test/test_booth.py b/pcs/lib/commands/test/test_booth.py
|
|
|
15f218 |
index d2429b6..08d2c79 100644
|
|
|
15f218 |
--- a/pcs/lib/commands/test/test_booth.py
|
|
|
15f218 |
+++ b/pcs/lib/commands/test/test_booth.py
|
|
|
15f218 |
@@ -8,14 +8,15 @@ from __future__ import (
|
|
|
15f218 |
import os
|
|
|
15f218 |
import base64
|
|
|
15f218 |
|
|
|
15f218 |
-from unittest import TestCase
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import TestCase
|
|
|
15f218 |
|
|
|
15f218 |
-from pcs.test.tools.pcs_mock import mock
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import mock
|
|
|
15f218 |
from pcs.test.tools.custom_mock import MockLibraryReportProcessor
|
|
|
15f218 |
from pcs.test.tools.assertions import (
|
|
|
15f218 |
assert_raise_library_error,
|
|
|
15f218 |
assert_report_item_list_equal,
|
|
|
15f218 |
)
|
|
|
15f218 |
+from pcs.test.tools.misc import create_patcher
|
|
|
15f218 |
|
|
|
15f218 |
from pcs import settings
|
|
|
15f218 |
from pcs.common import report_codes
|
|
|
15f218 |
@@ -32,10 +33,7 @@ from pcs.lib.external import (
|
|
|
15f218 |
StopServiceError
|
|
|
15f218 |
)
|
|
|
15f218 |
|
|
|
15f218 |
-def patch_commands(target, *args, **kwargs):
|
|
|
15f218 |
- return mock.patch(
|
|
|
15f218 |
- "pcs.lib.commands.booth.{0}".format(target), *args, **kwargs
|
|
|
15f218 |
- )
|
|
|
15f218 |
+patch_commands = create_patcher("pcs.lib.commands.booth")
|
|
|
15f218 |
|
|
|
15f218 |
@mock.patch("pcs.lib.booth.config_files.generate_key", return_value="key value")
|
|
|
15f218 |
@mock.patch("pcs.lib.commands.booth.build", return_value="config content")
|
|
|
15f218 |
diff --git a/pcs/lib/commands/test/test_constraint_common.py b/pcs/lib/commands/test/test_constraint_common.py
|
|
|
15f218 |
index e0872ff..cb5e177 100644
|
|
|
15f218 |
--- a/pcs/lib/commands/test/test_constraint_common.py
|
|
|
15f218 |
+++ b/pcs/lib/commands/test/test_constraint_common.py
|
|
|
15f218 |
@@ -5,7 +5,7 @@ from __future__ import (
|
|
|
15f218 |
unicode_literals,
|
|
|
15f218 |
)
|
|
|
15f218 |
|
|
|
15f218 |
-from unittest import TestCase
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import TestCase
|
|
|
15f218 |
|
|
|
15f218 |
from lxml import etree
|
|
|
15f218 |
|
|
|
15f218 |
@@ -17,7 +17,7 @@ from pcs.test.tools.assertions import(
|
|
|
15f218 |
assert_xml_equal,
|
|
|
15f218 |
)
|
|
|
15f218 |
from pcs.test.tools.custom_mock import MockLibraryReportProcessor
|
|
|
15f218 |
-from pcs.test.tools.pcs_mock import mock
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import mock
|
|
|
15f218 |
|
|
|
15f218 |
|
|
|
15f218 |
def fixture_cib_and_constraints():
|
|
|
15f218 |
diff --git a/pcs/lib/commands/test/test_ticket.py b/pcs/lib/commands/test/test_ticket.py
|
|
|
15f218 |
index d8b8a5f..586ca4b 100644
|
|
|
15f218 |
--- a/pcs/lib/commands/test/test_ticket.py
|
|
|
15f218 |
+++ b/pcs/lib/commands/test/test_ticket.py
|
|
|
15f218 |
@@ -5,7 +5,7 @@ from __future__ import (
|
|
|
15f218 |
unicode_literals,
|
|
|
15f218 |
)
|
|
|
15f218 |
|
|
|
15f218 |
-from unittest import TestCase
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import TestCase
|
|
|
15f218 |
|
|
|
15f218 |
from pcs.common import report_codes
|
|
|
15f218 |
from pcs.lib.commands.constraint import ticket as ticket_command
|
|
|
15f218 |
diff --git a/pcs/lib/test/misc.py b/pcs/lib/test/misc.py
|
|
|
15f218 |
index 1b1670a..be99bb2 100644
|
|
|
15f218 |
--- a/pcs/lib/test/misc.py
|
|
|
15f218 |
+++ b/pcs/lib/test/misc.py
|
|
|
15f218 |
@@ -9,7 +9,7 @@ import logging
|
|
|
15f218 |
|
|
|
15f218 |
from pcs.lib.env import LibraryEnvironment as Env
|
|
|
15f218 |
from pcs.test.tools.custom_mock import MockLibraryReportProcessor
|
|
|
15f218 |
-from pcs.test.tools.pcs_mock import mock
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import mock
|
|
|
15f218 |
|
|
|
15f218 |
|
|
|
15f218 |
def get_mocked_env(**kwargs):
|
|
|
15f218 |
diff --git a/pcs/lib/test/test_env_file.py b/pcs/lib/test/test_env_file.py
|
|
|
15f218 |
index 3e27af1..754b40e 100644
|
|
|
15f218 |
--- a/pcs/lib/test/test_env_file.py
|
|
|
15f218 |
+++ b/pcs/lib/test/test_env_file.py
|
|
|
15f218 |
@@ -5,7 +5,7 @@ from __future__ import (
|
|
|
15f218 |
unicode_literals,
|
|
|
15f218 |
)
|
|
|
15f218 |
|
|
|
15f218 |
-from unittest import TestCase
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import TestCase
|
|
|
15f218 |
|
|
|
15f218 |
from pcs.common import report_codes
|
|
|
15f218 |
from pcs.lib.env_file import RealFile, GhostFile
|
|
|
15f218 |
@@ -15,7 +15,7 @@ from pcs.test.tools.assertions import(
|
|
|
15f218 |
assert_report_item_list_equal
|
|
|
15f218 |
)
|
|
|
15f218 |
from pcs.test.tools.custom_mock import MockLibraryReportProcessor
|
|
|
15f218 |
-from pcs.test.tools.pcs_mock import mock
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import mock
|
|
|
15f218 |
|
|
|
15f218 |
|
|
|
15f218 |
class GhostFileReadTest(TestCase):
|
|
|
15f218 |
diff --git a/pcs/lib/test/test_errors.py b/pcs/lib/test/test_errors.py
|
|
|
15f218 |
index 2e99e19..871aa76 100644
|
|
|
15f218 |
--- a/pcs/lib/test/test_errors.py
|
|
|
15f218 |
+++ b/pcs/lib/test/test_errors.py
|
|
|
15f218 |
@@ -5,7 +5,7 @@ from __future__ import (
|
|
|
15f218 |
unicode_literals,
|
|
|
15f218 |
)
|
|
|
15f218 |
|
|
|
15f218 |
-from unittest import TestCase
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import TestCase
|
|
|
15f218 |
|
|
|
15f218 |
from pcs.lib.errors import LibraryEnvError
|
|
|
15f218 |
|
|
|
15f218 |
diff --git a/pcs/lib/test/test_pacemaker_values.py b/pcs/lib/test/test_pacemaker_values.py
|
|
|
15f218 |
index 7979990..62b8e91 100644
|
|
|
15f218 |
--- a/pcs/lib/test/test_pacemaker_values.py
|
|
|
15f218 |
+++ b/pcs/lib/test/test_pacemaker_values.py
|
|
|
15f218 |
@@ -5,7 +5,7 @@ from __future__ import (
|
|
|
15f218 |
unicode_literals,
|
|
|
15f218 |
)
|
|
|
15f218 |
|
|
|
15f218 |
-from unittest import TestCase
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import TestCase
|
|
|
15f218 |
|
|
|
15f218 |
from pcs.test.tools.assertions import assert_raise_library_error
|
|
|
15f218 |
|
|
|
15f218 |
diff --git a/pcs/test/test_acl.py b/pcs/test/test_acl.py
|
|
|
15f218 |
index b053614..186c035 100644
|
|
|
15f218 |
--- a/pcs/test/test_acl.py
|
|
|
15f218 |
+++ b/pcs/test/test_acl.py
|
|
|
15f218 |
@@ -6,7 +6,7 @@ from __future__ import (
|
|
|
15f218 |
)
|
|
|
15f218 |
|
|
|
15f218 |
import shutil
|
|
|
15f218 |
-import unittest
|
|
|
15f218 |
+from pcs.test.tools import pcs_unittest as unittest
|
|
|
15f218 |
|
|
|
15f218 |
from pcs.test.tools.assertions import AssertPcsMixin
|
|
|
15f218 |
from pcs.test.tools.misc import (
|
|
|
15f218 |
diff --git a/pcs/test/test_cluster.py b/pcs/test/test_cluster.py
|
|
|
15f218 |
index 8a245a2..36f3687 100644
|
|
|
15f218 |
--- a/pcs/test/test_cluster.py
|
|
|
15f218 |
+++ b/pcs/test/test_cluster.py
|
|
|
15f218 |
@@ -7,7 +7,7 @@ from __future__ import (
|
|
|
15f218 |
|
|
|
15f218 |
import os
|
|
|
15f218 |
import shutil
|
|
|
15f218 |
-import unittest
|
|
|
15f218 |
+from pcs.test.tools import pcs_unittest as unittest
|
|
|
15f218 |
|
|
|
15f218 |
from pcs.test.tools.assertions import AssertPcsMixin
|
|
|
15f218 |
from pcs.test.tools.misc import (
|
|
|
15f218 |
diff --git a/pcs/test/test_common_tools.py b/pcs/test/test_common_tools.py
|
|
|
15f218 |
index 5c8482e..5290e6d 100644
|
|
|
15f218 |
--- a/pcs/test/test_common_tools.py
|
|
|
15f218 |
+++ b/pcs/test/test_common_tools.py
|
|
|
15f218 |
@@ -5,7 +5,7 @@ from __future__ import (
|
|
|
15f218 |
unicode_literals,
|
|
|
15f218 |
)
|
|
|
15f218 |
|
|
|
15f218 |
-from unittest import TestCase
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import TestCase
|
|
|
15f218 |
import time
|
|
|
15f218 |
|
|
|
15f218 |
from pcs.common import tools
|
|
|
15f218 |
diff --git a/pcs/test/test_constraints.py b/pcs/test/test_constraints.py
|
|
|
15f218 |
index 364b40d..7c76e09 100644
|
|
|
15f218 |
--- a/pcs/test/test_constraints.py
|
|
|
15f218 |
+++ b/pcs/test/test_constraints.py
|
|
|
15f218 |
@@ -7,7 +7,7 @@ from __future__ import (
|
|
|
15f218 |
|
|
|
15f218 |
import os
|
|
|
15f218 |
import shutil
|
|
|
15f218 |
-import unittest
|
|
|
15f218 |
+from pcs.test.tools import pcs_unittest as unittest
|
|
|
15f218 |
|
|
|
15f218 |
from pcs.test.tools.assertions import AssertPcsMixin, console_report
|
|
|
15f218 |
from pcs.test.tools.misc import (
|
|
|
15f218 |
diff --git a/pcs/test/test_lib_cib_acl.py b/pcs/test/test_lib_cib_acl.py
|
|
|
15f218 |
index 7e1750e..efaad7e 100644
|
|
|
15f218 |
--- a/pcs/test/test_lib_cib_acl.py
|
|
|
15f218 |
+++ b/pcs/test/test_lib_cib_acl.py
|
|
|
15f218 |
@@ -5,7 +5,7 @@ from __future__ import (
|
|
|
15f218 |
unicode_literals,
|
|
|
15f218 |
)
|
|
|
15f218 |
|
|
|
15f218 |
-from unittest import TestCase
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import TestCase
|
|
|
15f218 |
|
|
|
15f218 |
from pcs.test.tools.assertions import (
|
|
|
15f218 |
assert_raise_library_error,
|
|
|
15f218 |
diff --git a/pcs/test/test_lib_cib_tools.py b/pcs/test/test_lib_cib_tools.py
|
|
|
15f218 |
index 0fd4d22..ffc2642 100644
|
|
|
15f218 |
--- a/pcs/test/test_lib_cib_tools.py
|
|
|
15f218 |
+++ b/pcs/test/test_lib_cib_tools.py
|
|
|
15f218 |
@@ -5,7 +5,7 @@ from __future__ import (
|
|
|
15f218 |
unicode_literals,
|
|
|
15f218 |
)
|
|
|
15f218 |
|
|
|
15f218 |
-from unittest import TestCase
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import TestCase
|
|
|
15f218 |
|
|
|
15f218 |
from os.path import join
|
|
|
15f218 |
from lxml import etree
|
|
|
15f218 |
@@ -15,7 +15,7 @@ from pcs.test.tools.assertions import (
|
|
|
15f218 |
assert_xml_equal,
|
|
|
15f218 |
)
|
|
|
15f218 |
from pcs.test.tools.misc import get_test_resource as rc
|
|
|
15f218 |
-from pcs.test.tools.pcs_mock import mock
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import mock
|
|
|
15f218 |
from pcs.test.tools.xml import get_xml_manipulation_creator_from_file
|
|
|
15f218 |
|
|
|
15f218 |
from pcs import settings
|
|
|
15f218 |
diff --git a/pcs/test/test_lib_commands_qdevice.py b/pcs/test/test_lib_commands_qdevice.py
|
|
|
15f218 |
index ff588d5..10841e9 100644
|
|
|
15f218 |
--- a/pcs/test/test_lib_commands_qdevice.py
|
|
|
15f218 |
+++ b/pcs/test/test_lib_commands_qdevice.py
|
|
|
15f218 |
@@ -5,11 +5,11 @@ from __future__ import (
|
|
|
15f218 |
unicode_literals,
|
|
|
15f218 |
)
|
|
|
15f218 |
|
|
|
15f218 |
-from unittest import TestCase
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import TestCase
|
|
|
15f218 |
import base64
|
|
|
15f218 |
import logging
|
|
|
15f218 |
|
|
|
15f218 |
-from pcs.test.tools.pcs_mock import mock
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import mock
|
|
|
15f218 |
from pcs.test.tools.assertions import (
|
|
|
15f218 |
assert_raise_library_error,
|
|
|
15f218 |
assert_report_item_list_equal,
|
|
|
15f218 |
diff --git a/pcs/test/test_lib_commands_quorum.py b/pcs/test/test_lib_commands_quorum.py
|
|
|
15f218 |
index d286a8f..d7701af 100644
|
|
|
15f218 |
--- a/pcs/test/test_lib_commands_quorum.py
|
|
|
15f218 |
+++ b/pcs/test/test_lib_commands_quorum.py
|
|
|
15f218 |
@@ -6,7 +6,7 @@ from __future__ import (
|
|
|
15f218 |
)
|
|
|
15f218 |
|
|
|
15f218 |
import logging
|
|
|
15f218 |
-from unittest import TestCase
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import TestCase
|
|
|
15f218 |
|
|
|
15f218 |
from pcs.test.tools.assertions import (
|
|
|
15f218 |
assert_raise_library_error,
|
|
|
15f218 |
@@ -17,7 +17,7 @@ from pcs.test.tools.misc import (
|
|
|
15f218 |
ac,
|
|
|
15f218 |
get_test_resource as rc,
|
|
|
15f218 |
)
|
|
|
15f218 |
-from pcs.test.tools.pcs_mock import mock
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import mock
|
|
|
15f218 |
|
|
|
15f218 |
from pcs.common import report_codes
|
|
|
15f218 |
from pcs.lib.env import LibraryEnvironment
|
|
|
15f218 |
diff --git a/pcs/test/test_lib_commands_sbd.py b/pcs/test/test_lib_commands_sbd.py
|
|
|
15f218 |
index 0663082..f8146ce 100644
|
|
|
15f218 |
--- a/pcs/test/test_lib_commands_sbd.py
|
|
|
15f218 |
+++ b/pcs/test/test_lib_commands_sbd.py
|
|
|
15f218 |
@@ -7,9 +7,9 @@ from __future__ import (
|
|
|
15f218 |
|
|
|
15f218 |
import logging
|
|
|
15f218 |
|
|
|
15f218 |
-from unittest import TestCase
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import TestCase
|
|
|
15f218 |
|
|
|
15f218 |
-from pcs.test.tools.pcs_mock import mock
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import mock
|
|
|
15f218 |
from pcs.test.tools.assertions import (
|
|
|
15f218 |
assert_raise_library_error,
|
|
|
15f218 |
assert_report_item_list_equal,
|
|
|
15f218 |
diff --git a/pcs/test/test_lib_corosync_config_facade.py b/pcs/test/test_lib_corosync_config_facade.py
|
|
|
15f218 |
index 91f7b40..4373d65 100644
|
|
|
15f218 |
--- a/pcs/test/test_lib_corosync_config_facade.py
|
|
|
15f218 |
+++ b/pcs/test/test_lib_corosync_config_facade.py
|
|
|
15f218 |
@@ -5,7 +5,7 @@ from __future__ import (
|
|
|
15f218 |
unicode_literals,
|
|
|
15f218 |
)
|
|
|
15f218 |
|
|
|
15f218 |
-from unittest import TestCase
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import TestCase
|
|
|
15f218 |
import re
|
|
|
15f218 |
|
|
|
15f218 |
from pcs.test.tools.assertions import (
|
|
|
15f218 |
diff --git a/pcs/test/test_lib_corosync_config_parser.py b/pcs/test/test_lib_corosync_config_parser.py
|
|
|
15f218 |
index da20889..a68710b 100644
|
|
|
15f218 |
--- a/pcs/test/test_lib_corosync_config_parser.py
|
|
|
15f218 |
+++ b/pcs/test/test_lib_corosync_config_parser.py
|
|
|
15f218 |
@@ -5,7 +5,7 @@ from __future__ import (
|
|
|
15f218 |
unicode_literals,
|
|
|
15f218 |
)
|
|
|
15f218 |
|
|
|
15f218 |
-import unittest
|
|
|
15f218 |
+from pcs.test.tools import pcs_unittest as unittest
|
|
|
15f218 |
|
|
|
15f218 |
from pcs.test.tools.misc import ac
|
|
|
15f218 |
|
|
|
15f218 |
diff --git a/pcs/test/test_lib_corosync_live.py b/pcs/test/test_lib_corosync_live.py
|
|
|
15f218 |
index 0fc5eb2..3173195 100644
|
|
|
15f218 |
--- a/pcs/test/test_lib_corosync_live.py
|
|
|
15f218 |
+++ b/pcs/test/test_lib_corosync_live.py
|
|
|
15f218 |
@@ -5,13 +5,13 @@ from __future__ import (
|
|
|
15f218 |
unicode_literals,
|
|
|
15f218 |
)
|
|
|
15f218 |
|
|
|
15f218 |
-from unittest import TestCase
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import TestCase
|
|
|
15f218 |
|
|
|
15f218 |
import os.path
|
|
|
15f218 |
|
|
|
15f218 |
from pcs.test.tools.assertions import assert_raise_library_error
|
|
|
15f218 |
from pcs.test.tools.misc import get_test_resource as rc
|
|
|
15f218 |
-from pcs.test.tools.pcs_mock import mock
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import mock
|
|
|
15f218 |
|
|
|
15f218 |
from pcs import settings
|
|
|
15f218 |
from pcs.common import report_codes
|
|
|
15f218 |
diff --git a/pcs/test/test_lib_corosync_qdevice_client.py b/pcs/test/test_lib_corosync_qdevice_client.py
|
|
|
15f218 |
index e0332f1..0b5bd67 100644
|
|
|
15f218 |
--- a/pcs/test/test_lib_corosync_qdevice_client.py
|
|
|
15f218 |
+++ b/pcs/test/test_lib_corosync_qdevice_client.py
|
|
|
15f218 |
@@ -5,9 +5,9 @@ from __future__ import (
|
|
|
15f218 |
unicode_literals,
|
|
|
15f218 |
)
|
|
|
15f218 |
|
|
|
15f218 |
-from unittest import TestCase
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import TestCase
|
|
|
15f218 |
|
|
|
15f218 |
-from pcs.test.tools.pcs_mock import mock
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import mock
|
|
|
15f218 |
from pcs.test.tools.assertions import assert_raise_library_error
|
|
|
15f218 |
|
|
|
15f218 |
from pcs.common import report_codes
|
|
|
15f218 |
diff --git a/pcs/test/test_lib_corosync_qdevice_net.py b/pcs/test/test_lib_corosync_qdevice_net.py
|
|
|
15f218 |
index 3d473f7..340a8dc 100644
|
|
|
15f218 |
--- a/pcs/test/test_lib_corosync_qdevice_net.py
|
|
|
15f218 |
+++ b/pcs/test/test_lib_corosync_qdevice_net.py
|
|
|
15f218 |
@@ -5,12 +5,12 @@ from __future__ import (
|
|
|
15f218 |
unicode_literals,
|
|
|
15f218 |
)
|
|
|
15f218 |
|
|
|
15f218 |
-from unittest import TestCase
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import TestCase
|
|
|
15f218 |
|
|
|
15f218 |
import base64
|
|
|
15f218 |
import os.path
|
|
|
15f218 |
|
|
|
15f218 |
-from pcs.test.tools.pcs_mock import mock
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import mock
|
|
|
15f218 |
from pcs.test.tools.assertions import assert_raise_library_error
|
|
|
15f218 |
from pcs.test.tools.misc import get_test_resource
|
|
|
15f218 |
|
|
|
15f218 |
diff --git a/pcs/test/test_lib_env.py b/pcs/test/test_lib_env.py
|
|
|
15f218 |
index c6322b7..205fd60 100644
|
|
|
15f218 |
--- a/pcs/test/test_lib_env.py
|
|
|
15f218 |
+++ b/pcs/test/test_lib_env.py
|
|
|
15f218 |
@@ -5,7 +5,7 @@ from __future__ import (
|
|
|
15f218 |
unicode_literals,
|
|
|
15f218 |
)
|
|
|
15f218 |
|
|
|
15f218 |
-from unittest import TestCase
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import TestCase
|
|
|
15f218 |
import logging
|
|
|
15f218 |
from lxml import etree
|
|
|
15f218 |
|
|
|
15f218 |
@@ -16,7 +16,7 @@ from pcs.test.tools.assertions import (
|
|
|
15f218 |
)
|
|
|
15f218 |
from pcs.test.tools.custom_mock import MockLibraryReportProcessor
|
|
|
15f218 |
from pcs.test.tools.misc import get_test_resource as rc
|
|
|
15f218 |
-from pcs.test.tools.pcs_mock import mock
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import mock
|
|
|
15f218 |
|
|
|
15f218 |
from pcs.lib.env import LibraryEnvironment
|
|
|
15f218 |
from pcs.common import report_codes
|
|
|
15f218 |
diff --git a/pcs/test/test_lib_external.py b/pcs/test/test_lib_external.py
|
|
|
15f218 |
index b0ffdbb..aafbe85 100644
|
|
|
15f218 |
--- a/pcs/test/test_lib_external.py
|
|
|
15f218 |
+++ b/pcs/test/test_lib_external.py
|
|
|
15f218 |
@@ -5,7 +5,7 @@ from __future__ import (
|
|
|
15f218 |
unicode_literals,
|
|
|
15f218 |
)
|
|
|
15f218 |
|
|
|
15f218 |
-from unittest import TestCase
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import TestCase
|
|
|
15f218 |
import os.path
|
|
|
15f218 |
import logging
|
|
|
15f218 |
try:
|
|
|
15f218 |
@@ -27,7 +27,7 @@ from pcs.test.tools.assertions import (
|
|
|
15f218 |
assert_report_item_list_equal,
|
|
|
15f218 |
)
|
|
|
15f218 |
from pcs.test.tools.custom_mock import MockLibraryReportProcessor
|
|
|
15f218 |
-from pcs.test.tools.pcs_mock import mock
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import mock
|
|
|
15f218 |
|
|
|
15f218 |
from pcs import settings
|
|
|
15f218 |
from pcs.common import report_codes
|
|
|
15f218 |
diff --git a/pcs/test/test_lib_node.py b/pcs/test/test_lib_node.py
|
|
|
15f218 |
index 6c841d3..caf128f 100644
|
|
|
15f218 |
--- a/pcs/test/test_lib_node.py
|
|
|
15f218 |
+++ b/pcs/test/test_lib_node.py
|
|
|
15f218 |
@@ -5,7 +5,7 @@ from __future__ import (
|
|
|
15f218 |
unicode_literals,
|
|
|
15f218 |
)
|
|
|
15f218 |
|
|
|
15f218 |
-from unittest import TestCase
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import TestCase
|
|
|
15f218 |
|
|
|
15f218 |
import pcs.lib.node as lib
|
|
|
15f218 |
|
|
|
15f218 |
diff --git a/pcs/test/test_lib_nodes_task.py b/pcs/test/test_lib_nodes_task.py
|
|
|
15f218 |
index cff88eb..6f05b15 100644
|
|
|
15f218 |
--- a/pcs/test/test_lib_nodes_task.py
|
|
|
15f218 |
+++ b/pcs/test/test_lib_nodes_task.py
|
|
|
15f218 |
@@ -5,14 +5,14 @@ from __future__ import (
|
|
|
15f218 |
unicode_literals,
|
|
|
15f218 |
)
|
|
|
15f218 |
|
|
|
15f218 |
-from unittest import TestCase
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import TestCase
|
|
|
15f218 |
|
|
|
15f218 |
from pcs.test.tools.assertions import (
|
|
|
15f218 |
assert_raise_library_error,
|
|
|
15f218 |
assert_report_item_list_equal,
|
|
|
15f218 |
)
|
|
|
15f218 |
from pcs.test.tools.custom_mock import MockLibraryReportProcessor
|
|
|
15f218 |
-from pcs.test.tools.pcs_mock import mock
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import mock
|
|
|
15f218 |
|
|
|
15f218 |
from pcs.common import report_codes
|
|
|
15f218 |
from pcs.lib.external import NodeCommunicator, NodeAuthenticationException
|
|
|
15f218 |
diff --git a/pcs/test/test_lib_pacemaker.py b/pcs/test/test_lib_pacemaker.py
|
|
|
15f218 |
index 0edee5c..c475db6 100644
|
|
|
15f218 |
--- a/pcs/test/test_lib_pacemaker.py
|
|
|
15f218 |
+++ b/pcs/test/test_lib_pacemaker.py
|
|
|
15f218 |
@@ -5,7 +5,7 @@ from __future__ import (
|
|
|
15f218 |
unicode_literals,
|
|
|
15f218 |
)
|
|
|
15f218 |
|
|
|
15f218 |
-from unittest import TestCase
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import TestCase
|
|
|
15f218 |
import os.path
|
|
|
15f218 |
|
|
|
15f218 |
from pcs.test.tools.assertions import (
|
|
|
15f218 |
@@ -13,7 +13,7 @@ from pcs.test.tools.assertions import (
|
|
|
15f218 |
assert_xml_equal,
|
|
|
15f218 |
)
|
|
|
15f218 |
from pcs.test.tools.misc import get_test_resource as rc
|
|
|
15f218 |
-from pcs.test.tools.pcs_mock import mock
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import mock
|
|
|
15f218 |
from pcs.test.tools.xml import XmlManipulation
|
|
|
15f218 |
|
|
|
15f218 |
from pcs import settings
|
|
|
15f218 |
diff --git a/pcs/test/test_lib_pacemaker_state.py b/pcs/test/test_lib_pacemaker_state.py
|
|
|
15f218 |
index 54f536d..13f6eb0 100644
|
|
|
15f218 |
--- a/pcs/test/test_lib_pacemaker_state.py
|
|
|
15f218 |
+++ b/pcs/test/test_lib_pacemaker_state.py
|
|
|
15f218 |
@@ -5,7 +5,7 @@ from __future__ import (
|
|
|
15f218 |
unicode_literals,
|
|
|
15f218 |
)
|
|
|
15f218 |
|
|
|
15f218 |
-from unittest import TestCase
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import TestCase
|
|
|
15f218 |
from lxml import etree
|
|
|
15f218 |
|
|
|
15f218 |
from pcs.test.tools.assertions import assert_raise_library_error
|
|
|
15f218 |
diff --git a/pcs/test/test_lib_resource_agent.py b/pcs/test/test_lib_resource_agent.py
|
|
|
15f218 |
index 5704184..08f9061 100644
|
|
|
15f218 |
--- a/pcs/test/test_lib_resource_agent.py
|
|
|
15f218 |
+++ b/pcs/test/test_lib_resource_agent.py
|
|
|
15f218 |
@@ -5,7 +5,7 @@ from __future__ import (
|
|
|
15f218 |
unicode_literals,
|
|
|
15f218 |
)
|
|
|
15f218 |
|
|
|
15f218 |
-from unittest import TestCase
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import TestCase
|
|
|
15f218 |
import os.path
|
|
|
15f218 |
|
|
|
15f218 |
from lxml import etree
|
|
|
15f218 |
@@ -14,7 +14,7 @@ from pcs.test.tools.assertions import (
|
|
|
15f218 |
ExtendedAssertionsMixin,
|
|
|
15f218 |
assert_xml_equal,
|
|
|
15f218 |
)
|
|
|
15f218 |
-from pcs.test.tools.pcs_mock import mock
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import mock
|
|
|
15f218 |
from pcs.test.tools.xml import XmlManipulation as XmlMan
|
|
|
15f218 |
|
|
|
15f218 |
|
|
|
15f218 |
diff --git a/pcs/test/test_lib_sbd.py b/pcs/test/test_lib_sbd.py
|
|
|
15f218 |
index 516e0bd..720d8b1 100644
|
|
|
15f218 |
--- a/pcs/test/test_lib_sbd.py
|
|
|
15f218 |
+++ b/pcs/test/test_lib_sbd.py
|
|
|
15f218 |
@@ -6,9 +6,9 @@ from __future__ import (
|
|
|
15f218 |
)
|
|
|
15f218 |
|
|
|
15f218 |
import json
|
|
|
15f218 |
-from unittest import TestCase
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import TestCase
|
|
|
15f218 |
|
|
|
15f218 |
-from pcs.test.tools.pcs_mock import mock
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import mock
|
|
|
15f218 |
from pcs.test.tools.assertions import (
|
|
|
15f218 |
assert_raise_library_error,
|
|
|
15f218 |
assert_report_item_list_equal,
|
|
|
15f218 |
diff --git a/pcs/test/test_lib_tools.py b/pcs/test/test_lib_tools.py
|
|
|
15f218 |
index 5141ca9..606cb05 100644
|
|
|
15f218 |
--- a/pcs/test/test_lib_tools.py
|
|
|
15f218 |
+++ b/pcs/test/test_lib_tools.py
|
|
|
15f218 |
@@ -5,7 +5,7 @@ from __future__ import (
|
|
|
15f218 |
unicode_literals,
|
|
|
15f218 |
)
|
|
|
15f218 |
|
|
|
15f218 |
-from unittest import TestCase
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import TestCase
|
|
|
15f218 |
|
|
|
15f218 |
from pcs.lib import tools
|
|
|
15f218 |
|
|
|
15f218 |
diff --git a/pcs/test/test_node.py b/pcs/test/test_node.py
|
|
|
15f218 |
index 785c711..9b45e07 100644
|
|
|
15f218 |
--- a/pcs/test/test_node.py
|
|
|
15f218 |
+++ b/pcs/test/test_node.py
|
|
|
15f218 |
@@ -6,7 +6,7 @@ from __future__ import (
|
|
|
15f218 |
)
|
|
|
15f218 |
|
|
|
15f218 |
import shutil
|
|
|
15f218 |
-import unittest
|
|
|
15f218 |
+from pcs.test.tools import pcs_unittest as unittest
|
|
|
15f218 |
|
|
|
15f218 |
from pcs.test.tools.assertions import AssertPcsMixin
|
|
|
15f218 |
from pcs.test.tools.misc import (
|
|
|
15f218 |
diff --git a/pcs/test/test_properties.py b/pcs/test/test_properties.py
|
|
|
15f218 |
index fbaf880..9634cca 100644
|
|
|
15f218 |
--- a/pcs/test/test_properties.py
|
|
|
15f218 |
+++ b/pcs/test/test_properties.py
|
|
|
15f218 |
@@ -6,7 +6,7 @@ from __future__ import (
|
|
|
15f218 |
)
|
|
|
15f218 |
|
|
|
15f218 |
import shutil
|
|
|
15f218 |
-import unittest
|
|
|
15f218 |
+from pcs.test.tools import pcs_unittest as unittest
|
|
|
15f218 |
|
|
|
15f218 |
from pcs.test.tools.assertions import AssertPcsMixin
|
|
|
15f218 |
from pcs.test.tools.misc import (
|
|
|
15f218 |
diff --git a/pcs/test/test_quorum.py b/pcs/test/test_quorum.py
|
|
|
15f218 |
index 86de4c6..4f15d7f 100644
|
|
|
15f218 |
--- a/pcs/test/test_quorum.py
|
|
|
15f218 |
+++ b/pcs/test/test_quorum.py
|
|
|
15f218 |
@@ -6,7 +6,7 @@ from __future__ import (
|
|
|
15f218 |
)
|
|
|
15f218 |
|
|
|
15f218 |
import shutil
|
|
|
15f218 |
-from unittest import TestCase
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import TestCase
|
|
|
15f218 |
|
|
|
15f218 |
from pcs.test.tools.assertions import AssertPcsMixin
|
|
|
15f218 |
from pcs.test.tools.misc import (
|
|
|
15f218 |
diff --git a/pcs/test/test_resource.py b/pcs/test/test_resource.py
|
|
|
15f218 |
index 614b895..87a7fa8 100644
|
|
|
15f218 |
--- a/pcs/test/test_resource.py
|
|
|
15f218 |
+++ b/pcs/test/test_resource.py
|
|
|
15f218 |
@@ -8,7 +8,7 @@ from __future__ import (
|
|
|
15f218 |
import os
|
|
|
15f218 |
import shutil
|
|
|
15f218 |
import re
|
|
|
15f218 |
-import unittest
|
|
|
15f218 |
+from pcs.test.tools import pcs_unittest as unittest
|
|
|
15f218 |
|
|
|
15f218 |
from pcs.test.tools.assertions import AssertPcsMixin
|
|
|
15f218 |
from pcs.test.tools.misc import (
|
|
|
15f218 |
diff --git a/pcs/test/test_rule.py b/pcs/test/test_rule.py
|
|
|
15f218 |
index 8cf717a..ad3448d 100644
|
|
|
15f218 |
--- a/pcs/test/test_rule.py
|
|
|
15f218 |
+++ b/pcs/test/test_rule.py
|
|
|
15f218 |
@@ -6,7 +6,7 @@ from __future__ import (
|
|
|
15f218 |
)
|
|
|
15f218 |
|
|
|
15f218 |
import shutil
|
|
|
15f218 |
-import unittest
|
|
|
15f218 |
+from pcs.test.tools import pcs_unittest as unittest
|
|
|
15f218 |
import xml.dom.minidom
|
|
|
15f218 |
|
|
|
15f218 |
from pcs import rule
|
|
|
15f218 |
diff --git a/pcs/test/test_stonith.py b/pcs/test/test_stonith.py
|
|
|
15f218 |
index a6ee2f5..82b2c84 100644
|
|
|
15f218 |
--- a/pcs/test/test_stonith.py
|
|
|
15f218 |
+++ b/pcs/test/test_stonith.py
|
|
|
15f218 |
@@ -6,7 +6,7 @@ from __future__ import (
|
|
|
15f218 |
)
|
|
|
15f218 |
|
|
|
15f218 |
import shutil
|
|
|
15f218 |
-import unittest
|
|
|
15f218 |
+from pcs.test.tools import pcs_unittest as unittest
|
|
|
15f218 |
|
|
|
15f218 |
from pcs.test.tools.misc import (
|
|
|
15f218 |
ac,
|
|
|
15f218 |
diff --git a/pcs/test/test_utils.py b/pcs/test/test_utils.py
|
|
|
15f218 |
index 43145fd..252de30 100644
|
|
|
15f218 |
--- a/pcs/test/test_utils.py
|
|
|
15f218 |
+++ b/pcs/test/test_utils.py
|
|
|
15f218 |
@@ -6,7 +6,7 @@ from __future__ import (
|
|
|
15f218 |
)
|
|
|
15f218 |
|
|
|
15f218 |
import sys
|
|
|
15f218 |
-import unittest
|
|
|
15f218 |
+from pcs.test.tools import pcs_unittest as unittest
|
|
|
15f218 |
import xml.dom.minidom
|
|
|
15f218 |
import xml.etree.cElementTree as ET
|
|
|
15f218 |
from time import sleep
|
|
|
15f218 |
diff --git a/pcs/test/tools/misc.py b/pcs/test/tools/misc.py
|
|
|
15f218 |
index a78ccdc..745b228 100644
|
|
|
15f218 |
--- a/pcs/test/tools/misc.py
|
|
|
15f218 |
+++ b/pcs/test/tools/misc.py
|
|
|
15f218 |
@@ -10,6 +10,7 @@ import os.path
|
|
|
15f218 |
import re
|
|
|
15f218 |
|
|
|
15f218 |
from pcs import utils
|
|
|
15f218 |
+from pcs.test.tools.pcs_unittest import mock
|
|
|
15f218 |
|
|
|
15f218 |
|
|
|
15f218 |
testdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
|
15f218 |
@@ -50,3 +51,16 @@ def is_minimum_pacemaker_version(cmajor, cminor, crev):
|
|
|
15f218 |
or
|
|
|
15f218 |
(major == cmajor and minor == cminor and rev >= crev)
|
|
|
15f218 |
)
|
|
|
15f218 |
+
|
|
|
15f218 |
+def create_patcher(target_prefix):
|
|
|
15f218 |
+ """
|
|
|
15f218 |
+ Return function for patching tests with preconfigured target prefix
|
|
|
15f218 |
+ string target_prefix is prefix for patched names. Typicaly tested module
|
|
|
15f218 |
+ like for example "pcs.lib.commands.booth". Between target_prefix and target
|
|
|
15f218 |
+ is "." (dot)
|
|
|
15f218 |
+ """
|
|
|
15f218 |
+ def patch(target, *args, **kwargs):
|
|
|
15f218 |
+ return mock.patch(
|
|
|
15f218 |
+ "{0}.{1}".format(target_prefix, target), *args, **kwargs
|
|
|
15f218 |
+ )
|
|
|
15f218 |
+ return patch
|
|
|
15f218 |
diff --git a/pcs/test/tools/pcs_mock.py b/pcs/test/tools/pcs_mock.py
|
|
|
15f218 |
deleted file mode 100644
|
|
|
15f218 |
index d84ac67..0000000
|
|
|
15f218 |
--- a/pcs/test/tools/pcs_mock.py
|
|
|
15f218 |
+++ /dev/null
|
|
|
15f218 |
@@ -1,13 +0,0 @@
|
|
|
15f218 |
-try:
|
|
|
15f218 |
- import unittest.mock as mock
|
|
|
15f218 |
-except ImportError:
|
|
|
15f218 |
- import mock
|
|
|
15f218 |
-
|
|
|
15f218 |
-if not hasattr(mock.Mock, "assert_not_called"):
|
|
|
15f218 |
- def __assert_not_called(self, *args, **kwargs):
|
|
|
15f218 |
- if self.call_count != 0:
|
|
|
15f218 |
- msg = ("Expected '%s' to not have been called. Called %s times." %
|
|
|
15f218 |
- (self._mock_name or 'mock', self.call_count))
|
|
|
15f218 |
- raise AssertionError(msg)
|
|
|
15f218 |
- mock.Mock.assert_not_called = __assert_not_called
|
|
|
15f218 |
-
|
|
|
15f218 |
diff --git a/pcs/test/tools/pcs_unittest.py b/pcs/test/tools/pcs_unittest.py
|
|
|
15f218 |
index 4a3205d..af549ae 100644
|
|
|
15f218 |
--- a/pcs/test/tools/pcs_unittest.py
|
|
|
15f218 |
+++ b/pcs/test/tools/pcs_unittest.py
|
|
|
15f218 |
@@ -1,7 +1,26 @@
|
|
|
15f218 |
import sys
|
|
|
15f218 |
+#In package unittest there is no module mock before python 3.3. In python 3
|
|
|
15f218 |
+#module mock is not imported by * because module mock is not imported in
|
|
|
15f218 |
+#unittest/__init__.py
|
|
|
15f218 |
major, minor = sys.version_info[:2]
|
|
|
15f218 |
if major == 2 and minor == 6:
|
|
|
15f218 |
+ #we use features that are missing before 2.7 (like test skipping,
|
|
|
15f218 |
+ #assertRaises as context manager...) so we need unittest2
|
|
|
15f218 |
from unittest2 import *
|
|
|
15f218 |
+ import mock
|
|
|
15f218 |
else:
|
|
|
15f218 |
from unittest import *
|
|
|
15f218 |
+ try:
|
|
|
15f218 |
+ import unittest.mock as mock
|
|
|
15f218 |
+ except ImportError:
|
|
|
15f218 |
+ import mock
|
|
|
15f218 |
del major, minor, sys
|
|
|
15f218 |
+
|
|
|
15f218 |
+#backport of assert_not_called (new in version 3.5)
|
|
|
15f218 |
+if not hasattr(mock.Mock, "assert_not_called"):
|
|
|
15f218 |
+ def __assert_not_called(self, *args, **kwargs):
|
|
|
15f218 |
+ if self.call_count != 0:
|
|
|
15f218 |
+ msg = ("Expected '%s' to not have been called. Called %s times." %
|
|
|
15f218 |
+ (self._mock_name or 'mock', self.call_count))
|
|
|
15f218 |
+ raise AssertionError(msg)
|
|
|
15f218 |
+ mock.Mock.assert_not_called = __assert_not_called
|
|
|
15f218 |
--
|
|
|
15f218 |
1.8.3.1
|
|
|
15f218 |
|