mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-06 13:02:55 +00:00
Reformat tests using yapf
This commit is contained in:
@@ -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, )
|
||||
|
||||
@@ -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', )
|
||||
|
||||
@@ -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')
|
||||
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
|
||||
@@ -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, )
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user