|
2 | 2 | import unittest |
3 | 3 | from datetime import datetime, timedelta |
4 | 4 | from pathlib import Path |
| 5 | +from unittest import mock |
5 | 6 |
|
6 | 7 | from testsolar_testtool_sdk.model.param import EntryParam |
7 | 8 | from testsolar_testtool_sdk.model.testresult import ResultType, LogLevel |
8 | 9 | from testsolar_testtool_sdk.pipe_reader import read_test_result |
9 | 10 |
|
10 | | -from testsolar_pytestx.executor import run_testcases |
| 11 | +from testsolar_pytestx.executor import run_testcases, append_extra_args |
11 | 12 |
|
12 | 13 |
|
13 | 14 | def convert_to_datetime(raw: str) -> datetime: |
@@ -243,3 +244,21 @@ def test_run_datadrive_with_utf8_str(self): |
243 | 244 | end = read_test_result(pipe_io) |
244 | 245 | self.assertEqual(end.ResultType, ResultType.SUCCEED) |
245 | 246 | self.assertEqual(len(end.Steps), 3) |
| 247 | + |
| 248 | + def test_split_args_with_space(self): |
| 249 | + args = [] |
| 250 | + |
| 251 | + with mock.patch.dict( |
| 252 | + "os.environ", |
| 253 | + {"TESTSOLAR_TTP_EXTRAARGS": '-m "not p3" -t timeout -l "fast iu897 nuh"'}, |
| 254 | + clear=True, |
| 255 | + ): |
| 256 | + append_extra_args(args) |
| 257 | + |
| 258 | + self.assertEqual(len(args), 6) |
| 259 | + self.assertEqual(args[0], "-m") |
| 260 | + self.assertEqual(args[1], "not p3") |
| 261 | + self.assertEqual(args[2], "-t") |
| 262 | + self.assertEqual(args[3], "timeout") |
| 263 | + self.assertEqual(args[4], "-l") |
| 264 | + self.assertEqual(args[5], "fast iu897 nuh") |
0 commit comments