Function-Profiler icon indicating copy to clipboard operation
Function-Profiler copied to clipboard

add tests for `profiler.FunctionLogger.log_data`

Open Datamine opened this issue 8 years ago • 1 comments

The problems with testing log_data are that:

  1. The logged times are system-dependent. It's possible to mock these times.
  2. The function fulfills several purposes: some logical checks, creating the statistical strings, and writing to some designated output. Unit-testing a function with so many effects is tedious and a bit of an anti-pattern. Maybe the log_data function should be broken up into a few more modular functions that are then easier to test.

Datamine avatar Feb 18 '17 23:02 Datamine