cscorley / whatthepatch

What The Patch!? -- A Python patch parsing library
MIT License
64 stars 24 forks source link

Improve huge_patch test #60

Closed arkamar closed 3 months ago

arkamar commented 4 months ago

The huge_patch test can fail in some python interpreters, e.g. pypy3 or python3.13 in my case, because text data preparation can take long time as it could be very memory intensive.

This PR addresses the issue with following two changes:

  1. Move start_time measurement to measure only the parsing time but not data preparation. In other words, test will pass even if the test data preparation will take long time.
  2. The test data are constructed from smaller parts with help of ''.join() method, which is more efficient because it minimizes the number of new string objects created.

The PR is related to https://github.com/cscorley/whatthepatch/pull/46 See also https://bugs.gentoo.org/907243

babenek commented 4 months ago

Agree. The test must check parse time.

cscorley commented 3 months ago

Looks good to me, thanks!

arkamar commented 3 months ago

@babenek, @cscorley, thanks!