chromite: Remove cros_import usages.
The module is made obsolete by importlib. Use that instead.
BUG=None
TEST=run_tests
TEST=Ran examples in scripts/wrapper:FindTarget, except used a
random unittest instead of cbuildbot for the examples where
that one was used.
Change-Id: Icb793cf79a696085e3917df839cbb7c924c5a608
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/1965680
Tested-by: Alex Klein <saklein@chromium.org>
Commit-Queue: Alex Klein <saklein@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
diff --git a/cli/command_unittest.py b/cli/command_unittest.py
index a828900..1e198af 100644
--- a/cli/command_unittest.py
+++ b/cli/command_unittest.py
@@ -8,11 +8,11 @@
from __future__ import print_function
import argparse
+import importlib
import os
from chromite.cli import command
from chromite.lib import commandline
-from chromite.lib import cros_import
from chromite.lib import cros_test_lib
from chromite.lib import partial_mock
@@ -107,10 +107,10 @@
def testLoadCommands(self):
"""Tests import commands correctly."""
fake_module = 'cros_command_test'
- module_path = ['chromite', 'cli', 'cros', fake_module]
+ module_path = 'chromite.cli.cros.%s' % fake_module
# The code doesn't use the return value, so stub it out lazy-like.
- load_mock = self.PatchObject(cros_import, 'ImportModule', return_value=None)
+ load_mock = self.PatchObject(importlib, 'import_module', return_value=None)
command._commands['command-test'] = 123
self.assertEqual(command.ImportCommand('command-test'), 123)