Test Plan

Purpose

The System Requirements are tested by

The tests here concentrate on rstdoc.

Test Driver

There are only automatic tests.

pytest and tox are used to run the tests.

[tox]
envlist=py38
[testenv]
commands=
    py.test --doctest-modules --junit-xml=test.xml -k 'not test_with_images[rst_odt'
deps=
    gitpython
    txdir
    cffi
    cairocffi
    pillow
    pyx
    pyfca
    pygal
    cairosvg
    numpy
    matplotlib
    sympy
    pint
    pyyaml
    svgwrite
    drawsvg
    stpl
    pypandoc
    docutils
    sphinx
    sphinx_bootstrap_theme
    mock
    virtualenv
    pytest-coverage

To run tox, in the root folder, enter:

tox

To run pytest, in the root folder, enter:

py.test

To have a test coverage report, enter:

py.test --cov=rstdoc --cov-report term-missing

Test Coverage

The tests aim to produce 100% test coverage.

The current test coverage is this.

============================= test session starts ==============================
platform linux -- Python 3.10.9, pytest-7.2.0, pluggy-1.0.0
rootdir: /home/roland/mine/rstdoc, configfile: pytest.ini
plugins: toolbox-0.4, Flask-Dance-6.2.0, anyio-3.6.2, mock-3.10.0, xonsh-0.13.3, cov-4.0.0
collected 518 items

rstdoc/dcx.py .....................                                      [  4%]
rstdoc/reflow.py .                                                       [  4%]
rstdoc/retable.py ..                                                     [  4%]
test/test_dcx.py ....................................................... [ 15%]
........................................................................ [ 29%]
........................................................................ [ 43%]
........................................................................ [ 56%]
........................................................................ [ 70%]
........................................................................ [ 84%]
............................                                             [ 90%]
test/test_fromdocx.py .                                                  [ 90%]
test/test_rst_tables.py ..................................               [ 96%]
test/test_unretable.py ................                                  [100%]

---------- coverage: platform linux, python 3.10.9-final-0 -----------
Name                  Stmts   Miss  Cover   Missing
---------------------------------------------------
rstdoc/__init__.py        2      0   100%
rstdoc/dcx.py          2116    202    90%   50-51, 55-56, 59-60, 278-279, 283-284, 289-291, 296-297, 313-318, 353-354, 734-736, 741, 786, 790-791, 799, 802, 835, 867-872, 896, 951, 1014, 1028-1029, 1130, 1149, 1156, 1158-1160, 1178-1179, 1220-1221, 1231-1232, 1265, 1277-1279, 1304-1305, 1337-1338, 1461-1463, 1618-1620, 1628-1629, 1639-1640, 1670, 1679, 1693-1694, 1700-1701, 1919-1920, 1926-1927, 1945, 1954, 2021, 2177-2178, 2182, 2206-2207, 2461, 2532, 2550, 2565-2569, 2588, 2593, 2595, 2717, 2754-2756, 2816-2818, 2826-2834, 2853, 2904-2905, 2934, 2955-2957, 3038, 3089, 3101, 3179, 3328, 3386, 3509-3510, 3525-3526, 3570, 3803-3809, 3848-3881, 3921, 3935, 3994, 4004, 4008-4013, 4153-4154, 4164-4171, 6402, 6476-6477, 6492-6493, 6726-6727, 6756, 6770, 6779, 6800-6801, 6804
rstdoc/fromdocx.py      164    135    18%   83-86, 90, 94-95, 99, 110-134, 139-142, 147-159, 164-180, 185-206, 211-213, 228-304, 323-333, 337
rstdoc/listtable.py     107     11    90%   211-233, 236, 252-254, 263
rstdoc/reflow.py        167     14    92%   365-395, 398, 400, 402, 416-418, 427
rstdoc/reimg.py          83     14    83%   120-122, 150-164, 167, 181-183, 187, 196
rstdoc/retable.py       267     30    89%   238, 318-319, 425, 486-528, 532
rstdoc/untable.py       131     13    90%   88, 102-103, 243-259, 262, 275-277, 287
rstdoc/wafw.py           86     58    33%   36-41, 47-55, 60-63, 70-84, 88-95, 98-107, 111-114, 117-128
---------------------------------------------------
TOTAL                  3123    477    85%


======================= 518 passed in 1271.21s (0:21:11) =======================

Tests

rstdcx, dcx.py

test_lnkname:

Test the extraction of the name for different kinds of targets:

header, figure, list-table, table,
code-block, code, math, definition (:id:)
test_dcx_regex:

Test the regular expressions used in dcx.py.

test_rstincluded:
 

Tests dcx.rstincluded.

test_init:

Tests the initialization of a sample directory tree with the --stpl tmp or --rest tmp options.

test_dcx_alone_samples:
 

Tests calling rstdcx/dcx.py without parameters.

test_dcx_in_out:
 

Tests calling rstdcx/dcx.py with in-file or standard in to standard out.

test_dcx_out_file:
 

Tests calling rstdcx/dcx.py with in-file and out-file and out type parameter.

test_make_samples:
 

Tests building the samples with Makefile

test_waf_samples:
 

Tests running Waf on the sample projects.

test_docparts_after:
 

Tests dcx.doc_parts with different parameters for documentation extraction.

test_convert_with_images_no_outinfo:
 

Tests dcx.convert with images on the fly in rest.stpl files for different targets.

test_include_cmd:
 

Tests rstdcx with -I option and .rest.stpl files generating images on the fly and embedding for HTML and DOCX.

RST tables

These tests mostly originate from the history of vim-rst-tables.

testCreateTable:
 

Test retable.reformat_table by creating a grid table from lines where columns are separated by two blanks.

testReformatEmpty:
 

Tests retable.reformat_table with a table with an empty cell.

testReflowTable:
 

Tests retable.reflow_table with a table whose start line was reduced.

testReflowWithReplacements:
 

Tests retable.reflow_table with a table containing replacement substitutions with successive rows reduced in length.

testReflowWithLineBreak:
 

Tests retable.reflow_table with a successive line lengthened.

testReTitle:

Tests retable.re_title on a fixture file.

testCreateFromData:
 

Tests creation of table from data (retable.create_rst_table).