cf08ba1d39
* Fix issue with additional line breaks in ODT export * Improve format handling in ToOdt, and remove some unused code * Add test for tab in format * Add class to write text formats to XML * Simplify the XMLParagraph class a bit * Correct a breach of ODT standard and add error checking * Make some final corrections
novelWriter Tests
The test suite uses PyTest for testing.
Dependencies
python3-pytestfor the basic framework (required)python3-pytestqtfor Qt support (required)python3-pytest-covfor code coverage reports (optional)python3-pytest-xvfbfor headless tests (optional)
HowTo
Basic Usage
To run all tests, type:
pytest-3 -v
The -v switch enables verbose mode, with one test per line.
For a more compact view, omit this switch.
Headless
To run tests in headless mode, either use the Qt offscreen mode:
export QT_QPA_PLATFORM=offscreen
or run with xvfb:
xvfb-run pytest-3 -v
Test Coverage
To add test coverage, run the following:
pytest-3 -v --cov=nw --cov-report=html
The --cov-report switch generates an html report, omit it to print a coverage summary to the
terminal. The html coverage report will be available in the htmlcov folder.
Test Markers (Categories)
To run with specific test markers, add the -m switch:
pytest-3 -v -m core
Available markers are:
basefor unit tests covering the non-gui classes of thenwfolder..corefor unit tests covering the classes in thenw/corefolder.guifor unit and integrations tests covering the classes in thenw/guifolder.
You can filter tests further with the -k switch, all the way down to a single test. You can for
instance run only dialog tests with -k testDlg or tools with -k testTool.