Remove dependencies on requirements files and generate when needed

This commit is contained in:
Veronica Berglyd Olsen
2025-10-22 21:11:20 +02:00
parent 0b79bcd4b4
commit 06cb128876
7 changed files with 93 additions and 50 deletions
+20 -15
View File
@@ -4,23 +4,12 @@
Running Tests
*************
.. _uv: https://docs.astral.sh/uv/
The novelWriter source code is well covered by tests. The test framework used for the development
is ``pytest`` with the use of an extension for Qt.
Dependencies
============
The dependencies for running the tests can be installed with:
.. code-block:: bash
pip install -r tests/requirements.txt
This will install a couple of extra packages for coverage and test management. The minimum
requirement is ``pytest`` and ``pytest-qt``.
Simple Test Run
===============
@@ -28,19 +17,35 @@ To run the tests, you simply need to execute the following from the root of the
.. code-block:: bash
pytest
uv run pytest
This uses uv_. See below for manually installing dependencies using ``pip``.
Since several of the tests involve opening up the novelWriter GUI, you may want to disable the GUI
for the duration of the test run. Moving your mouse while the tests are running may otherwise
interfere with the execution of some tests.
You can disable the renderring of the GUI by setting the flag ``QT_QPA_PLATFORM=offscreen``:
You can disable the rendering of the GUI by setting the flag ``QT_QPA_PLATFORM=offscreen``:
.. code-block:: bash
export QT_QPA_PLATFORM=offscreen pytest
Dependencies
------------
To run generate the requirements file and install using ``pip``, run:
.. code-block:: bash
python pkgutils.py gen-req app test
pip install -r tests/requirements.txt
This will install a couple of extra packages for coverage and test management. The minimum
requirement is ``pytest`` and ``pytest-qt``.
Advanced Options
================