[issue44430] [sqlite3] refactor threading tests

2021-06-20 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 5f0fc30de46d41dccf04096df12664fc0a684ca2 by Erlend Egeberg 
Aasland in branch 'main':
bpo-44430: Refactor `sqlite3` threading tests (GH-26748)
https://github.com/python/cpython/commit/5f0fc30de46d41dccf04096df12664fc0a684ca2


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44430] [sqlite3] refactor threading tests

2021-06-20 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44430] [sqlite3] refactor threading tests

2021-06-16 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

The current code duplication has several negative impacts, IMO:

- Readability
  Currently the ThreadTests class spans 173 lines. Refactored, it spans 51 
lines (should fit in a screenful), making it easy to see what's actually being 
tested.
  Currently, the tests differ by only one line; the remaining 15 lines are 
boilerplate code. That's 15 lines of boilerplate code per test method.

- Maintainability
  Currently, if the boilerplate code needs tuning (or bugfixing), we must 
adjust it in _all_ the test methods. For example, adding the 
@threading_helper.reap_threads decorator to every single test. After 
refactoring, the boilerplate code is refactored out; adding the reap threads 
decorator needs only be done in one place; modifying the boilerplate code needs 
only be done in one place.

- Fewer lines of code; improved maintainability
  diff stat:
1 file changed, 37 insertions(+), 140 deletions(-)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44430] [sqlite3] refactor threading tests

2021-06-15 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
keywords: +patch
pull_requests: +25333
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/26748

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44430] [sqlite3] refactor threading tests

2021-06-15 Thread Erlend E. Aasland


New submission from Erlend E. Aasland :

The threading tests (ThreadTests) in Lib/sqlite3/test/dbapi.py has a lot of 
code duplication, and none of the test methods use the 
test.support.threading_helper.reap_threads helper. Also, some branches are not 
covered by this test class. Suggesting the following:

1. Rewrite ThreadTests with a _run_test() helper method that does the heavy 
lifting
2. Add test.support.threading_helper.reap_threads to _run_test()
3. Use _run_test() in all threading tests
4. Add test case for sqlite3.Connection.set_trace_callback
5. Add test case for sqlite3.Connection.create_collation

--
assignee: erlendaasland
components: Tests
messages: 395901
nosy: erlendaasland, pablogsal
priority: low
severity: normal
status: open
title: [sqlite3] refactor threading tests
type: enhancement
versions: Python 3.11

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com