8000 Tests are based on pytest by dmitry-lipetsk · Pull Request #192 · postgrespro/testgres · GitHub
[go: up one dir, main page]

Skip to content

Tests are based on pytest #192

8000
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
f37c299
Using pytest [pytest.raises]
dmitry-lipetsk Feb 23, 2025
53e468e
Using pytest [pytest.skip]
dmitry-lipetsk Feb 23, 2025
12d702a
Using pytest [assertIsNotNone]
dmitry-lipetsk Feb 23, 2025
1cb664e
Using pytest [assertFalse]
dmitry-lipetsk Feb 23, 2025
e2e7e8b
Using pytest [assertTrue]
dmitry-lipetsk Feb 23, 2025
89784a8
Using pytest [assertEqual]
dmitry-lipetsk Feb 23, 2025
2252d60
Using pytest [assertNotEqual]
dmitry-lipetsk Feb 23, 2025
e8aad3d
Using pytest [assertGreaterEqual]
dmitry-lipetsk Feb 23, 2025
eaaa276
Using pytest [assertGreater]
dmitry-lipetsk Feb 23, 2025
4afbe00
Using pytest [assertIn]
dmitry-lipetsk Feb 23, 2025
a8e57ae
Using pytest [assertListEqual]
dmitry-lipetsk Feb 23, 2025
df199b9
unittest is not used
dmitry-lipetsk Feb 23, 2025
a82cf3d
Code style (flake8)
dmitry-lipetsk Feb 23, 2025
9745bc4
Merge commit '38b3dc3697d229b6668217f2f57825379c7f2e23' into D2025022…
dmitry-lipetsk Feb 23, 2025
27c4f40
Execution signature is removed
dmitry-lipetsk Feb 24, 2025
ae41d16
run_tests.sh installs pytest
dmitry-lipetsk Feb 24, 2025
a14b3d7
run_tests.sh is updated
dmitry-lipetsk Feb 24, 2025
e6f4448
Total refactoring of tests
dmitr 8000 y-lipetsk Feb 24, 2025
842bc08
Code style (flake8)
dmitry-lipetsk Feb 24, 2025
d9afdcc
Merge commit 'de738f9fd8d52345677903bface575d41cbe539c' into D2025022…
dmitry-lipetsk Feb 24, 2025
027d2ea
Merge branch 'D20250224_002--os_ops-in-free_utilities' into D20250223…
dmitry-lipetsk Feb 24, 2025
969e49d
Root __init__.py is added
dmitry-lipetsk Feb 24, 2025
6e2820d
Code style (flake8)
dmitry-lipetsk Feb 24, 2025
588b28b
Merge remote-tracking branch 'origin/D20250224_002--os_ops-in-free_ut…
dmitry-lipetsk Feb 24, 2025
e4e8909
pytest.ini is added
dmitry-lipetsk Feb 24, 2025
66860d0
TestgresTests::test_ports_management is corrected
dmitry-lipetsk Feb 24, 2025
aaaa677
coding: utf-8
dmitry-lipetsk Feb 24, 2025
60bb4c5
Cleanup
dmitry-lipetsk Feb 24, 2025
2d2532c
CI runs all the tests of testgres.
dmitry-lipetsk Feb 24, 2025
537a9ac
Add install ssh
Feb 24, 2025
1f99813
Revert "Add install ssh"
dmitry-lipetsk Feb 25, 2025
41455d6
Revert "CI runs all the tests of testgres."
dmitry-lipetsk Feb 25, 2025
1c43810
Merge commit '669e134ff65b99cd285500e5f362633fc8d50e4e' into D2025022…
dmitry-lipetsk Feb 25, 2025
47a51a8
Test of probackup plugin is restored
dmitry-lipetsk Feb 25, 2025
f7f163d
The test suite of a probackup plugin is based on pytest
dmitry-lipetsk Feb 25, 2025
ed7b187
Probackup plugin is updated
dmitry-lipetsk Feb 25, 2025
8af4a49
CI test use 4 cores
dmitry-lipetsk Feb 25, 2025
d35ca43
testgres.plugins.probackup2.Init was restored [thanks to Yuri Sokolov]
dmitry-lipetsk Feb 25, 2025
181126b
pytest.ini is updated [testpaths]
dmitry-lipetsk Feb 25, 2025
d08f659
test_child_pids (local, remote) is updated
dmitry-lipetsk Feb 25, 2025
e803146
test_child_process_dies is updated
dmitry-lipetsk Feb 25, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Code style (flake8)
  • Loading branch information
dmitry-lipetsk committed Feb 23, 2025
commit a82cf3dbd159a4a52446673a2f687dbc48324128
18 changes: 9 additions & 9 deletions tests/test_simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,11 +475,11 @@ def test_synchronous_replication(self):

