Reformat tests using yapf

This commit is contained in:
Dmitry Ivanov
2021-06-01 20:42:56 +03:00
parent 7d5f7462c1
commit 00ce635da9
14 changed files with 49 additions and 48 deletions

View File

@@ -39,7 +39,7 @@ def test_branch_behind(zenith_cli, pageserver, postgres, pg_bin):
print('LSN after 100100 rows: ' + lsn_b)
# Branch at the point where only 100 rows were inserted
zenith_cli.run(["branch", "test_branch_behind_hundred", "test_branch_behind@"+lsn_a])
zenith_cli.run(["branch", "test_branch_behind_hundred", "test_branch_behind@" + lsn_a])
# Insert many more rows. This generates enough WAL to fill a few segments.
main_cur.execute('''
@@ -54,7 +54,7 @@ def test_branch_behind(zenith_cli, pageserver, postgres, pg_bin):
print('LSN after 200100 rows: ' + lsn_c)
# Branch at the point where only 200 rows were inserted
zenith_cli.run(["branch", "test_branch_behind_more", "test_branch_behind@"+lsn_b])
zenith_cli.run(["branch", "test_branch_behind_more", "test_branch_behind@" + lsn_b])
pg_hundred = postgres.create_start("test_branch_behind_hundred")
pg_more = postgres.create_start("test_branch_behind_more")
@@ -64,15 +64,15 @@ def test_branch_behind(zenith_cli, pageserver, postgres, pg_bin):
hundred_pg_conn.set_isolation_level(psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT)
hundred_cur = hundred_pg_conn.cursor()
hundred_cur.execute('SELECT count(*) FROM foo')
assert hundred_cur.fetchone() == (100,)
assert hundred_cur.fetchone() == (100, )
# On the 'more' branch, we should see 100200 rows
more_pg_conn = psycopg2.connect(pg_more.connstr())
more_pg_conn.set_isolation_level(psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT)
more_cur = more_pg_conn.cursor()
more_cur.execute('SELECT count(*) FROM foo')
assert more_cur.fetchone() == (100100,)
assert more_cur.fetchone() == (100100, )
# All the rows are visible on the main branch
main_cur.execute('SELECT count(*) FROM foo')
assert main_cur.fetchone() == (200100,)
assert main_cur.fetchone() == (200100, )

View File

@@ -28,4 +28,4 @@ def test_config(zenith_cli, pageserver, postgres, pg_bin):
''')
# check that config change was applied
assert cur.fetchone() == ('debug1',)
assert cur.fetchone() == ('debug1', )

View File

@@ -25,7 +25,7 @@ def test_createdb(zenith_cli, pageserver, postgres, pg_bin):
lsn = cur.fetchone()[0]
# Create a branch
zenith_cli.run(["branch", "test_createdb2", "test_createdb@"+lsn])
zenith_cli.run(["branch", "test_createdb2", "test_createdb@" + lsn])
pg2 = postgres.create_start('test_createdb2')

View File

@@ -52,7 +52,7 @@ def test_multixact(pageserver, postgres, pg_bin, zenith_cli, base_dir):
assert int(next_multixact_id) > int(next_multixact_id_old)
# Branch at this point
zenith_cli.run(["branch", "test_multixact_new", "test_multixact@"+lsn])
zenith_cli.run(["branch", "test_multixact_new", "test_multixact@" + lsn])
pg_new = postgres.create_start('test_multixact_new')
print("postgres is running on 'test_multixact_new' branch")

View File

@@ -9,7 +9,7 @@ def test_status(pageserver):
pg_conn.autocommit = True
cur = pg_conn.cursor()
cur.execute('status')
assert cur.fetchone() == ('hello world',)
assert cur.fetchone() == ('hello world', )
pg_conn.close()

View File

@@ -31,12 +31,12 @@ def test_restart_compute(zenith_cli, pageserver, postgres, pg_bin):
# We can still see the row
cur.execute('SELECT count(*) FROM foo')
assert cur.fetchone() == (1,)
assert cur.fetchone() == (1, )
# Insert another row
cur.execute("INSERT INTO foo VALUES ('bar2')")
cur.execute('SELECT count(*) FROM foo')
assert cur.fetchone() == (2,)
assert cur.fetchone() == (2, )
# FIXME: Currently, there is no guarantee that by the time the INSERT commits, the WAL
# has been streamed safely to the WAL safekeeper or page server. It is merely stored
@@ -55,4 +55,4 @@ def test_restart_compute(zenith_cli, pageserver, postgres, pg_bin):
# We can still see the rows
cur.execute('SELECT count(*) FROM foo')
assert cur.fetchone() == (2,)
assert cur.fetchone() == (2, )

View File

@@ -41,7 +41,7 @@ def test_twophase(zenith_cli, pageserver, postgres, pg_bin):
cur2.execute("ROLLBACK PREPARED 'insert_two'")
cur2.execute('SELECT * FROM foo')
assert cur2.fetchall() == [('one',)]
assert cur2.fetchall() == [('one', )]
# Neither insert is visible on the original branch, the transactions are still
# in prepared state there.