Fix typo. (#611)
diff --git a/mobly/test_runner.py b/mobly/test_runner.py
index 77db5cf..f67dede 100644
--- a/mobly/test_runner.py
+++ b/mobly/test_runner.py
@@ -74,7 +74,7 @@
for config in test_configs:
runner = TestRunner(log_dir=config.log_path,
test_bed_name=config.test_bed_name)
- with runner.mobly_loggger():
+ with runner.mobly_logger():
runner.add_test_class(config, test_class, tests)
try:
runner.run()
diff --git a/tests/mobly/test_runner_test.py b/tests/mobly/test_runner_test.py
index 0987454..e681dec 100755
--- a/tests/mobly/test_runner_test.py
+++ b/tests/mobly/test_runner_test.py
@@ -274,6 +274,41 @@
test_runner.main(['-c', 'some/path/foo.yaml', '-b', 'hello'])
mock_config.assert_called_with('some/path/foo.yaml', None)
+ @mock.patch('mobly.test_runner._find_test_class',
+ return_value=integration_test.IntegrationTest)
+ @mock.patch('sys.exit')
+ def test_main(self, mock_exit, mock_find_test):
+ tmp_file_path = os.path.join(self.tmp_dir, 'config.yml')
+ with io.open(tmp_file_path, 'w', encoding='utf-8') as f:
+ f.write(u"""
+ TestBeds:
+ # A test bed where adb will find Android devices.
+ - Name: SampleTestBed
+ Controllers:
+ MagicDevice: '*'
+ TestParams:
+ icecream: 42
+ extra_param: 'haha'
+ """)
+ test_runner.main(['-c', tmp_file_path])
+ mock_exit.assert_not_called()
+
+ @mock.patch('mobly.test_runner._find_test_class',
+ return_value=integration_test.IntegrationTest)
+ @mock.patch('sys.exit')
+ def test_main_with_failures(self, mock_exit, mock_find_test):
+ tmp_file_path = os.path.join(self.tmp_dir, 'config.yml')
+ with io.open(tmp_file_path, 'w', encoding='utf-8') as f:
+ f.write(u"""
+ TestBeds:
+ # A test bed where adb will find Android devices.
+ - Name: SampleTestBed
+ Controllers:
+ MagicDevice: '*'
+ """)
+ test_runner.main(['-c', tmp_file_path])
+ mock_exit.assert_called_once_with(1)
+
if __name__ == "__main__":
unittest.main()