- Notifications
You must be signed in to change notification settings - Fork35
Test refactoring#236
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
dmitry-lipetsk merged 7 commits intopostgrespro:masterfromdmitry-lipetsk:D20250406_001--test_refactoringApr 7, 2025
Uh oh!
There was an error while loading.Please reload this page.
Merged
Test refactoring#236
Changes fromall commits
Commits
Show all changes
7 commits Select commitHold shift + click to select a range
cd0635e
TestUtils is added
dmitry-lipetsk2ef2e00
TestTestgresCommon::test_node_repr is added
dmitry-lipetskd7f704d
test_get_pg_config2 moved to TestUtils
dmitry-lipetskcd80617
TestTestgresCommon.test_custom_init is added
dmitry-lipetsk88ca53d
TestConfig is added
dmitry-lipetsk18e2af3
Code style [simplification]
dmitry-lipetsk820fd78
test_testgres_local.py is updated [normalization]
dmitry-lipetskFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
41 changes: 41 additions & 0 deletionstests/test_config.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
from ..testgres import TestgresConfig | ||
from ..testgres import configure_testgres | ||
from ..testgres import scoped_config | ||
from ..testgres import pop_config | ||
from .. import testgres | ||
import pytest | ||
class TestConfig: | ||
def test_config_stack(self): | ||
# no such option | ||
with pytest.raises(expected_exception=TypeError): | ||
configure_testgres(dummy=True) | ||
# we have only 1 config in stack | ||
with pytest.raises(expected_exception=IndexError): | ||
pop_config() | ||
d0 = TestgresConfig.cached_initdb_dir | ||
d1 = 'dummy_abc' | ||
d2 = 'dummy_def' | ||
with scoped_config(cached_initdb_dir=d1) as c1: | ||
assert (c1.cached_initdb_dir == d1) | ||
with scoped_config(cached_initdb_dir=d2) as c2: | ||
stack_size = len(testgres.config.config_stack) | ||
# try to break a stack | ||
with pytest.raises(expected_exception=TypeError): | ||
with scoped_config(dummy=True): | ||
pass | ||
assert (c2.cached_initdb_dir == d2) | ||
assert (len(testgres.config.config_stack) == stack_size) | ||
assert (c1.cached_initdb_dir == d1) | ||
assert (TestgresConfig.cached_initdb_dir == d0) |
54 changes: 26 additions & 28 deletionstests/test_testgres_common.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
96 changes: 10 additions & 86 deletionstests/test_testgres_local.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
73 changes: 6 additions & 67 deletionstests/test_testgres_remote.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.