Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb597bf8

Browse files
Warnings with pytest are fixed (#223)
1) [pytest.ini] testpaths has another format. It is a spaces separated list.pytest warning:PytestConfigWarning: No files were found in testpaths; consider removing or adjusting your testpaths configuration. Searching recursively from the current directory instead.2) pytest tries to find the test function in TestgresException class. Let's rename it to avoid this problem.pytest warning:PytestCollectionWarning: cannot collect test class 'TestgresException' because it has a __init__ constructor (from: tests/test_simple.py) class TestgresException(Exception):Of course, we can add __test__=False in TestgresException but it is not a good solution.
1 parent0b2c629 commitb597bf8

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

‎pytest.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[pytest]
2-
testpaths =["./tests","./testgres/plugins/pg_probackup2/pg_probackup2/tests"]
2+
testpaths = teststestgres/plugins/pg_probackup2/pg_probackup2/tests
33
addopts = --strict-markers
44
markers =
55
#log_file = logs/pytest.log

‎tests/test_testgres_common.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@
1010
from ..testgresimportProcessType
1111
from ..testgresimportNodeStatus
1212
from ..testgresimportIsolationLevel
13-
from ..testgresimportTestgresException
13+
14+
# New name prevents to collect test-functions in TestgresException and fixes
15+
# the problem with pytest warning.
16+
from ..testgresimportTestgresExceptionastestgres_TestgresException
17+
1418
from ..testgresimportInitNodeException
1519
from ..testgresimportStartNodeException
1620
from ..testgresimportQueryException
@@ -336,7 +340,7 @@ def LOCAL__check_auxiliary_pids__multiple_attempts(
336340
with__class__.helper__get_node(os_ops).init().start()asmaster:
337341

338342
# master node doesn't have a source walsender!
339-
withpytest.raises(expected_exception=TestgresException):
343+
withpytest.raises(expected_exception=testgres_TestgresException):
340344
master.source_walsender
341345

342346
withmaster.connect()ascon:
@@ -366,7 +370,7 @@ def LOCAL__check_auxiliary_pids__multiple_attempts(
366370
replica.stop()
367371

368372
# there should be no walsender after we've stopped replica
369-
withpytest.raises(expected_exception=TestgresException):
373+
withpytest.raises(expected_exception=testgres_TestgresException):
370374
replica.source_walsender
371375

372376
deftest_exceptions(self):
@@ -1013,7 +1017,7 @@ def test_replication_slots(self, os_ops: OsOperations):
10131017
replica.execute('select 1')
10141018

10151019
# cannot create new slot with the same name
1016-
withpytest.raises(expected_exception=TestgresException):
1020+
withpytest.raises(expected_exception=testgres_TestgresException):
10171021
node.replicate(slot='slot1')
10181022

10191023
deftest_incorrect_catchup(self,os_ops:OsOperations):
@@ -1022,7 +1026,7 @@ def test_incorrect_catchup(self, os_ops: OsOperations):
10221026
node.init(allow_streaming=True).start()
10231027

10241028
# node has no master, can't catch up
1025-
withpytest.raises(expected_exception=TestgresException):
1029+
withpytest.raises(expected_exception=testgres_TestgresException):
10261030
node.catchup()
10271031

10281032
deftest_promotion(self,os_ops:OsOperations):

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp