File tree 2 files changed +62
-0
lines changed 2 files changed +62
-0
lines changed Original file line number Diff line number Diff line change
1
+ """
2
+ A module that imports objects from the standard library.
3
+ """
4
+ from pathlib import Path
5
+ from datetime import time
6
+
7
+
8
+ def add (a , b ):
9
+ """
10
+ Add two numbers
11
+ """
12
+ return a + b
Original file line number Diff line number Diff line change @@ -327,6 +327,56 @@ def test_am_replacer_skip(tmpdir):
327
327
assert result == am_replacer_skip_expected
328
328
329
329
330
+ am_replacer_skip_stdlib_str = """
331
+ This comes before
332
+
333
+ .. automodapi:: sphinx_automodapi.tests.example_module.stdlib
334
+ :skip: time
335
+ :skip: Path
336
+
337
+ This comes after
338
+ """
339
+
340
+
341
+ am_replacer_skip_stdlib_expected = """
342
+ This comes before
343
+
344
+
345
+ sphinx_automodapi.tests.example_module.stdlib Module
346
+ ----------------------------------------------------
347
+
348
+ .. automodule:: sphinx_automodapi.tests.example_module.stdlib
349
+
350
+ Functions
351
+ ^^^^^^^^^
352
+
353
+ .. automodsumm:: sphinx_automodapi.tests.example_module.stdlib
354
+ :functions-only:
355
+ :toctree: api
356
+ :skip: time,Path
357
+
358
+
359
+ This comes after
360
+ """ .format (empty = '' )
361
+
362
+
363
+ def test_am_replacer_skip_stdlib (tmpdir ):
364
+ """
365
+ Tests using the ":skip:" option in an ".. automodapi::"
366
+ that skips objects imported from the standard library.
367
+ """
368
+
369
+ with open (tmpdir .join ('index.rst' ).strpath , 'w' ) as f :
370
+ f .write (am_replacer_skip_stdlib_str .format (options = '' ))
371
+
372
+ run_sphinx_in_tmpdir (tmpdir )
373
+
374
+ with open (tmpdir .join ('index.rst.automodapi' ).strpath ) as f :
375
+ result = f .read ()
376
+
377
+ assert result == am_replacer_skip_stdlib_expected
378
+
379
+
330
380
am_replacer_include_str = """
331
381
This comes before
332
382
You can’t perform that action at this time.
0 commit comments