Re: [Django] #34111: Use sqlparse to format SQL in tests failures with debug flag

2022-10-24 Thread Django
#34111: Use sqlparse to format SQL in tests failures with debug flag
-+-
 Reporter:  Paolo Melchiorre |Owner:  Giebisch
 Type:  New feature  |   Status:  closed
Component:  Testing framework|  Version:  4.1
 Severity:  Normal   |   Resolution:  fixed
 Keywords:  sqlparse, sql,   | Triage Stage:  Ready for
  format, test   |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Mariusz Felisiak ):

 * status:  assigned => closed
 * resolution:   => fixed


Comment:

 In [changeset:"3283120cca5d5eba5c3619612d0de5ad49dcf054" 3283120c]:
 {{{
 #!CommitTicketReference repository=""
 revision="3283120cca5d5eba5c3619612d0de5ad49dcf054"
 Fixed #34111 -- Made test runner with --debug-sql format SQL queries.
 }}}

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018408cb9986-f3a0c1fd-a3d0-4c58-b397-8a09edcca60a-00%40eu-central-1.amazonses.com.


Re: [Django] #34111: Use sqlparse to format SQL in tests failures with debug flag

2022-10-24 Thread Django
#34111: Use sqlparse to format SQL in tests failures with debug flag
-+-
 Reporter:  Paolo Melchiorre |Owner:  Giebisch
 Type:  New feature  |   Status:  assigned
Component:  Testing framework|  Version:  4.1
 Severity:  Normal   |   Resolution:
 Keywords:  sqlparse, sql,   | Triage Stage:  Ready for
  format, test   |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Mariusz Felisiak):

 * stage:  Accepted => Ready for checkin


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018408a68012-5e189f2f-4339-4a5c-93dd-c2788515c2c7-00%40eu-central-1.amazonses.com.


Re: [Django] #34111: Use sqlparse to format SQL in tests failures with debug flag

2022-10-23 Thread Django
#34111: Use sqlparse to format SQL in tests failures with debug flag
-+-
 Reporter:  Paolo Melchiorre |Owner:  Giebisch
 Type:  New feature  |   Status:  assigned
Component:  Testing framework|  Version:  4.1
 Severity:  Normal   |   Resolution:
 Keywords:  sqlparse, sql,   | Triage Stage:  Accepted
  format, test   |
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Giebisch):

 Replying to [comment:8 Simon Charette]:
 > Thanks Giebisch, the patch looks great!
 >
 > Do you think you could also add a mention of the new feature in
 
[https://github.com/django/django/blob/5ec64fa481892747ee5ce7ec13584cc4fe53b857/docs/releases/4.2.txt#L261-L264
 the Tests] section of the 4.2 release notes?

 Sure thing, done!

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018406258cee-297b3d8b-92af-457c-952d-c9d46565009d-00%40eu-central-1.amazonses.com.


Re: [Django] #34111: Use sqlparse to format SQL in tests failures with debug flag

2022-10-23 Thread Django
#34111: Use sqlparse to format SQL in tests failures with debug flag
-+-
 Reporter:  Paolo Melchiorre |Owner:  Giebisch
 Type:  New feature  |   Status:  assigned
Component:  Testing framework|  Version:  4.1
 Severity:  Normal   |   Resolution:
 Keywords:  sqlparse, sql,   | Triage Stage:  Accepted
  format, test   |
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Simon Charette):

 Thanks Giebisch, the patch looks great!

 Do you think you could also add a mention of the new feature in
 
[https://github.com/django/django/blob/5ec64fa481892747ee5ce7ec13584cc4fe53b857/docs/releases/4.2.txt#L261-L264
 the Tests] section of the 4.2 release notes?

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070184060527b1-b18b68b7-36a9-408f-9a62-1c6dfa3498f7-00%40eu-central-1.amazonses.com.


Re: [Django] #34111: Use sqlparse to format SQL in tests failures with debug flag

2022-10-23 Thread Django
#34111: Use sqlparse to format SQL in tests failures with debug flag
-+-
 Reporter:  Paolo Melchiorre |Owner:  Giebisch
 Type:  New feature  |   Status:  assigned
Component:  Testing framework|  Version:  4.1
 Severity:  Normal   |   Resolution:
 Keywords:  sqlparse, sql,   | Triage Stage:  Accepted
  format, test   |
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Giebisch):

 * needs_better_patch:  1 => 0


Comment:

 Replying to [comment:5 Simon Charette]:
 > Thanks for the patch Giebisch!
 >
 > Left a comment for improvement to the tests, please uncheck ''patch
 needs improvement'' when they are addressed so the patch appears in the
 review queue.

 I've just updated the code, hope this is what you had in mind. Hope to
 contribute more in the near future!

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070184051bb2e1-c0a6bb7f-b532-4587-ab74-96675f8365e6-00%40eu-central-1.amazonses.com.


