diff options
-rwxr-xr-x | util/ec3po/console_unittest.py | 8 | ||||
-rwxr-xr-x | util/ec3po/interpreter_unittest.py | 6 | ||||
-rwxr-xr-x | util/ec3po/run_tests.sh | 12 |
3 files changed, 16 insertions, 10 deletions
diff --git a/util/ec3po/console_unittest.py b/util/ec3po/console_unittest.py index 1555a92bc5..912ebfb26d 100755 --- a/util/ec3po/console_unittest.py +++ b/util/ec3po/console_unittest.py @@ -1078,7 +1078,7 @@ class TestConsoleCompatibility(unittest.TestCase): tempfile.TemporaryFile(), mock_pipe_end_0, mock_pipe_end_1, "EC") - @mock.patch('console.Console.CheckForEnhancedECImage') + @mock.patch('ec3po.console.Console.CheckForEnhancedECImage') def test_ActAsPassThruInNonEnhancedMode(self, mock_check): """Verify we simply pass everything thru to non-enhanced ECs. @@ -1124,7 +1124,7 @@ class TestConsoleCompatibility(unittest.TestCase): CheckInputBuffer(self, b'') CheckInputBufferPosition(self, 0) - @mock.patch('console.Console.CheckForEnhancedECImage') + @mock.patch('ec3po.console.Console.CheckForEnhancedECImage') def test_TransitionFromNonEnhancedToEnhanced(self, mock_check): """Verify that we transition correctly to enhanced mode. @@ -1185,7 +1185,7 @@ class TestConsoleCompatibility(unittest.TestCase): # Verify all of the calls. self.console.cmd_pipe.send.assert_has_calls(expected_calls) - @mock.patch('console.Console.CheckForEnhancedECImage') + @mock.patch('ec3po.console.Console.CheckForEnhancedECImage') def test_TransitionFromEnhancedToNonEnhanced(self, mock_check): """Verify that we transition correctly to non-enhanced mode. @@ -1362,7 +1362,7 @@ class TestOOBMConsoleCommands(unittest.TestCase): mock_pipe_end_0, mock_pipe_end_1, "EC") self.console.oobm_queue = mock.MagicMock() - @mock.patch('console.Console.CheckForEnhancedECImage') + @mock.patch('ec3po.console.Console.CheckForEnhancedECImage') def test_InterrogateCommand(self, mock_check): """Verify that 'interrogate' command works as expected. 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. diff --git a/util/ec3po/run_tests.sh b/util/ec3po/run_tests.sh index 09e1a545d0..ba513abe30 100755 --- a/util/ec3po/run_tests.sh +++ b/util/ec3po/run_tests.sh @@ -4,6 +4,12 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -# Discover all the unit tests in the ec3po directory and run them. -python3 -m unittest discover -b -s util/ec3po/ -p "*_unittest.py" \ - && touch util/ec3po/.tests-passed +set -e + +my_dir="$(realpath -e -- "$(dirname -- "$0")")" +parent_dir="$(realpath -e -- "$my_dir/..")" + +PYTHONPATH="$parent_dir" python3 -s -m unittest \ + ec3po.console_unittest \ + ec3po.interpreter_unittest \ + && touch -- "$my_dir/.tests-passed" |