Skip to content

add tests for profiler.FunctionLogger.log_data #5

Description

@Datamine

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.

Activity

  1. Datamine commented on Feb 19, 2017

    @Datamine
    OwnerAuthor

    Update: since make_output_string has been extracted from log_data and tested reasonably thoroughly, the only testable features remaining for log_data are the call_freq and call_times assignments. But these variable assignments don't seem as if they need to be tested (the logic is unambiguous).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions