diff options
author | Matthew Blecker <matthewb@chromium.org> | 2021-08-26 13:59:01 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-08-27 01:41:46 +0000 |
commit | 352e821faab88e59f2e60df23b671564de595827 (patch) | |
tree | 25a028e4da102089d2bc6b7a95b7e9c66771faad /util/ec3po/interpreter_unittest.py | |
parent | bc1eadcd1df76ee9d698a3ce531b422654760726 (diff) | |
download | chrome-ec-352e821faab88e59f2e60df23b671564de595827.tar.gz |
ec3po: Update unittests to use ec3po.<module> import paths.
run_tests.sh no longer uses the Python unittest module's discovery
functionality, which was forcing util/ec3po/ subdir to be directly in
sys.path as a top-level module location, which is inconsistent with how
ec3po modules are used outside of the tests.
run_tests.sh no longer auto-discovers *_unittest.py files, instead they
are individually listed as ec3po.<name>_unittest modules. It would be
straightforward to implement test module autodiscovery, but probably
isn't worth the complexity.
BRANCH=none
BUG=chromium:1031705,b:174894072,b:197618562
TEST=Within chroot, ran ./runtests.sh from within util/ec3po/ directory.
Within chroot, ran ~/trunk/src/platform/ec/util/ec3po/run_tests.sh from
a different directory.
Verified use of the files-under-test (as opposed to the files installed
in site-packages/) by adding broken code to console.py and then
re-running both invoctions above. Both then failed as intended.
Change-Id: I40c180f1d66a4d3befc548f4d763357e6cc24201
Signed-off-by: Matthew Blecker <matthewb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3123835
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'util/ec3po/interpreter_unittest.py')
-rwxr-xr-x | util/ec3po/interpreter_unittest.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/util/ec3po/interpreter_unittest.py b/util/ec3po/interpreter_unittest.py index 107800dd38..a243177b1b 100755 --- a/util/ec3po/interpreter_unittest.py +++ b/util/ec3po/interpreter_unittest.py @@ -54,7 +54,7 @@ class TestEnhancedECBehaviour(unittest.TestCase): log_level=logging.DEBUG, name="EC") - @mock.patch('interpreter.os') + @mock.patch('ec3po.interpreter.os') def test_HandlingCommandsThatProduceNoOutput(self, mock_os): """Verify that the Interpreter correctly handles non-output commands. @@ -119,7 +119,7 @@ class TestEnhancedECBehaviour(unittest.TestCase): # Finally, verify that the appropriate writes were actually sent to the EC. self.ec_uart_pty.assert_has_calls(expected_ec_calls) - @mock.patch('interpreter.os') + @mock.patch('ec3po.interpreter.os') def test_CommandRetryingOnError(self, mock_os): """Verify that commands are retried if an error is encountered. @@ -208,7 +208,7 @@ class TestEnhancedECBehaviour(unittest.TestCase): # Verify that PackCommand() was called. self.itpr.PackCommand.assert_not_called() - @mock.patch('interpreter.os') + @mock.patch('ec3po.interpreter.os') def test_KeepingTrackOfInterrogation(self, mock_os): """Verify that the interpreter can track the state of the interrogation. |