Re: [Django] #34111: Use sqlparse to format SQL in tests failures with debug flag

2022-10-21 Thread Django
#34111: Use sqlparse to format SQL in tests failures with debug flag
-+-
 Reporter:  Paolo Melchiorre |Owner:  Giebisch
 Type:  New feature  |   Status:  assigned
Component:  Testing framework|  Version:  4.1
 Severity:  Normal   |   Resolution:
 Keywords:  sqlparse, sql,   | Triage Stage:  Accepted
  format, test   |
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Giebisch):

 Replying to [comment:5 Simon Charette]:
 > Thanks for the patch Giebisch!
 >
 > Left a comment for improvement to the tests, please uncheck ''patch
 needs improvement'' when they are addressed so the patch appears in the
 review queue.

 Thanks for the fast feedback! You are actually right. I'll update the code
 this weekend :)

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070183fb9d60d8-75c4462a-c2a6-46f6-aa26-d6e11426f7ba-00%40eu-central-1.amazonses.com.


Re: [Django] #34111: Use sqlparse to format SQL in tests failures with debug flag

2022-10-21 Thread Django
#34111: Use sqlparse to format SQL in tests failures with debug flag
-+-
 Reporter:  Paolo Melchiorre |Owner:  Giebisch
 Type:  New feature  |   Status:  assigned
Component:  Testing framework|  Version:  4.1
 Severity:  Normal   |   Resolution:
 Keywords:  sqlparse, sql,   | Triage Stage:  Accepted
  format, test   |
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Simon Charette):

 * needs_better_patch:  0 => 1


Comment:

 Thanks for the patch Giebisch!

 Left a comment for improvement to the tests, please uncheck ''patch needs
 improvement'' when they are addressed so the patch appears in the review
 queue.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070183fae7bded-344283af-2f6c-4572-8983-3f87f45a5cc9-00%40eu-central-1.amazonses.com.


Re: [Django] #34111: Use sqlparse to format SQL in tests failures with debug flag

2022-10-21 Thread Django
#34111: Use sqlparse to format SQL in tests failures with debug flag
-+-
 Reporter:  Paolo Melchiorre |Owner:  Giebisch
 Type:  New feature  |   Status:  assigned
Component:  Testing framework|  Version:  4.1
 Severity:  Normal   |   Resolution:
 Keywords:  sqlparse, sql,   | Triage Stage:  Accepted
  format, test   |
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Giebisch):

 * has_patch:  0 => 1


Comment:

 PR https://github.com/django/django/pull/16217 has been created

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070183f9941df0-c6d5db08-5f22-44b6-b4c2-fff6b2bfd6b1-00%40eu-central-1.amazonses.com.


Re: [Django] #34111: Use sqlparse to format SQL in tests failures with debug flag

2022-10-20 Thread Django
#34111: Use sqlparse to format SQL in tests failures with debug flag
-+-
 Reporter:  Paolo Melchiorre |Owner:  Giebisch
 Type:  New feature  |   Status:  assigned
Component:  Testing framework|  Version:  4.1
 Severity:  Normal   |   Resolution:
 Keywords:  sqlparse, sql,   | Triage Stage:  Accepted
  format, test   |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Simon Charette):

 * cc: Simon Charette (added)


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070183f798dd0a-7a80b0c1-7b8c-46cd-bd80-d6f386a40ce4-00%40eu-central-1.amazonses.com.


Re: [Django] #34111: Use sqlparse to format SQL in tests failures with debug flag

2022-10-20 Thread Django
#34111: Use sqlparse to format SQL in tests failures with debug flag
-+-
 Reporter:  Paolo Melchiorre |Owner:  Giebisch
 Type:  New feature  |   Status:  assigned
Component:  Testing framework|  Version:  4.1
 Severity:  Normal   |   Resolution:
 Keywords:  sqlparse, sql,   | Triage Stage:  Accepted
  format, test   |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Giebisch):

 * owner:  nobody => Giebisch
 * status:  new => assigned


Comment:

 Sounds good, I'll get on it

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070183f74cadd5-3ecfc866-44f6-4509-a792-243ecc9edaf9-00%40eu-central-1.amazonses.com.


Re: [Django] #34111: Use sqlparse to format SQL in tests failures with debug flag

2022-10-20 Thread Django
#34111: Use sqlparse to format SQL in tests failures with debug flag
-+-
 Reporter:  Paolo Melchiorre |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Testing framework|  Version:  4.1
 Severity:  Normal   |   Resolution:
 Keywords:  sqlparse, sql,   | Triage Stage:  Accepted
  format, test   |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Mariusz Felisiak):

 * stage:  Unreviewed => Accepted


Comment:

 Sounds good, thanks.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070183f745ab55-c05ae64e-f767-4612-aac7-f8adec7563a6-00%40eu-central-1.amazonses.com.


