Skip to content

Commit

Permalink
update result call return value doc; address review comment
Browse files Browse the repository at this point in the history
  • Loading branch information
zhenyu-ms committed Aug 30, 2024
1 parent 59b0897 commit f15ef32
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
12 changes: 6 additions & 6 deletions doc/en/assertions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.')
Expand Down
15 changes: 10 additions & 5 deletions doc/en/interactive.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://docs.python.org/3/library/modulefinder.html#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:
Expand Down

0 comments on commit f15ef32

Please sign in to comment.