From f15ef32fb1ff6bb06819b26c5988afdc4de2c893 Mon Sep 17 00:00:00 2001 From: zhenyu-ms <111329301+zhenyu-ms@users.noreply.github.com> Date: Fri, 30 Aug 2024 18:12:28 +0800 Subject: [PATCH] update result call return value doc; address review comment --- doc/en/assertions.rst | 12 ++++++------ doc/en/interactive.rst | 15 ++++++++++----- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/doc/en/assertions.rst b/doc/en/assertions.rst index e22ca4e3c..a5dcafcf2 100644 --- a/doc/en/assertions.rst +++ b/doc/en/assertions.rst @@ -25,16 +25,16 @@ a testcase, because it avoids the typical problem of fixing one assertion simply to find another one later on. If some assertions rely on the result of previous ones and does not make sense -to be executed if the previous failed, their boolean return values can be used -like this example: +to be executed if the previous failed, the ``passed`` attribute of the returned +assertion entry can be used like this example: .. code-block:: python @testcase def sample_testcase(self, env, result): item = get_item() - passed = result.true(isinstance(item, dict), description='Check if dict') - if passed is True: + entry = result.true(isinstance(item, dict), description='Check if dict') + if entry.passed is True: result.contain('key', item.keys(), description='.keys() used') If the test should be stopped on an assertion failure, an exception can be raised @@ -44,9 +44,9 @@ or use a *return* statement like this example: @testcase def sample_testcase(self, env, result): - passed = result.true(isinstance(5, float), description='Check if float') + entry = result.true(isinstance(5, float), description='Check if float') - if passed is False: + if entry.passed is False: raise RuntimeError('5 is not a float.') # Or result.log('5 is not a float. Aborting testcase.') diff --git a/doc/en/interactive.rst b/doc/en/interactive.rst index 380200a3b..6971b5bd8 100644 --- a/doc/en/interactive.rst +++ b/doc/en/interactive.rst @@ -74,11 +74,16 @@ circumstances. the same time, if the modules from which tasks are scheduled have the same name, they won't be reloaded properly. * `modulefinder.ModuleFinder `_ - works purely on static analysis, which means it is completely ignorant of any - programmatic imports as well as imports requiring ``sys.path`` manipulation. - As a result, such dependencies may not be reloaded. In these cases, user may - need to use the ``extra_deps`` parameter of the ``@test_plan`` decorator to - specify these dependencies. + works purely on static analysis, which means it can handle the following cases + in the current module: + + * Absolute import from the top-level package containing the current module. + * Relative import from the current module to its sibling modules. + + It is completely ignorant of any programmatic import as well as import + requiring ``sys.path`` manipulation. Such dependencies will not be included + in the graph thus not reloaded. User can use the ``extra_deps`` parameter of + the ``@test_plan`` decorator to specify these dependencies manually. .. _Interactive_UI: