From: sergeyb@tarantool.org To: tarantool-patches@dev.tarantool.org, lvasiliev@tarantool.org Cc: alexander.turenko@tarantool.org Subject: [Tarantool-patches] [PATCH 3/6] test: remove empty print() functions Date: Mon, 7 Dec 2020 10:46:51 +0300 [thread overview] Message-ID: <5bd99e41ac8b1d6584094e48d1a441b04dda688d.1607326642.git.sergeyb@tarantool.org> (raw) In-Reply-To: <cover.1607326642.git.sergeyb@tarantool.org> From: Sergey Bronnikov <sergeyb@tarantool.org> Python tests are based on a reference output: on every run output produced by a test compared to reference output and test become passed when both output are equal. Perhaps empty print()'s were added as a delimeter for testscases in a produced output, so the main purpose of these empty print() functions is a reader's convenience. The problem with empty print's is that code become ugly. --- test/box-py/call.result | 4 ---- test/box-py/call.test.py | 4 ---- test/replication-py/multi.result | 6 ------ test/replication-py/multi.test.py | 6 ------ test/xlog-py/dup_key.result | 2 -- test/xlog-py/dup_key.test.py | 2 -- test/xlog-py/lsn_gap.result | 2 -- test/xlog-py/lsn_gap.test.py | 2 -- test/xlog-py/misc.result | 6 ------ test/xlog-py/misc.test.py | 6 ------ test/xlog-py/missing.result | 2 -- test/xlog-py/missing.test.py | 2 -- 12 files changed, 44 deletions(-) diff --git a/test/box-py/call.result b/test/box-py/call.result index e6b7b8dc9..dc3da3c82 100644 --- a/test/box-py/call.result +++ b/test/box-py/call.result @@ -55,11 +55,9 @@ call box.error (33333, 'Hey!') "reason": "Unknown error" } } - # A test case for Bug#103491 # server CALL processing bug with name path longer than two # https://bugs.launchpad.net/tarantool/+bug/1034912 - f = function() return 'OK' end --- ... @@ -81,11 +79,9 @@ call test.f () - 'OK' call test.test.f () - 'OK' - # Test for Bug #955226 # Lua Numbers are passed back wrongly as strings # - function foo() return 1, 2, '1', '2' end --- ... diff --git a/test/box-py/call.test.py b/test/box-py/call.test.py index 75ced1dff..519334c8b 100644 --- a/test/box-py/call.test.py +++ b/test/box-py/call.test.py @@ -23,11 +23,9 @@ call("f1") # IPROTO required! call("box.error", 33333, "Hey!") -print("") print("# A test case for Bug#103491") print("# server CALL processing bug with name path longer than two") print("# https://bugs.launchpad.net/tarantool/+bug/1034912") -print("") admin("f = function() return 'OK' end") admin("test = {}") admin("test.f = f") @@ -37,11 +35,9 @@ call("f") call("test.f") call("test.test.f") -print("") print("# Test for Bug #955226") print("# Lua Numbers are passed back wrongly as strings") print("#") -print("") admin("function foo() return 1, 2, '1', '2' end") call("foo") diff --git a/test/replication-py/multi.result b/test/replication-py/multi.result index f90ab22a0..f1ec286ad 100644 --- a/test/replication-py/multi.result +++ b/test/replication-py/multi.result @@ -37,27 +37,21 @@ _ = box.space.test:create_index('primary') server 1 is ok server 2 is ok server 3 is ok - Insert records inserted 60 records - Synchronize server 1 done server 2 done server 3 done done - Check data server 1 is ok server 2 is ok server 3 is ok Done - - ---------------------------------------------------------------------- Cleanup ---------------------------------------------------------------------- server 1 done server 2 done server 3 done - diff --git a/test/replication-py/multi.test.py b/test/replication-py/multi.test.py index a346fd560..c7d415258 100644 --- a/test/replication-py/multi.test.py +++ b/test/replication-py/multi.test.py @@ -72,14 +72,12 @@ master_lsn = master.get_lsn(master.id) for server in cluster: server.wait_lsn(master.id, master_lsn) print("server {} is ok".format(server.id)) -print("") print("Insert records") for i in range(ROW_N): server = cluster[i % REPLICA_N] server.admin("box.space.test:insert{{{}, {}}}".format(i, server.id), silent = True) print("inserted {} records".format(ROW_N)) -print("") print("Synchronize") for server1 in cluster: @@ -87,16 +85,13 @@ for server1 in cluster: server1.wait_lsn(server2.id, server2.get_lsn(server2.id)) print("server {} done".format(server1.id)) print("done") -print("") print("Check data") for server in cluster: cnt = yaml.safe_load(server.admin("box.space.test:len()", silent = True))[0] print("server {} is {}".format(server.id, cnt == ROW_N and "ok" or "not ok")) print("Done") -print("") -print("") print("----------------------------------------------------------------------") print("Cleanup") print("----------------------------------------------------------------------") @@ -104,7 +99,6 @@ print("----------------------------------------------------------------------") for server in cluster: server.stop() print("server {} done".format(server.id)) -print("") master.cleanup() master.deploy() diff --git a/test/xlog-py/dup_key.result b/test/xlog-py/dup_key.result index f387e8e89..ce3ffbc55 100644 --- a/test/xlog-py/dup_key.result +++ b/test/xlog-py/dup_key.result @@ -27,9 +27,7 @@ box.space.test:insert{2, 'fourth tuple'} ... .xlog does not exist check log line for 'Duplicate key' - 'Duplicate key' exists in server log - box.space.test:get{1} --- - [1, 'first tuple'] diff --git a/test/xlog-py/dup_key.test.py b/test/xlog-py/dup_key.test.py index a40133ef2..534221150 100644 --- a/test/xlog-py/dup_key.test.py +++ b/test/xlog-py/dup_key.test.py @@ -40,10 +40,8 @@ if not os.access(wal, os.F_OK): server.start() line = "Duplicate key" print("check log line for '{}'".format(line)) -print("") if server.logfile_pos.seek_once(line) >= 0: print("'{}' exists in server log".format(line)) -print("") server.admin("box.space.test:get{1}") server.admin("box.space.test:get{2}") diff --git a/test/xlog-py/lsn_gap.result b/test/xlog-py/lsn_gap.result index 685fc1efa..8633d76a4 100644 --- a/test/xlog-py/lsn_gap.result +++ b/test/xlog-py/lsn_gap.result @@ -21,9 +21,7 @@ box.space.test:insert{4, 'fourth tuple'} - [4, 'fourth tuple'] ... check log line for 'ignoring a gap in LSN' - 'ignoring a gap in LSN' exists in server log - box.space.test:select{} --- - - [1, 'first tuple'] diff --git a/test/xlog-py/lsn_gap.test.py b/test/xlog-py/lsn_gap.test.py index b80b97146..2d814c42c 100644 --- a/test/xlog-py/lsn_gap.test.py +++ b/test/xlog-py/lsn_gap.test.py @@ -31,10 +31,8 @@ os.unlink(wal) server.start() line="ignoring a gap in LSN" print("check log line for '{}'".format(line)) -print("") if server.logfile_pos.seek_once(line) >= 0: print("'{}' exists in server log".format(line)) -print("") # missing tuple from removed xlog server.admin("box.space.test:select{}") diff --git a/test/xlog-py/misc.result b/test/xlog-py/misc.result index 6c85814b1..8b4a6740c 100644 --- a/test/xlog-py/misc.result +++ b/test/xlog-py/misc.result @@ -1,6 +1,4 @@ - # xlog file must exist after inserts. - space = box.schema.space.create('tweedledum') --- ... @@ -8,16 +6,12 @@ space = box.schema.space.create('tweedledum') index = space:create_index('primary', { type = 'hash' }) --- ... - # a new xlog must be opened after regular termination. - box.space.tweedledum:insert{3, 'third tuple'} --- - [3, 'third tuple'] ... - # An xlog file with one record during recovery. - box.space.tweedledum:insert{4, 'fourth tuple'} --- - [4, 'fourth tuple'] diff --git a/test/xlog-py/misc.test.py b/test/xlog-py/misc.test.py index 3fcda9504..678031afa 100644 --- a/test/xlog-py/misc.test.py +++ b/test/xlog-py/misc.test.py @@ -13,9 +13,7 @@ server.stop() data_path = os.path.join(server.vardir, server.name) -print("") print("# xlog file must exist after inserts.") -print("") filename = str(lsn).zfill(20) + ".xlog" wal = os.path.join(data_path, filename) @@ -30,9 +28,7 @@ server.admin("index = space:create_index('primary', { type = 'hash' })") server.stop() lsn += 2 -print("") print("# a new xlog must be opened after regular termination.") -print("") filename = str(lsn).zfill(20) + ".xlog" server.start() @@ -49,9 +45,7 @@ if os.access(wal, os.F_OK): print(".xlog stays around after shutdown") lsn += 1 -print("") print("# An xlog file with one record during recovery.") -print("") server.start() filename = str(lsn).zfill(20) + ".xlog" wal = os.path.join(data_path, filename) diff --git a/test/xlog-py/missing.result b/test/xlog-py/missing.result index c52f75c68..826f57296 100644 --- a/test/xlog-py/missing.result +++ b/test/xlog-py/missing.result @@ -29,9 +29,7 @@ box.space.test:delete{3} - [3, 'third tuple'] ... check log line for 'ignoring a gap in LSN' - 'ignoring a gap in LSN' exists in server log - box.space.test:select{} --- - [] diff --git a/test/xlog-py/missing.test.py b/test/xlog-py/missing.test.py index 2fff0df6c..13b3ddd8f 100644 --- a/test/xlog-py/missing.test.py +++ b/test/xlog-py/missing.test.py @@ -37,10 +37,8 @@ os.unlink(wal) server.start() line="ignoring a gap in LSN" print("check log line for '{}'".format(line)) -print("") if server.logfile_pos.seek_once(line) >= 0: print("'{}' exists in server log".format(line)) -print("") # missing tuples from removed xlog server.admin("box.space.test:select{}") -- 2.25.1
next prev parent reply other threads:[~2020-12-07 7:51 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-12-07 7:46 [Tarantool-patches] [PATCH 0/6] Support Python 3 in tests and PEPify source code sergeyb 2020-12-07 7:46 ` [Tarantool-patches] [PATCH 1/6] test: support Python 3 and make quotes use consistent sergeyb 2020-12-09 15:58 ` Leonid Vasiliev 2020-12-10 13:23 ` Sergey Bronnikov 2020-12-10 13:29 ` Sergey Bronnikov 2020-12-07 7:46 ` [Tarantool-patches] [PATCH 2/6] test: remove dead code in Python tests end extra newline sergeyb 2020-12-09 20:20 ` Leonid Vasiliev 2020-12-07 7:46 ` sergeyb [this message] 2020-12-09 20:27 ` [Tarantool-patches] [PATCH 3/6] test: remove empty print() functions Leonid Vasiliev 2020-12-10 13:26 ` Sergey Bronnikov 2020-12-07 7:46 ` [Tarantool-patches] [PATCH 4/6] add initial flake8 config sergeyb 2020-12-09 20:57 ` Leonid Vasiliev 2020-12-07 7:46 ` [Tarantool-patches] [PATCH 5/6] cmake: add integration with flake8 sergeyb 2020-12-07 7:46 ` [Tarantool-patches] [PATCH 6/6] ci: enable flake8 sergeyb
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=5bd99e41ac8b1d6584094e48d1a441b04dda688d.1607326642.git.sergeyb@tarantool.org \ --to=sergeyb@tarantool.org \ --cc=alexander.turenko@tarantool.org \ --cc=lvasiliev@tarantool.org \ --cc=tarantool-patches@dev.tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH 3/6] test: remove empty print() functions' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox