diff options
author | 2022-05-16 12:47:29 -0700 | |
---|---|---|
committer | 2022-07-07 17:45:59 -0600 | |
commit | 8a04930f2bb0047de4ae18af12e5731084bd555c (patch) | |
tree | 9446d29f6d21ebdc90f372261b604926be9de344 /tools/perf/scripts/python/export-to-postgresql.py | |
parent | kunit: tool: drop unused load_config argument (diff) | |
download | linux-dev-8a04930f2bb0047de4ae18af12e5731084bd555c.tar.xz linux-dev-8a04930f2bb0047de4ae18af12e5731084bd555c.zip |
kunit: tool: redo how we construct and mock LinuxSourceTree
Our main function currently has an optional `linux` argument which is
used to by our unit tests to inject a mock.
We currently have the same code copy-pasted several times to do
if not linux:
linux = MakeRealInstance(cli_args.foo, cli_args.bar, ...)
But in python, dependency injection isn't necessary or idiomatic when we
can just use mock.patch() to mock things out.
This change
1. adds a helper to create a LinuxSourceTree from the cli_args
2. drops the `linux` parameter in favor of mocking the __init__ func.
Signed-off-by: Daniel Latypov <dlatypov@google.com>
Reviewed-by: David Gow <davidgow@google.com>
Reviewed-by: Brendan Higgins <brendanhiggins@google.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Diffstat (limited to 'tools/perf/scripts/python/export-to-postgresql.py')
0 files changed, 0 insertions, 0 deletions