Skip to content

Commit

Permalink
Rename PSQLEXTRA_ANNOTATE_SQL to POSTGRES_EXTRA_ANNOTATE_SQL
Browse files Browse the repository at this point in the history
Consistent with other setting names:

* `POSTGRES_EXTRA_DB_BACKEND_BASE`
* `POSTGRES_EXTRA_AUTO_EXTENSION_SET_UP`
  • Loading branch information
Photonios committed Jul 18, 2022
1 parent 99b2c32 commit 77dad7e
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions psqlextra/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ def append_caller_to_sql(sql):
Slow and blocking queries could be easily tracked down to their originator
within the source code using the "pg_stat_activity" table.
Enable "PSQLEXTRA_ANNOTATE_SQL" within the database settings to enable this feature.
Enable "POSTGRES_EXTRA_ANNOTATE_SQL" within the database settings to enable this feature.
"""

if not getattr(settings, "PSQLEXTRA_ANNOTATE_SQL", None):
if not getattr(settings, "POSTGRES_EXTRA_ANNOTATE_SQL", None):
return sql

try:
Expand Down
8 changes: 4 additions & 4 deletions tests/test_append_caller_to_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def mockedFunction():
return append_caller_to_sql("sql")


@override_settings(PSQLEXTRA_ANNOTATE_SQL=False)
@override_settings(POSTGRES_EXTRA_ANNOTATE_SQL=False)
def test_disable_append_caller_to_sql():
commented_sql = mockedFunction()
assert commented_sql == "sql"
Expand All @@ -35,23 +35,23 @@ def test_disable_append_caller_to_sql():
psqlextraSimulated().callMockedClass,
],
)
@override_settings(PSQLEXTRA_ANNOTATE_SQL=True)
@override_settings(POSTGRES_EXTRA_ANNOTATE_SQL=True)
def test_append_caller_to_sql_class(entry_point):
commented_sql = entry_point()
assert commented_sql.startswith("sql /* ")
assert "mockedMethod" in commented_sql
assert __file__ in commented_sql


@override_settings(PSQLEXTRA_ANNOTATE_SQL=True)
@override_settings(POSTGRES_EXTRA_ANNOTATE_SQL=True)
def test_append_caller_to_sql_function():
commented_sql = mockedFunction()
assert commented_sql.startswith("sql /* ")
assert "mockedFunction" in commented_sql
assert __file__ in commented_sql


@override_settings(PSQLEXTRA_ANNOTATE_SQL=True)
@override_settings(POSTGRES_EXTRA_ANNOTATE_SQL=True)
def test_append_caller_to_sql_crud():
model = get_fake_model(
{
Expand Down
2 changes: 1 addition & 1 deletion tests/test_on_conflict.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


@pytest.mark.parametrize("conflict_action", ConflictAction.all())
@override_settings(PSQLEXTRA_ANNOTATE_SQL=True)
@override_settings(POSTGRES_EXTRA_ANNOTATE_SQL=True)
def test_on_conflict(conflict_action):
"""Tests whether simple inserts work correctly."""

Expand Down
2 changes: 1 addition & 1 deletion tests/test_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def test_query_hstore_value_update_escape():
assert inst.title.get("en") == "console.log('test')"


@override_settings(PSQLEXTRA_ANNOTATE_SQL=True)
@override_settings(POSTGRES_EXTRA_ANNOTATE_SQL=True)
def test_query_comment():
"""Tests whether the query is commented."""

Expand Down
2 changes: 1 addition & 1 deletion tests/test_view_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
@pytest.mark.parametrize(
"model_base", [PostgresViewModel, PostgresMaterializedViewModel]
)
@override_settings(PSQLEXTRA_ANNOTATE_SQL=True)
@override_settings(POSTGRES_EXTRA_ANNOTATE_SQL=True)
def test_view_model_meta_query_set(model_base):
"""Tests whether you can set a :see:QuerySet to be used as the underlying
query for a view."""
Expand Down

0 comments on commit 77dad7e

Please sign in to comment.