linux/tools/testing/kunit
Daniel Latypov 8a04930f2b 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>
2022-07-07 17:45:59 -06:00
..
configs kunit: tool: Add list of all valid test configs on UML 2022-05-16 13:23:33 -06:00
qemu_configs kunit: tool: Use qemu-system-i386 for i386 runs 2022-05-18 17:03:54 -06:00
test_data kunit: tool: make parser stop overwriting status of suites w/ no_tests 2022-05-16 13:22:12 -06:00
.gitignore .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
kunit_config.py kunit: tool: misc cleanups 2022-05-16 13:22:36 -06:00
kunit_json.py kunit: tool: misc cleanups 2022-05-16 13:22:36 -06:00
kunit_kernel.py kunit: tool: drop unused load_config argument 2022-07-07 17:45:36 -06:00
kunit_parser.py kunit: tool: misc cleanups 2022-05-16 13:22:36 -06:00
kunit_tool_test.py kunit: tool: redo how we construct and mock LinuxSourceTree 2022-07-07 17:45:59 -06:00
kunit.py kunit: tool: redo how we construct and mock LinuxSourceTree 2022-07-07 17:45:59 -06:00
qemu_config.py kunit: tool: drop last uses of collections.namedtuple 2022-04-04 14:25:53 -06:00
run_checks.py kunit: tool: misc cleanups 2022-05-16 13:22:36 -06:00