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

Warnings with pytest are fixed#223

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
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
Warnings with pytest are fixed
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.
  • Loading branch information
@dmitry-lipetsk
dmitry-lipetsk committedMar 18, 2025
commit7d2f09486e84f38a4fc688e253b6fb633666f362
2 changes: 1 addition & 1 deletionpytest.ini
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
[pytest]
testpaths =["./tests", "./testgres/plugins/pg_probackup2/pg_probackup2/tests"]
testpaths = teststestgres/plugins/pg_probackup2/pg_probackup2/tests
addopts = --strict-markers
markers =
#log_file = logs/pytest.log
Expand Down
14 changes: 9 additions & 5 deletionstests/test_testgres_common.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,7 +10,11 @@
from ..testgres import ProcessType
from ..testgres import NodeStatus
from ..testgres import IsolationLevel
from ..testgres import TestgresException

# New name prevents to collect test-functions in TestgresException and fixes
# the problem with pytest warning.
from ..testgres import TestgresException as testgres_TestgresException

from ..testgres import InitNodeException
from ..testgres import StartNodeException
from ..testgres import QueryException
Expand DownExpand Up@@ -336,7 +340,7 @@ def LOCAL__check_auxiliary_pids__multiple_attempts(
with __class__.helper__get_node(os_ops).init().start() as master:

# master node doesn't have a source walsender!
with pytest.raises(expected_exception=TestgresException):
with pytest.raises(expected_exception=testgres_TestgresException):
master.source_walsender

with master.connect() as con:
Expand DownExpand Up@@ -366,7 +370,7 @@ def LOCAL__check_auxiliary_pids__multiple_attempts(
replica.stop()

# there should be no walsender after we've stopped replica
with pytest.raises(expected_exception=TestgresException):
with pytest.raises(expected_exception=testgres_TestgresException):
replica.source_walsender

def test_exceptions(self):
Expand DownExpand Up@@ -1013,7 +1017,7 @@ def test_replication_slots(self, os_ops: OsOperations):
replica.execute('select 1')

# cannot create new slot with the same name
with pytest.raises(expected_exception=TestgresException):
with pytest.raises(expected_exception=testgres_TestgresException):
node.replicate(slot='slot1')

def test_incorrect_catchup(self, os_ops: OsOperations):
Expand All@@ -1022,7 +1026,7 @@ def test_incorrect_catchup(self, os_ops: OsOperations):
node.init(allow_streaming=True).start()

# node has no master, can't catch up
with pytest.raises(expected_exception=TestgresException):
with pytest.raises(expected_exception=testgres_TestgresException):
node.catchup()

def test_promotion(self, os_ops: OsOperations):
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp