Skip to content

Commit 350bdce

Browse files
committed
docs: enable sphinx.ext.intersphinx
1 parent 2ed4bda commit 350bdce

File tree

2 files changed

+22
-13
lines changed

2 files changed

+22
-13
lines changed

docs/conf.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
'myst_parser',
2323
'sphinx.ext.autodoc',
2424
'sphinx.ext.napoleon',
25+
'sphinx.ext.intersphinx',
2526
'sphinx_copybutton',
2627
'sphinx_tabs.tabs',
2728
'sphinxcontrib.mermaid',
@@ -37,3 +38,11 @@
3738
html_logo = '_static/espressif-logo.svg'
3839
html_static_path = ['_static']
3940
html_theme = 'sphinx_rtd_theme'
41+
42+
# -- Options for intersphinx extension ---------------------------------------
43+
44+
intersphinx_mapping = {
45+
'python': ('https://docs.python.org/3', None),
46+
'pytest': ('https://docs.pytest.org/en/stable', None),
47+
'pexpect': ('https://pexpect.readthedocs.io/en/stable', None),
48+
}

docs/usages/expecting.rst

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ All of these functions share these possible keyword arguments:
1010

1111
Set the timeout in seconds for this expect statement. (Default: 30 s)
1212

13-
Will throw an ``pexpect.TIMEOUT`` exception if it exceeded the specified value.
13+
Will throw an :obj:`pexpect.TIMEOUT` exception if it exceeded the specified value.
1414

1515
- ``expect_all``.
1616

@@ -24,9 +24,9 @@ All of these functions share these possible keyword arguments:
2424
:func:`~pytest_embedded.dut.Dut.expect`
2525
*****************************************
2626

27-
``pattern`` can be ``str`` or ``bytes``, or a compiled regex with ``bytes``.
27+
``pattern`` can be :obj:`str` or :obj:`bytes`, or a compiled regex with :obj:`bytes`.
2828

29-
If the pattern is ``str`` or ``bytes``, it will convert to compiled regex with ``bytes`` and then run the function.
29+
If the pattern is :obj:`str` or :obj:`bytes`, it will convert to compiled regex with :obj:`bytes` and then run the function.
3030

3131
.. code:: python
3232
@@ -40,7 +40,7 @@ If the pattern is ``str`` or ``bytes``, it will convert to compiled regex with `
4040
dut.expect('[be]{2}')
4141
dut.expect(re.compile(b'redirected'))
4242
43-
If expecting success, the return value would be a ``re.Match`` object.
43+
If expecting success, the return value would be a :obj:`re.Match` object.
4444

4545
.. code:: python
4646
@@ -54,7 +54,7 @@ If expecting success, the return value would be a ``re.Match`` object.
5454
assert res.group(1) == b'would'
5555
assert res.group(2).decode('utf-8') == 'redirected'
5656
57-
You can get the bytes read before timeout by expecting a ``pexpect.TIMEOUT`` object
57+
You can get the bytes read before timeout by expecting a :obj:`pexpect.TIMEOUT` object.
5858

5959
.. code:: python
6060
@@ -74,7 +74,7 @@ You can get the bytes read before timeout by expecting a ``pexpect.TIMEOUT`` obj
7474
res = dut.expect(pexpect.TIMEOUT, timeout=3)
7575
assert res == b'11'
7676
77-
You can also get all bytes in the pexpect process buffer by expecting a ``pexpect.EOF`` object.
77+
You can also get all bytes in the pexpect process buffer by expecting a :obj:`pexpect.EOF` object.
7878

7979
.. code:: python
8080
@@ -92,7 +92,7 @@ You can also get all bytes in the pexpect process buffer by expecting a ``pexpec
9292
9393
.. note::
9494

95-
The pexpect process would only read from the process into the buffer when running expecting functions. If you're expecting ``pexpect.EOF`` as the first statement, it would return an empty byte string
95+
The pexpect process would only read from the process into the buffer when running expecting functions. If you're expecting :obj:`pexpect.EOF` as the first statement, it would return an empty byte string
9696

9797
.. code:: python
9898
@@ -108,7 +108,7 @@ You can also get all bytes in the pexpect process buffer by expecting a ``pexpec
108108
res = dut.expect(pexpect.EOF, timeout=None)
109109
assert res == b""
110110
111-
What's more, argument `pattern` could be a list of all supported types.
111+
What's more, argument ``pattern`` could be a list of all supported types.
112112

113113
.. code:: python
114114
@@ -128,15 +128,15 @@ What's more, argument `pattern` could be a list of all supported types.
128128
for _ in range(4):
129129
dut.expect(pattern_list)
130130
131-
If you set ``expect_all`` to ``True``, the ``expect()`` function would return with a list of returned values of each item.
131+
If you set ``expect_all`` to ``True``, the :func:`~pytest_embedded.dut.Dut.expect` function would return with a list of returned values of each item.
132132

133133
***********************************************
134134
:func:`~pytest_embedded.dut.Dut.expect_exact`
135135
***********************************************
136136

137-
``pattern`` can be ``str`` or ``bytes``.
137+
``pattern`` can be :obj:`str` or :obj:`bytes`.
138138

139-
If the pattern is ``str``, would convert to ``bytes`` and then run the function.
139+
If the pattern is :obj:`str`, would convert to :obj:`bytes` and then run the function.
140140

141141
.. code:: python
142142
@@ -146,7 +146,7 @@ If the pattern is ``str``, would convert to ``bytes`` and then run the function.
146146
dut.expect_exact('this would')
147147
dut.expect_exact(b'be redirected')
148148
149-
Same as ``expect(pattern, **kwargs)``, argument ``pattern`` could be a list of all supported types.
149+
Same as :func:`~pytest_embedded.dut.Dut.expect` function, argument ``pattern`` could be a list of all supported types.
150150

151151
.. code:: python
152152
@@ -169,7 +169,7 @@ Same as ``expect(pattern, **kwargs)``, argument ``pattern`` could be a list of a
169169

170170
This function would parse the output as the unity output. The default value of ``timeout`` is 60 seconds.
171171

172-
When the test script ends, the DUT object would raise ``AssertionError`` if any unity test case’s result is “FAIL”.
172+
When the test script ends, the DUT object would raise :obj:`AssertionError` if any unity test case’s result is “FAIL”.
173173

174174
What’s more, it would dump the junit report under a temp folder and would combine the junit report into the main one if you use ``pytest --junitxml`` feature.
175175

0 commit comments

Comments
 (0)