Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add tests for profiler.FunctionLogger.log_data #5

Open
Datamine opened this issue Feb 18, 2017 · 1 comment
Open

add tests for profiler.FunctionLogger.log_data #5

Datamine opened this issue Feb 18, 2017 · 1 comment

Comments

@Datamine
Copy link
Owner

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
Copy link
Owner Author

Datamine commented Feb 19, 2017

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant