diff --git a/src/exceptions.py b/src/exceptions.py index fecc9bc1..743b11b4 100644 --- a/src/exceptions.py +++ b/src/exceptions.py @@ -192,7 +192,7 @@ def message(self) -> str: for f, lines in self._files or []: assert type(f) is str - assert type(lines) in [str, bytes] # noqa: E721 + assert type(lines) in [str, bytes] msg.append(u'{}\n----\n{}\n'.format(f, lines)) return six.text_type('\n').join(msg) diff --git a/src/impl/port_manager__generic.py b/src/impl/port_manager__generic.py index 6b587ec1..3d5b1490 100755 --- a/src/impl/port_manager__generic.py +++ b/src/impl/port_manager__generic.py @@ -48,7 +48,7 @@ def reserve_port(self) -> int: t = None for port in sampled_ports: - assert type(port) is int # noqa: E721 + assert type(port) is int assert port not in self._reserved_ports assert port in self._available_ports diff --git a/src/node.py b/src/node.py index e40c4385..cdf851c3 100644 --- a/src/node.py +++ b/src/node.py @@ -2244,7 +2244,7 @@ def _table_checksum__use_cn( row = cursor.fetchone() assert row is not None - assert type(row) in [list, tuple] # noqa: E721 + assert type(row) in [list, tuple] assert len(row) == 1 v = row[0] sum += int(v if v is not None else 0) diff --git a/tests/conftest.py b/tests/conftest.py index 22841a41..a1adc157 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -82,7 +82,7 @@ class TestStartupData__Helper: # -------------------------------------------------------------------- @staticmethod def GetStartTS() -> datetime.datetime: - assert type(__class__.sm_StartTS) == datetime.datetime # noqa: E721 + assert type(__class__.sm_StartTS) is datetime.datetime return __class__.sm_StartTS # -------------------------------------------------------------------- @@ -113,7 +113,7 @@ def CalcCurrentTestWorkerSignature() -> str: assert type(currentPID) is int startTS = __class__.sm_StartTS - assert type(startTS) == datetime.datetime # noqa: E721 + assert type(startTS) is datetime.datetime result = "pytest-{0:04d}{1:02d}{2:02d}_{3:02d}{4:02d}{5:02d}".format( startTS.year, @@ -405,8 +405,8 @@ def helper__makereport__setup( assert outcome is not None # it may be pytest.Function or _pytest.unittest.TestCaseFunction assert isinstance(item, pytest.Function) - assert type(call) == pytest.CallInfo # noqa: E721 - assert type(outcome) == T_PLUGGY_RESULT # noqa: E721 + assert type(call) is pytest.CallInfo + assert type(outcome) is T_PLUGGY_RESULT C_LINE1 = "******************************************************" @@ -416,7 +416,7 @@ def helper__makereport__setup( rep: pytest.TestReport = outcome.get_result() assert rep is not None - assert type(rep) == pytest.TestReport # noqa: E721 + assert type(rep) is pytest.TestReport if rep.outcome == "skipped": TEST_PROCESS_STATS.incrementNotExecutedTestCount() @@ -474,8 +474,8 @@ def helper__makereport__call( assert outcome is not None # it may be pytest.Function or _pytest.unittest.TestCaseFunction assert isinstance(item, pytest.Function) - assert type(call) == pytest.CallInfo # noqa: E721 - assert type(outcome) == T_PLUGGY_RESULT # noqa: E721 + assert type(call) is pytest.CallInfo + assert type(outcome) is T_PLUGGY_RESULT # -------- item_error_msg_count1 = item.stash.get(g_error_msg_count_key, 0) @@ -496,7 +496,7 @@ def helper__makereport__call( # -------- rep = outcome.get_result() assert rep is not None - assert type(rep) == pytest.TestReport # noqa: E721 + assert type(rep) is pytest.TestReport # -------- testID = helper__build_test_id(item) @@ -505,12 +505,12 @@ def helper__makereport__call( assert call.start <= call.stop startDT = datetime.datetime.fromtimestamp(call.start) - assert type(startDT) == datetime.datetime # noqa: E721 + assert type(startDT) is datetime.datetime stopDT = datetime.datetime.fromtimestamp(call.stop) - assert type(stopDT) == datetime.datetime # noqa: E721 + assert type(stopDT) is datetime.datetime testDurration = stopDT - startDT - assert type(testDurration) == datetime.timedelta # noqa: E721 + assert type(testDurration) is datetime.timedelta # -------- exitStatus = None @@ -519,7 +519,7 @@ def helper__makereport__call( assert call.excinfo is not None # research assert call.excinfo.value is not None # research - if type(call.excinfo.value) == _pytest.outcomes.Skipped: # noqa: E721 + if type(call.excinfo.value) is _pytest.outcomes.Skipped: assert not hasattr(rep, "wasxfail") exitStatus = ExitStatusNames.SKIPPED @@ -528,7 +528,7 @@ def helper__makereport__call( TEST_PROCESS_STATS.incrementSkippedTestCount() - elif type(call.excinfo.value) == _pytest.outcomes.XFailed: # noqa: E721 E501 + elif type(call.excinfo.value) is _pytest.outcomes.XFailed: exitStatus = ExitStatusNames.XFAILED reasonText = str(call.excinfo.value) reasonMsgTempl = "XFAIL REASON: {0}" @@ -544,7 +544,7 @@ def helper__makereport__call( reasonText = rep.wasxfail reasonMsgTempl = "XFAIL REASON: {0}" - if type(call.excinfo.value) == SIGNAL_EXCEPTION: # noqa: E721 + if type(call.excinfo.value) is SIGNAL_EXCEPTION: pass else: logging.error(call.excinfo.value) @@ -563,7 +563,7 @@ def helper__makereport__call( assert call.excinfo is not None assert call.excinfo.value is not None - if type(call.excinfo.value) == SIGNAL_EXCEPTION: # noqa: E721 + if type(call.excinfo.value) is SIGNAL_EXCEPTION: assert item_error_msg_count > 0 pass else: @@ -614,8 +614,8 @@ def helper__makereport__call( pass # -------- - assert type(TEST_PROCESS_STATS.cTotalDuration) == datetime.timedelta # noqa: E721 - assert type(testDurration) == datetime.timedelta # noqa: E721 + assert type(TEST_PROCESS_STATS.cTotalDuration) is datetime.timedelta + assert type(testDurration) is datetime.timedelta TEST_PROCESS_STATS.cTotalDuration += testDurration @@ -656,11 +656,11 @@ def pytest_runtest_makereport(item: pytest.Function, call: pytest.CallInfo): assert call is not None # it may be pytest.Function or _pytest.unittest.TestCaseFunction assert isinstance(item, pytest.Function) - assert type(call) == pytest.CallInfo # noqa: E721 + assert type(call) is pytest.CallInfo outcome = yield assert outcome is not None - assert type(outcome) == T_PLUGGY_RESULT # noqa: E721 + assert type(outcome) is T_PLUGGY_RESULT assert type(call.when) is str @@ -808,7 +808,7 @@ def pytest_pyfunc_call(pyfuncitem: pytest.Function): try: with LogWrapper2() as logWrapper: - assert type(logWrapper) == LogWrapper2 # noqa: E721 + assert type(logWrapper) is LogWrapper2 assert logWrapper._old_method is not None assert type(logWrapper._err_counter) is int assert logWrapper._err_counter == 0 @@ -821,7 +821,7 @@ def pytest_pyfunc_call(pyfuncitem: pytest.Function): r = yield assert r is not None - assert type(r) == T_PLUGGY_RESULT # noqa: E721 + assert type(r) is T_PLUGGY_RESULT assert logWrapper._old_method is not None assert type(logWrapper._err_counter) is int @@ -918,7 +918,7 @@ def helper__print_test_list2(tests: typing.List[T_TUPLE__str_int]) -> None: nTest = 0 for t in tests: - assert type(t) == tuple # noqa: E721 + assert type(t) is tuple assert len(t) == 2 assert type(t[0]) is str assert type(t[1]) is int @@ -943,7 +943,7 @@ def pytest_sessionfinish(): global g_worker_log_is_created # noqa: F824 assert g_test_process_kind is not None - assert type(g_test_process_kind) == T_TEST_PROCESS_KIND # noqa: E721 + assert type(g_test_process_kind) is T_TEST_PROCESS_KIND if g_test_process_kind == T_TEST_PROCESS_KIND.Master: return @@ -951,7 +951,7 @@ def pytest_sessionfinish(): assert g_test_process_kind == T_TEST_PROCESS_KIND.Worker assert g_test_process_mode is not None - assert type(g_test_process_mode) == T_TEST_PROCESS_MODE # noqa: E721 + assert type(g_test_process_mode) is T_TEST_PROCESS_MODE if g_test_process_mode == T_TEST_PROCESS_MODE.Collect: return @@ -1050,7 +1050,7 @@ def LOCAL__print_test_list2( logging.info(" UNEXPECTED : {0}".format(TEST_PROCESS_STATS.cUnexpectedTests)) logging.info("") - assert type(TEST_PROCESS_STATS.cTotalDuration) == datetime.timedelta # noqa: E721 + assert type(TEST_PROCESS_STATS.cTotalDuration) is datetime.timedelta LOCAL__print_line1_with_header("TIME") logging.info("") @@ -1136,8 +1136,8 @@ def pytest_configure(config: pytest.Config) -> None: g_test_process_mode = helper__detect_test_process_mode(config) g_test_process_kind = helper__detect_test_process_kind(config) - assert type(g_test_process_kind) == T_TEST_PROCESS_KIND # noqa: E721 - assert type(g_test_process_mode) == T_TEST_PROCESS_MODE # noqa: E721 + assert type(g_test_process_kind) is T_TEST_PROCESS_KIND + assert type(g_test_process_mode) is T_TEST_PROCESS_MODE if g_test_process_kind == T_TEST_PROCESS_KIND.Master: pass diff --git a/tests/helpers/pg_node_utils.py b/tests/helpers/pg_node_utils.py index 7459595e..05811735 100644 --- a/tests/helpers/pg_node_utils.py +++ b/tests/helpers/pg_node_utils.py @@ -59,7 +59,7 @@ def __str__(self) -> str: def __repr__(self) -> str: # It must be overrided! - assert type(self) == __class__ # noqa: E721 + assert type(self) is __class__ r = "{}({}, {})".format( __class__.__name__, repr(self._data_dir), @@ -100,7 +100,7 @@ def message(self) -> str: for f, lines in self._files or []: assert type(f) is str - assert type(lines) in [str, bytes] # noqa: E721 + assert type(lines) in [str, bytes] msg_parts.append(u'{}\n----\n{}\n'.format(f, lines)) return "\n".join(msg_parts) @@ -157,7 +157,7 @@ def wait_for_running_state( timeout: T_WAIT_TIME, ): assert type(node) is PostgresNode - assert type(node_log_reader) == PostgresNodeLogReader # noqa: E721 + assert type(node_log_reader) is PostgresNodeLogReader assert type(timeout) in [int, float] assert node_log_reader._node is node assert timeout > 0 @@ -176,7 +176,7 @@ def wait_for_running_state( assert type(blocks) is list for block in blocks: - assert type(block) == PostgresNodeLogReader.LogDataBlock # noqa: E721 + assert type(block) is PostgresNodeLogReader.LogDataBlock if 'Is another postmaster already running on port' in block.data: raise __class__.PortConflictNodeException(node.data_dir, node.port) diff --git a/tests/test_os_ops_common.py b/tests/test_os_ops_common.py index 5e8ea6e2..29e2f1ff 100644 --- a/tests/test_os_ops_common.py +++ b/tests/test_os_ops_common.py @@ -61,7 +61,7 @@ def test_create_clone(self, os_ops: OsOperations): clone = os_ops.create_clone() assert clone is not None assert clone is not os_ops - assert type(clone) == type(os_ops) # noqa: E721 + assert type(clone) is type(os_ops) def test_exec_command_success(self, os_ops: OsOperations): """ @@ -759,11 +759,11 @@ def __init__(self, sign, source, cp_rw, cp_truncate, cp_binary, cp_data, result) ) def write_data001(self, request): assert isinstance(request, pytest.FixtureRequest) - assert type(request.param) == __class__.tagWriteData001 # noqa: E721 + assert type(request.param) is __class__.tagWriteData001 return request.param def test_write(self, write_data001: tagWriteData001, os_ops: OsOperations): - assert type(write_data001) == __class__.tagWriteData001 # noqa: E721 + assert type(write_data001) is __class__.tagWriteData001 assert isinstance(os_ops, OsOperations) mode = "w+b" if write_data001.call_param__binary else "w+" @@ -847,7 +847,7 @@ def test_is_port_free__false(self, os_ops: OsOperations): def LOCAL_server(s: socket.socket): assert s is not None - assert type(s) == socket.socket # noqa: E721 + assert type(s) is socket.socket try: while True: @@ -873,7 +873,7 @@ def LOCAL_server(s: socket.socket): s.listen(10) - assert type(th) == threading.Thread # noqa: E721 + assert type(th) is threading.Thread th.start() try: @@ -964,7 +964,7 @@ def data001(self, request: pytest.FixtureRequest) -> tagData_OS_OPS__NUMS: return request.param def test_mkdir__mt(self, data001: tagData_OS_OPS__NUMS): - assert type(data001) == __class__.tagData_OS_OPS__NUMS # noqa: E721 + assert type(data001) is __class__.tagData_OS_OPS__NUMS N_WORKERS = 4 N_NUMBERS = data001.nums @@ -1003,7 +1003,7 @@ def LOCAL_WORKER(os_ops: OsOperations, def LOG_INFO(template: str, *args) -> None: assert type(template) is str - assert type(args) == tuple # noqa: E721 + assert type(args) is tuple msg = template.format(*args) assert type(msg) is str @@ -1226,14 +1226,14 @@ class tadWorkerData: ) def kill_signal_id(self, request: pytest.FixtureRequest) -> T_KILL_SIGNAL_DESCR: assert isinstance(request, pytest.FixtureRequest) - assert type(request.param) == tuple # noqa: E721 + assert type(request.param) is tuple return request.param def test_kill_signal( self, kill_signal_id: T_KILL_SIGNAL_DESCR, ): - assert type(kill_signal_id) == tuple # noqa: E721 + assert type(kill_signal_id) is tuple assert "{}".format(kill_signal_id[1]) == kill_signal_id[2] assert "{}".format(int(kill_signal_id[1])) == kill_signal_id[2] @@ -1246,7 +1246,7 @@ def test_kill( Test listdir for listing directory contents. """ assert isinstance(os_ops, OsOperations) - assert type(kill_signal_id) == tuple # noqa: E721 + assert type(kill_signal_id) is tuple cmd = [ sys.executable, @@ -1261,7 +1261,7 @@ def test_kill( ) assert proc is not None - assert type(proc) == subprocess.Popen # noqa: E721 + assert type(proc) is subprocess.Popen proc_pid = proc.pid assert type(proc_pid) is int logging.info("Test process pid is {}".format(proc_pid)) @@ -1315,7 +1315,7 @@ def test_kill__unk_pid( Test listdir for listing directory contents. """ assert isinstance(os_ops, OsOperations) - assert type(kill_signal_id) == tuple # noqa: E721 + assert type(kill_signal_id) is tuple cmd = [ sys.executable, @@ -1332,7 +1332,7 @@ def test_kill__unk_pid( ) assert proc is not None - assert type(proc) == subprocess.Popen # noqa: E721 + assert type(proc) is subprocess.Popen proc_pid = proc.pid assert type(proc_pid) is int logging.info("Test process pid is {}".format(proc_pid)) @@ -1387,10 +1387,10 @@ def test_kill__unk_pid( logging.info("Our exception has type [{}]".format(type(x.value).__name__)) if type(os_ops).__name__ == "LocalOsOperations": - assert type(x.value) == ProcessLookupError # noqa: E721 + assert type(x.value) is ProcessLookupError assert "No such process" in str(x.value) elif type(os_ops).__name__ == "RemoteOsOperations": - assert type(x.value) == ExecUtilException # noqa: E721 + assert type(x.value) is ExecUtilException assert "No such process" in str(x.value) else: RuntimeError("Unknown os_ops type: {}".format(type(os_ops).__name__)) diff --git a/tests/test_os_ops_remote.py b/tests/test_os_ops_remote.py index 0aa3386f..f7fe35ba 100755 --- a/tests/test_os_ops_remote.py +++ b/tests/test_os_ops_remote.py @@ -32,8 +32,8 @@ def test_rmdirs__try_to_delete_file(self, os_ops: OsOperations): os_ops.rmdirs(path, ignore_errors=False) assert os.path.exists(path) - assert type(x.value) == ExecUtilException # noqa: E721 - assert type(x.value.description) == str # noqa: E721 + assert type(x.value) is ExecUtilException + assert type(x.value.description) is str assert x.value.description == "Utility exited with non-zero code (20). Error: `cannot remove '" + path + "': it is not a directory`" assert x.value.message.startswith(x.value.description) assert type(x.value.error) is str diff --git a/tests/test_raise_error.py b/tests/test_raise_error.py index bfc10344..4e2a5a15 100644 --- a/tests/test_raise_error.py +++ b/tests/test_raise_error.py @@ -16,7 +16,7 @@ def __init__( node_status: NodeStatus, expected_msg: str, ): - assert type(node_status) == NodeStatus # noqa: E721 + assert type(node_status) is NodeStatus assert type(expected_msg) is str self.node_status = node_status self.expected_msg = expected_msg @@ -24,7 +24,7 @@ def __init__( @property def sign(self) -> str: - assert type(self.node_status) == NodeStatus # noqa: E721 + assert type(self.node_status) is NodeStatus msg = "status: {}".format(self.node_status) return msg @@ -53,7 +53,7 @@ def test_001__node_err__cant_enumerate_child_processes( self, data001: tagTestData001, ): - assert type(data001) == __class__.tagTestData001 # noqa: E721 + assert type(data001) is __class__.tagTestData001 with pytest.raises(expected_exception=InvalidOperationException) as x: RaiseError.node_err__cant_enumerate_child_processes( @@ -88,7 +88,7 @@ def test_002__node_err__cant_kill( self, data002: tagTestData001, ): - assert type(data002) == __class__.tagTestData001 # noqa: E721 + assert type(data002) is __class__.tagTestData001 with pytest.raises(expected_exception=InvalidOperationException) as x: RaiseError.node_err__cant_kill( diff --git a/tests/test_testgres_common.py b/tests/test_testgres_common.py index aed15dfc..cc13ce24 100644 --- a/tests/test_testgres_common.py +++ b/tests/test_testgres_common.py @@ -222,7 +222,7 @@ def test_double_start(self, node_svc: PostgresNodeService): node.start() assert x is not None - assert type(x.value) == StartNodeException # noqa: E721 + assert type(x.value) is StartNodeException assert type(x.value.description) is str assert type(x.value.message) is str @@ -301,7 +301,7 @@ def test_start2(self, node_svc: PostgresNodeService): node.start2() assert x is not None - assert type(x.value) == StartNodeException # noqa: E721 + assert type(x.value) is StartNodeException assert type(x.value.description) is str assert type(x.value.message) is str @@ -705,7 +705,7 @@ def test_child_processes__ok( logging.info("") def LOCAL__safe_call_cmdline(p: ProcessProxy) -> str: - assert type(p) == ProcessProxy # noqa: E721 + assert type(p) is ProcessProxy try: return p.cmdline() except Exception as e: @@ -720,7 +720,7 @@ def LOCAL__safe_call_cmdline(p: ProcessProxy) -> str: try: assert child is not None - assert type(child) == ProcessProxy # noqa: E721 + assert type(child) is ProcessProxy assert hasattr(child, "process") assert hasattr(child, "ptype") assert hasattr(child, "pid") @@ -730,7 +730,7 @@ def LOCAL__safe_call_cmdline(p: ProcessProxy) -> str: assert child.pid is not None assert type(child.ptype) is ProcessType assert type(child.pid) is int - assert type(child.cmdline) == types.MethodType # noqa: E721 + assert type(child.cmdline) is types.MethodType logging.info("ptype is {}".format(child.ptype)) logging.info("pid is {}".format(child.pid)) @@ -1232,7 +1232,7 @@ def test_safe_psql__expect_error(self, node_svc: PostgresNodeService): assert isinstance(node_svc, PostgresNodeService) with __class__.helper__get_node(node_svc).init().start() as node: err = node.safe_psql('select_or_not_select 1', expect_error=True) - assert (type(err) == str) # noqa: E721 + assert (type(err) is str) assert ('select_or_not_select' in err) assert ('ERROR: syntax error at or near "select_or_not_select"' in err) @@ -1698,20 +1698,20 @@ def test_promotion(self, node_svc: PostgresNodeService): assert (__class__.helper__rm_carriage_returns(res) == b'1\n') @pytest.fixture( - params=[ - enums.DumpFormat.Plain, - enums.DumpFormat.Custom, - enums.DumpFormat.Directory, - enums.DumpFormat.Tar - ] + params=[ + enums.DumpFormat.Plain, + enums.DumpFormat.Custom, + enums.DumpFormat.Directory, + enums.DumpFormat.Tar + ] ) def dump_fmt(self, request: pytest.FixtureRequest) -> enums.DumpFormat: - assert type(request.param) == enums.DumpFormat # noqa: E721 + assert type(request.param) is enums.DumpFormat return request.param def test_dump(self, node_svc: PostgresNodeService, dump_fmt: enums.DumpFormat): assert isinstance(node_svc, PostgresNodeService) - assert type(dump_fmt) == enums.DumpFormat # noqa: E721 + assert type(dump_fmt) is enums.DumpFormat query_create = 'create table test as select generate_series(1, 2) as val' query_select = 'select * from test order by val asc' @@ -1799,13 +1799,13 @@ def test_the_same_port(self, node_svc: PostgresNodeService): with __class__.helper__get_node(node_svc) as node: node.init().start() assert (node._should_free_port) - assert (type(node.port) == int) # noqa: E721 + assert (type(node.port) is int) node_port_copy = node.port r = node.safe_psql("SELECT 1;") assert (__class__.helper__rm_carriage_returns(r) == b'1\n') with __class__.helper__get_node(node_svc, port=node.port) as node2: - assert (type(node2.port) == int) # noqa: E721 + assert (type(node2.port) is int) assert (node2.port == node.port) assert (not node2._should_free_port) assert (node2.status() == NodeStatus.Uninitialized) @@ -1903,7 +1903,7 @@ def release_port(self, number: int) -> None: return self.m_PrevPortManager.release_port(number) def test_port_rereserve_during_node_start(self, node_svc: PostgresNodeService): - assert type(node_svc) == PostgresNodeService # noqa: E721 + assert type(node_svc) is PostgresNodeService assert PostgresNode._C_MAX_START_ATEMPTS == 5 C_COUNT_OF_BAD_PORT_USAGE = 3 @@ -1938,7 +1938,7 @@ def test_port_rereserve_during_node_start(self, node_svc: PostgresNodeService): assert __class__.helper__rm_carriage_returns(r) == b'3\n' def test_port_conflict(self, node_svc: PostgresNodeService): - assert type(node_svc) == PostgresNodeService # noqa: E721 + assert type(node_svc) is PostgresNodeService assert PostgresNode._C_MAX_START_ATEMPTS > 1 C_COUNT_OF_BAD_PORT_USAGE = PostgresNode._C_MAX_START_ATEMPTS @@ -1982,7 +1982,7 @@ def test_port_conflict(self, node_svc: PostgresNodeService): assert __class__.helper__rm_carriage_returns(r) == b'3\n' def test_try_to_get_port_after_free_manual_port(self, node_svc: PostgresNodeService): - assert type(node_svc) == PostgresNodeService # noqa: E721 + assert type(node_svc) is PostgresNodeService assert node_svc.port_manager is not None assert isinstance(node_svc.port_manager, PortManager) @@ -2012,7 +2012,7 @@ def test_try_to_get_port_after_free_manual_port(self, node_svc: PostgresNodeServ assert p is None def test_try_to_start_node_after_free_manual_port(self, node_svc: PostgresNodeService): - assert type(node_svc) == PostgresNodeService # noqa: E721 + assert type(node_svc) is PostgresNodeService assert node_svc.port_manager is not None assert isinstance(node_svc.port_manager, PortManager) @@ -2041,7 +2041,7 @@ def test_try_to_start_node_after_free_manual_port(self, node_svc: PostgresNodeSe node2.start() def test_node__os_ops(self, node_svc: PostgresNodeService): - assert type(node_svc) == PostgresNodeService # noqa: E721 + assert type(node_svc) is PostgresNodeService assert node_svc.os_ops is not None assert isinstance(node_svc.os_ops, OsOperations) @@ -2056,7 +2056,7 @@ def test_node__os_ops(self, node_svc: PostgresNodeService): assert node.os_ops is node_svc.os_ops def test_node__port_manager(self, node_svc: PostgresNodeService): - assert type(node_svc) == PostgresNodeService # noqa: E721 + assert type(node_svc) is PostgresNodeService assert node_svc.port_manager is not None assert isinstance(node_svc.port_manager, PortManager) @@ -2071,7 +2071,7 @@ def test_node__port_manager(self, node_svc: PostgresNodeService): assert node.port_manager is node_svc.port_manager def test_node__port_manager_and_explicit_port(self, node_svc: PostgresNodeService): - assert type(node_svc) == PostgresNodeService # noqa: E721 + assert type(node_svc) is PostgresNodeService assert isinstance(node_svc.os_ops, OsOperations) assert node_svc.port_manager is not None @@ -2097,7 +2097,7 @@ def test_node__port_manager_and_explicit_port(self, node_svc: PostgresNodeServic node_svc.port_manager.release_port(port) def test_node__no_port_manager(self, node_svc: PostgresNodeService): - assert type(node_svc) == PostgresNodeService # noqa: E721 + assert type(node_svc) is PostgresNodeService assert isinstance(node_svc.os_ops, OsOperations) assert node_svc.port_manager is not None @@ -2130,7 +2130,7 @@ def __init__( record_count: int, ): assert type(record_count) is int - self.record_count = record_count # noqa: E721 + self.record_count = record_count return sm_TableCheckSumTestDatas = [ @@ -2165,8 +2165,8 @@ def test_node__table_checksum( node_svc: PostgresNodeService, table_checksum_test_data: tagTableChecksumTestData, ): - assert type(node_svc) == PostgresNodeService # noqa: E721 - assert type(table_checksum_test_data) == __class__.tagTableChecksumTestData # noqa: E721 + assert type(node_svc) is PostgresNodeService + assert type(table_checksum_test_data) is __class__.tagTableChecksumTestData assert node_svc.port_manager is not None assert isinstance(node_svc.port_manager, PortManager) @@ -2205,7 +2205,7 @@ def test_node__table_checksum( row = cursor.fetchone() if row is None: break - assert type(row) in [list, tuple] # noqa: E721 + assert type(row) in [list, tuple] assert len(row) == 1 record_count += 1 checksum1 += int(row[0]) @@ -2225,8 +2225,8 @@ def test_node__pgbench_table_checksums__one_table( node_svc: PostgresNodeService, table_checksum_test_data: tagTableChecksumTestData, ): - assert type(node_svc) == PostgresNodeService # noqa: E721 - assert type(table_checksum_test_data) == __class__.tagTableChecksumTestData # noqa: E721 + assert type(node_svc) is PostgresNodeService + assert type(table_checksum_test_data) is __class__.tagTableChecksumTestData assert node_svc.port_manager is not None assert isinstance(node_svc.port_manager, PortManager) @@ -2265,7 +2265,7 @@ def test_node__pgbench_table_checksums__one_table( row = cursor.fetchone() if row is None: break - assert type(row) in [list, tuple] # noqa: E721 + assert type(row) in [list, tuple] assert len(row) == 1 record_count += 1 checksum1 += int(row[0]) @@ -2276,7 +2276,7 @@ def test_node__pgbench_table_checksums__one_table( actual_result = node.pgbench_table_checksums(C_DB, ["t"]) assert type(actual_result) is set actual1 = actual_result.pop() - assert type(actual1) == tuple # noqa: E721 + assert type(actual1) is tuple assert len(actual1) == 2 assert type(actual1[0]) is str assert type(actual1[1]) is int @@ -2286,7 +2286,7 @@ def test_node__pgbench_table_checksums__one_table( return def test_node__pgbench_table_checksums__pbckp_2278(self, node_svc: PostgresNodeService): - assert type(node_svc) == PostgresNodeService # noqa: E721 + assert type(node_svc) is PostgresNodeService assert node_svc.port_manager is not None assert isinstance(node_svc.port_manager, PortManager) @@ -2342,7 +2342,7 @@ def helper__call_and_check_pgbench_table_checksums( ok = True for tcs in full_checksums: - assert type(tcs) == tuple # noqa: E721 + assert type(tcs) is tuple assert len(tcs) == 2 assert type(tcs[0]) is str assert type(tcs[1]) is int @@ -2385,7 +2385,7 @@ def helper__call_and_check_pgbench_table_checksums( ok = False assert len(recs) == 1 rec = recs[0] - assert type(rec) == tuple # noqa: E721 + assert type(rec) is tuple assert len(rec) == 2 logging.error("Table [{}] has a lock [granted: {}][mode: {}].".format( tableName, @@ -2428,7 +2428,7 @@ def proxy__rmdirs(self, path, ignore_errors=True): raise Exception("Call of rmdirs is not expected!") def test_node_app__make_empty__base_dir_is_None(self, node_svc: PostgresNodeService): - assert type(node_svc) == PostgresNodeService # noqa: E721 + assert type(node_svc) is PostgresNodeService assert isinstance(node_svc.os_ops, OsOperations) assert node_svc.port_manager is not None @@ -2451,10 +2451,10 @@ def test_node_app__make_empty__base_dir_is_None(self, node_svc: PostgresNodeServ with pytest.raises(expected_exception=BaseException) as x: node_app.make_empty(base_dir=None) - if type(x.value) == AssertionError: # noqa: E721 + if type(x.value) is AssertionError: pass else: - assert type(x.value) == ValueError # noqa: E721 + assert type(x.value) is ValueError assert str(x.value) == "Argument 'base_dir' is not defined." # ----------- @@ -2462,7 +2462,7 @@ def test_node_app__make_empty__base_dir_is_None(self, node_svc: PostgresNodeServ node_svc.os_ops.rmdir(tmp_dir) def test_node_app__make_empty__base_dir_is_Empty(self, node_svc: PostgresNodeService): - assert type(node_svc) == PostgresNodeService # noqa: E721 + assert type(node_svc) is PostgresNodeService assert isinstance(node_svc.os_ops, OsOperations) assert node_svc.port_manager is not None @@ -2492,7 +2492,7 @@ def test_node_app__make_empty__base_dir_is_Empty(self, node_svc: PostgresNodeSer node_svc.os_ops.rmdir(tmp_dir) def test_node_app__make_empty(self, node_svc: PostgresNodeService): - assert type(node_svc) == PostgresNodeService # noqa: E721 + assert type(node_svc) is PostgresNodeService assert isinstance(node_svc.os_ops, OsOperations) assert node_svc.port_manager is not None @@ -2541,7 +2541,7 @@ def test_node_app__make_empty(self, node_svc: PostgresNodeService): node_svc.os_ops.rmdir(tmp_dir) def test_node_app__make_simple__checksum(self, node_svc: PostgresNodeService): - assert type(node_svc) == PostgresNodeService # noqa: E721 + assert type(node_svc) is PostgresNodeService assert isinstance(node_svc.os_ops, OsOperations) assert node_svc.port_manager is not None @@ -2594,7 +2594,7 @@ def LOCAL__test(checksum: bool, initdb_params: typing.Optional[list]): node_svc.os_ops.rmdir(tmp_dir) def test_node_app__make_empty_with_explicit_port(self, node_svc: PostgresNodeService): - assert type(node_svc) == PostgresNodeService # noqa: E721 + assert type(node_svc) is PostgresNodeService assert isinstance(node_svc.os_ops, OsOperations) assert node_svc.port_manager is not None diff --git a/tests/test_testgres_local.py b/tests/test_testgres_local.py index 3df93122..437d5f6d 100644 --- a/tests/test_testgres_local.py +++ b/tests/test_testgres_local.py @@ -273,7 +273,7 @@ def test_port_rereserve_during_node_start(self): with get_new_node() as node1: node1.init().start() assert (node1._should_free_port) - assert (type(node1.port) == int) # noqa: E721 + assert (type(node1.port) is int) node1_port_copy = node1.port assert (rm_carriage_returns(node1.safe_psql("SELECT 1;")) == b'1\n') @@ -306,7 +306,7 @@ def test_port_conflict(self): with get_new_node() as node1: node1.init().start() assert (node1._should_free_port) - assert (type(node1.port) == int) # noqa: E721 + assert (type(node1.port) is int) node1_port_copy = node1.port assert (rm_carriage_returns(node1.safe_psql("SELECT 1;")) == b'1\n') diff --git a/tests/units/exceptions/BackupException/test_set001__constructor.py b/tests/units/exceptions/BackupException/test_set001__constructor.py index bdde56c9..c0b55001 100644 --- a/tests/units/exceptions/BackupException/test_set001__constructor.py +++ b/tests/units/exceptions/BackupException/test_set001__constructor.py @@ -5,7 +5,7 @@ class TestSet001_Constructor: def test_001__default(self): e = BackupException() - assert type(e) == BackupException # noqa: E721 + assert type(e) is BackupException assert isinstance(e, testgres__TestgresException) assert e.source is None assert e.message == "" @@ -15,7 +15,7 @@ def test_001__default(self): def test_002__message(self): e = BackupException(message="abc\n123") - assert type(e) == BackupException # noqa: E721 + assert type(e) is BackupException assert isinstance(e, testgres__TestgresException) assert e.source is None assert e.message == "abc\n123" diff --git a/tests/units/exceptions/CatchUpException/test_set001__constructor.py b/tests/units/exceptions/CatchUpException/test_set001__constructor.py index 014797c6..0e701264 100644 --- a/tests/units/exceptions/CatchUpException/test_set001__constructor.py +++ b/tests/units/exceptions/CatchUpException/test_set001__constructor.py @@ -5,7 +5,7 @@ class TestSet001_Constructor: def test_001__default(self): e = CatchUpException() - assert type(e) == CatchUpException # noqa: E721 + assert type(e) is CatchUpException assert isinstance(e, testgres__TestgresException) assert e.source is None assert e.message == "" @@ -15,7 +15,7 @@ def test_001__default(self): def test_002__message(self): e = CatchUpException(message="abc\n123") - assert type(e) == CatchUpException # noqa: E721 + assert type(e) is CatchUpException assert isinstance(e, testgres__TestgresException) assert e.source is None assert e.message == "abc\n123" diff --git a/tests/units/exceptions/InitNodeException/test_set001__constructor.py b/tests/units/exceptions/InitNodeException/test_set001__constructor.py index c4acae84..91999c00 100644 --- a/tests/units/exceptions/InitNodeException/test_set001__constructor.py +++ b/tests/units/exceptions/InitNodeException/test_set001__constructor.py @@ -5,7 +5,7 @@ class TestSet001_Constructor: def test_001__default(self): e = InitNodeException() - assert type(e) == InitNodeException # noqa: E721 + assert type(e) is InitNodeException assert isinstance(e, testgres__TestgresException) assert e.source is None assert e.message == "" @@ -15,7 +15,7 @@ def test_001__default(self): def test_002__message(self): e = InitNodeException(message="abc\n123") - assert type(e) == InitNodeException # noqa: E721 + assert type(e) is InitNodeException assert isinstance(e, testgres__TestgresException) assert e.source is None assert e.message == "abc\n123" diff --git a/tests/units/exceptions/PortForException/test_set001__constructor.py b/tests/units/exceptions/PortForException/test_set001__constructor.py index 219dd913..f7e1f2ca 100644 --- a/tests/units/exceptions/PortForException/test_set001__constructor.py +++ b/tests/units/exceptions/PortForException/test_set001__constructor.py @@ -5,7 +5,7 @@ class TestSet001_Constructor: def test_001__default(self): e = PortForException() - assert type(e) == PortForException # noqa: E721 + assert type(e) is PortForException assert isinstance(e, testgres__TestgresException) assert e.source is None assert e.message == "" @@ -15,7 +15,7 @@ def test_001__default(self): def test_002__message(self): e = PortForException(message="abc\n123") - assert type(e) == PortForException # noqa: E721 + assert type(e) is PortForException assert isinstance(e, testgres__TestgresException) assert e.source is None assert e.message == "abc\n123" diff --git a/tests/units/exceptions/QueryException/test_set001__constructor.py b/tests/units/exceptions/QueryException/test_set001__constructor.py index 05ff0bef..655e1eb7 100644 --- a/tests/units/exceptions/QueryException/test_set001__constructor.py +++ b/tests/units/exceptions/QueryException/test_set001__constructor.py @@ -5,7 +5,7 @@ class TestSet001_Constructor: def test_001__default(self): e = QueryException() - assert type(e) == QueryException # noqa: E721 + assert type(e) is QueryException assert isinstance(e, testgres__TestgresException) assert e.source is None assert e.message == "" @@ -17,7 +17,7 @@ def test_001__default(self): def test_002__message(self): e = QueryException(message="abc\n123") - assert type(e) == QueryException # noqa: E721 + assert type(e) is QueryException assert isinstance(e, testgres__TestgresException) assert e.source is None assert e.message == "abc\n123" @@ -29,7 +29,7 @@ def test_002__message(self): def test_003__query(self): e = QueryException(query="cba\n321") - assert type(e) == QueryException # noqa: E721 + assert type(e) is QueryException assert isinstance(e, testgres__TestgresException) assert e.source is None assert e.message == "Query: cba\n321" @@ -41,7 +41,7 @@ def test_003__query(self): def test_004__all(self): e = QueryException(message="mmm", query="cba\n321") - assert type(e) == QueryException # noqa: E721 + assert type(e) is QueryException assert isinstance(e, testgres__TestgresException) assert e.source is None assert e.message == "mmm\nQuery: cba\n321" diff --git a/tests/units/exceptions/QueryTimeoutException/test_set001__constructor.py b/tests/units/exceptions/QueryTimeoutException/test_set001__constructor.py index d69b2589..362edeb8 100644 --- a/tests/units/exceptions/QueryTimeoutException/test_set001__constructor.py +++ b/tests/units/exceptions/QueryTimeoutException/test_set001__constructor.py @@ -6,7 +6,7 @@ class TestSet001_Constructor: def test_001__default(self): e = QueryTimeoutException() - assert type(e) == QueryTimeoutException # noqa: E721 + assert type(e) is QueryTimeoutException assert isinstance(e, QueryException) assert isinstance(e, testgres__TestgresException) assert e.source is None @@ -19,7 +19,7 @@ def test_001__default(self): def test_002__message(self): e = QueryTimeoutException(message="abc\n123") - assert type(e) == QueryTimeoutException # noqa: E721 + assert type(e) is QueryTimeoutException assert isinstance(e, QueryException) assert isinstance(e, testgres__TestgresException) assert e.source is None @@ -32,7 +32,7 @@ def test_002__message(self): def test_003__query(self): e = QueryTimeoutException(query="cba\n321") - assert type(e) == QueryTimeoutException # noqa: E721 + assert type(e) is QueryTimeoutException assert isinstance(e, QueryException) assert isinstance(e, testgres__TestgresException) assert e.source is None @@ -45,7 +45,7 @@ def test_003__query(self): def test_004__all(self): e = QueryTimeoutException(message="mmm", query="cba\n321") - assert type(e) == QueryTimeoutException # noqa: E721 + assert type(e) is QueryTimeoutException assert isinstance(e, QueryException) assert isinstance(e, testgres__TestgresException) assert e.source is None diff --git a/tests/units/exceptions/StartNodeException/test_set001__constructor.py b/tests/units/exceptions/StartNodeException/test_set001__constructor.py index 9d7f7621..b66e7c79 100644 --- a/tests/units/exceptions/StartNodeException/test_set001__constructor.py +++ b/tests/units/exceptions/StartNodeException/test_set001__constructor.py @@ -5,7 +5,7 @@ class TestSet001_Constructor: def test_001__default(self): e = StartNodeException() - assert type(e) == StartNodeException # noqa: E721 + assert type(e) is StartNodeException assert isinstance(e, testgres__TestgresException) assert e.source is None assert e.message == "" @@ -17,7 +17,7 @@ def test_001__default(self): def test_002__message(self): e = StartNodeException(message="abc\n123") - assert type(e) == StartNodeException # noqa: E721 + assert type(e) is StartNodeException assert isinstance(e, testgres__TestgresException) assert e.source is None assert e.message == "abc\n123" @@ -29,7 +29,7 @@ def test_002__message(self): def test_003__files(self): e = StartNodeException(files=[("f\n1", b'line1\nline2')]) - assert type(e) == StartNodeException # noqa: E721 + assert type(e) is StartNodeException assert isinstance(e, testgres__TestgresException) assert e.source is None assert e.message == "f\n1\n----\nb'line1\\nline2'\n" @@ -41,7 +41,7 @@ def test_003__files(self): def test_004__all(self): e = StartNodeException(message="mmm", files=[("f\n1", b'line1\nline2')]) - assert type(e) == StartNodeException # noqa: E721 + assert type(e) is StartNodeException assert isinstance(e, testgres__TestgresException) assert e.source is None assert e.message == "mmm\nf\n1\n----\nb'line1\\nline2'\n" diff --git a/tests/units/node/PostgresNode/test_setM001__start.py b/tests/units/node/PostgresNode/test_setM001__start.py index f68b63b1..c0acc721 100644 --- a/tests/units/node/PostgresNode/test_setM001__start.py +++ b/tests/units/node/PostgresNode/test_setM001__start.py @@ -58,7 +58,7 @@ def test_001__wait_true( data001: tagData001 ): assert isinstance(node_svc, PostgresNodeService) - assert type(data001) == __class__.tagData001 # noqa: E721 + assert type(data001) is __class__.tagData001 assert data001.wait is None or type(data001.wait) is bool with PostgresNodeTestUtils.get_node(node_svc) as node: @@ -175,7 +175,7 @@ def test_003__exec_env( recs = cn.execute("select content from cmd_out;") assert type(recs) is list assert len(recs) == 1 - assert type(recs[0]) == tuple # noqa: E721 + assert type(recs[0]) is tuple rec = recs[0] assert len(rec) == 1 assert rec[0] == C_ENV_VALUE diff --git a/tests/units/node/PostgresNode/test_setM002__start2.py b/tests/units/node/PostgresNode/test_setM002__start2.py index 1cd71e27..286988f8 100644 --- a/tests/units/node/PostgresNode/test_setM002__start2.py +++ b/tests/units/node/PostgresNode/test_setM002__start2.py @@ -58,7 +58,7 @@ def test_001__wait_true( data001: tagData001 ): assert isinstance(node_svc, PostgresNodeService) - assert type(data001) == __class__.tagData001 # noqa: E721 + assert type(data001) is __class__.tagData001 assert data001.wait is None or type(data001.wait) is bool with PostgresNodeTestUtils.get_node(node_svc) as node: @@ -169,7 +169,7 @@ def test_003__exec_env( recs = cn.execute("select content from cmd_out;") assert type(recs) is list assert len(recs) == 1 - assert type(recs[0]) == tuple # noqa: E721 + assert type(recs[0]) is tuple rec = recs[0] assert len(rec) == 1 assert rec[0] == C_ENV_VALUE