[Django] #34111: Use sqlparse to format SQL in tests failures with debug flag

2022-10-20 Thread Django
#34111: Use sqlparse to format SQL in tests failures with debug flag
-+-
   Reporter:  Paolo  |  Owner:  nobody
  Melchiorre |
   Type:  New| Status:  new
  feature|
  Component:  Testing|Version:  4.1
  framework  |   Keywords:  sqlparse, sql,
   Severity:  Normal |  format, test
   Triage Stage: |  Has patch:  0
  Unreviewed |
Needs documentation:  0  |Needs tests:  0
Patch needs improvement:  0  |  Easy pickings:  0
  UI/UX:  0  |
-+-
 Running test with `--debug` flag that generate errors print unformatted
 SQL code that need to be formatted to read it properly and figuring out
 what's not working.

 sqlparse is already a dependency so can be very useful to format that SQL
 code in the traceback with it.

 Example of test failure that generate unformatted SQL code:


 {{{
 $ ./runtests.py --settings=postgres --timing --parallel=1
 aggregation.tests.AggregateTestCase.test_aggregation_exists_multivalued_outeref
 --debug-sql
 Testing against Django installed in '/home/paulox/Projects/django/django'
 Found 1 test(s).
 Creating test database for alias 'default'...
 System check identified no issues (0 silenced).
 E
 ==
 ERROR: test_aggregation_exists_multivalued_outeref
 (aggregation.tests.AggregateTestCase)
 --
 Traceback (most recent call last):
   File "/home/paulox/Projects/django/django/db/backends/utils.py", line
 89, in _execute
 return self.cursor.execute(sql, params)
   File "/home/paulox/.virtualenvs/django/lib/python3.10/site-
 packages/psycopg/cursor.py", line 725, in execute
 raise ex.with_traceback(None)
 psycopg.errors.GroupingError: subquery uses ungrouped column
 "aggregation_book.publisher_id" from outer query
 LINE 1: ... "aggregation_book" U0 WHERE U0."publisher_id" = ("aggregati...
  ^

 The above exception was the direct cause of the following exception:

 Traceback (most recent call last):
   File "/home/paulox/Projects/django/tests/aggregation/tests.py", line
 1667, in test_aggregation_exists_multivalued_outeref
 self.assertCountEqual(
   File "/usr/lib/python3.10/unittest/case.py", line 1188, in
 assertCountEqual
 first_seq, second_seq = list(first), list(second)
   File "/home/paulox/Projects/django/django/db/models/query.py", line 394,
 in __iter__
 self._fetch_all()
   File "/home/paulox/Projects/django/django/db/models/query.py", line
 1876, in _fetch_all
 self._result_cache = list(self._iterable_class(self))
   File "/home/paulox/Projects/django/django/db/models/query.py", line 87,
 in __iter__
 results = compiler.execute_sql(
   File "/home/paulox/Projects/django/django/db/models/sql/compiler.py",
 line 1518, in execute_sql
 cursor.execute(sql, params)
   File "/home/paulox/Projects/django/django/db/backends/utils.py", line
 103, in execute
 return super().execute(sql, params)
   File "/home/paulox/Projects/django/django/db/backends/utils.py", line
 67, in execute
 return self._execute_with_wrappers(
   File "/home/paulox/Projects/django/django/db/backends/utils.py", line
 80, in _execute_with_wrappers
 return executor(sql, params, many, context)
   File "/home/paulox/Projects/django/django/db/backends/utils.py", line
 84, in _execute
 with self.db.wrap_database_errors:
   File "/home/paulox/Projects/django/django/db/utils.py", line 91, in
 __exit__
 raise dj_exc_value.with_traceback(traceback) from exc_value
   File "/home/paulox/Projects/django/django/db/backends/utils.py", line
 89, in _execute
 return self.cursor.execute(sql, params)
   File "/home/paulox/.virtualenvs/django/lib/python3.10/site-
 packages/psycopg/cursor.py", line 725, in execute
 raise ex.with_traceback(None)
 django.db.utils.ProgrammingError: subquery uses ungrouped column
 "aggregation_book.publisher_id" from outer query
 LINE 1: ... "aggregation_book" U0 WHERE U0."publisher_id" = ("aggregati...
  ^

 --
 (0.000) SELECT "aggregation_publisher"."id",
 "aggregation_publisher"."name", "aggregation_publisher"."num_awards",
 "aggregation_publisher"."duration", EXISTS(SELECT 1 AS "a" FROM
 "aggregation_book" U0 WHERE U0."publisher_id" =
 ("aggregation_book"."publisher_id") LIMIT 1) AS "books_exists",
 COUNT("aggregation_book"."id") AS "books_count" FROM
 "aggregation_publisher" LEFT OUTER JOIN "aggregation_book" ON