# check formatting
assert (
'1 ("{}", "{}")'.format(standby1.name, standby2.name) ==
str(First(1, (standby1, standby2)))) # yapf: disable
'1 ("{}", "{}")'.format(standby1.name, standby2.name) == str(First(1, (standby1, standby2)))
) # yapf: disable
assert (
'ANY 1 ("{}", "{}")'.format(standby1.name, standby2.name) ==
str(Any(1, (standby1, standby2)))) # yapf: disable
'ANY 1 ("{}", "{}")'.format(standby1.name, standby2.name) == str(Any(1, (standby1, standby2)))
) # yapf: disable

# set synchronous_standby_names
master.set_synchronous_standbys(First(2, [standby1, standby2]))
Expand Down Expand Up @@ -592,7 +592,7 @@ def test_logical_catchup(self):
node1.execute('insert into test values ({0}, {0})'.format(i))
sub.catchup()
res = node2.execute('select * from test')
assert (res == [(i,i,)])
assert (res == [(i, i, )])
node1.execute('delete from test')

# @unittest.skipIf(pg_version_ge('10'), 'requires <10')
Expand Down Expand Up @@ -1030,7 +1030,7 @@ def test_child_process_dies(self):
cmd = ["timeout", "60"] if os.name == 'nt' else ["sleep", "60"]

with subprocess.Popen(cmd, shell=True) as process: # shell=True might be needed on Windows
assert (process.poll() == None)
assert (process.poll() is None)
# collect list of processes currently running
children = psutil.Process(os.getpid()).children()
# kill a process, so received children dictionary becomes invalid
Expand Down Expand Up @@ -1066,12 +1066,12 @@ def test_the_same_port(self):
with get_new_node() as node:
node.init().start()
assert (node._should_free_port)
assert (type(node.port) == int)
assert (type(node.port) == int) # noqa: E721
node_port_copy = node.port
assert (rm_carriage_returns(node.safe_psql("SELECT 1;")) == b'1\n')

with get_new_node(port=node.port) as node2:
assert (type(node2.port) == int)
assert (type(node2.port) == int) # noqa: E721
assert (node2.port == node.port)
assert not (node2._should_free_port)

Expand Down Expand Up @@ -1317,6 +1317,7 @@ def test_set_auto_conf(self):

for x in testData:
assert x[0] + " = " + x[2] in content

@staticmethod
def helper__skip_test_if_util_not_exist(name: str):
assert type(name) == str # noqa: E721
Expand All @@ -1340,4 +1341,3 @@ def helper__skip_test_if_pg_version_is_ge(version: str):
assert type(version) == str # noqa: E721
if pg_version_ge(version):
pytest.skip('requires <{0}'.format(version))

13 changes: 6 additions & 7 deletions tests/test_simple_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -528,11 +528,11 @@ def test_synchronous_replication(self):

# check formatting
assert (
'1 ("{}", "{}")'.format(standby1.name, standby2.name) ==
str(First(1, (standby1, standby2)))) # yapf: disable
'1 ("{}", "{}")'.format(standby1.name, standby2.name) == str(First(1, (standby1, standby2)))
) # yapf: disable
assert (
'ANY 1 ("{}", "{}")'.format(standby1.name, standby2.name) ==
str(Any(1, (standby1, standby2)))) # yapf: disable
'ANY 1 ("{}", "{}")'.format(standby1.name, standby2.name) == str(Any(1, (standby1, standby2)))
) # yapf: disable

# set synchronous_standby_names
master.set_synchronous_standbys(First(2, [standby1, standby2]))
Expand Down Expand Up @@ -645,7 +645,7 @@ def test_logical_catchup(self):
node1.execute('insert into test values ({0}, {0})'.format(i))
sub.catchup()
res = node2.execute('select * from test')
assert (res == [(i,i,)])
assert (res == [(i, i, )])
node1.execute('delete from test')

# @unittest.skipIf(pg_version_ge('10'), 'requires <10')
Expand Down Expand Up @@ -1071,7 +1071,7 @@ def test_child_pids(self):
def test_child_process_dies(self):
# test for FileNotFound exception during child_processes() function
with subprocess.Popen(["sleep", "60"]) as process:
assert (process.poll() == None)
assert (process.poll() is None)
# collect list of processes currently running
children = psutil.Process(os.getpid()).children()
# kill a process, so received children dictionary becomes invalid
Expand Down Expand Up @@ -1104,4 +1104,3 @@ def helper__skip_test_if_pg_version_is_ge(version: str):
assert type(version) == str # noqa: E721
if pg_version_ge(version):
pytest.skip('requires <{0}'.format(version))

0