◐ Shell
clean mode source ↗

bpo-44165: Add tests for sqlite3 SQL string length by erlend-aasland · Pull Request #26485 · python/cpython

@erlend-aasland

This slows down the sqlite3 tests considerably:

# with this PR
$ ./python.exe -m test test_sqlite
0:00:00 load avg: 2.67 Run tests sequentially
0:00:00 load avg: 2.67 [1/1] test_sqlite

== Tests result: SUCCESS ==

1 test OK.

Total duration: 10.6 sec
Tests result: SUCCESS

# without this PR
$ ./python.exe -m test test_sqlite
0:00:00 load avg: 2.14 Run tests sequentially
0:00:00 load avg: 2.14 [1/1] test_sqlite

== Tests result: SUCCESS ==

1 test OK.

Total duration: 1.3 sec
Tests result: SUCCESS

I tried to mock the string length, but was unable to do so. What do you think, @pablogsal?

Erlend E. Aasland added 3 commits

June 2, 2021 15:57

@erlend-aasland

Test time reduced with ~5 seconds after 3687fea, but it's still a massive slow-down.

@pablogsal

This slows down the sqlite3 tests considerably:

Oh :( I thought this was going to be faster. I think that 5 seconds is quite expensive for this check in particular. Unfortunately there is no easy way to go around PyUnicode_AsUTF8AndSize even with subclasses. Well, then I assume we would need to proceed without the extra tests. Sorry for the inconvenience

@erlend-aasland

No problem, it was a nice little excercise :) Perhaps we could disable it by default and use some kind of flag to decide if to run it?

@pablogsal

No problem, it was a nice little excercise :) Perhaps we could disable it by default and use some kind of flag to decide if to run it?

I was thinking about that but given si just checking this code path I am still not super enthusiastic. Normally those kind of test with -u test behaviour