From aa19cb1918a181f2af4760a3de095792d5e03bdc Mon Sep 17 00:00:00 2001
From: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com>
Date: Fri, 15 Sep 2023 22:28:03 -0400
Subject: [PATCH] docs: update unit testing (#99)
---
.readthedocs.yaml | 4 ++
.rstcheck.cfg | 8 ++++
docs/requirements.txt | 2 +
docs/source/about/installation.rst | 4 +-
docs/source/about/troubleshooting.rst | 2 +-
docs/source/about/usage.rst | 4 +-
docs/source/contributing/build.rst | 8 ++--
docs/source/contributing/database.rst | 2 +-
docs/source/contributing/testing.rst | 53 +++++++++++++++++++++++++++
docs/source/toc.rst | 1 +
requirements-dev.txt | 1 +
11 files changed, 79 insertions(+), 10 deletions(-)
create mode 100644 .rstcheck.cfg
create mode 100644 docs/source/contributing/testing.rst
diff --git a/.readthedocs.yaml b/.readthedocs.yaml
index 5415f08..ac3fe92 100644
--- a/.readthedocs.yaml
+++ b/.readthedocs.yaml
@@ -11,6 +11,10 @@ build:
os: ubuntu-20.04
tools:
python: "3.10"
+ jobs:
+ post_build:
+ - rstcheck -r . # lint rst files
+ # - rstfmt --check --diff -w 120 . # check rst formatting
# Build documentation in the docs/ directory with Sphinx
sphinx:
diff --git a/.rstcheck.cfg b/.rstcheck.cfg
new file mode 100644
index 0000000..fb16fa6
--- /dev/null
+++ b/.rstcheck.cfg
@@ -0,0 +1,8 @@
+# configuration file for rstcheck, an rst linting tool
+# https://rstcheck.readthedocs.io/en/latest/usage/config
+
+[rstcheck]
+ignore_directives =
+ include,
+ mdinclude,
+ todo,
diff --git a/docs/requirements.txt b/docs/requirements.txt
index 58a3eeb..b653327 100644
--- a/docs/requirements.txt
+++ b/docs/requirements.txt
@@ -1,4 +1,6 @@
furo==2023.9.10
m2r2==0.3.3.post2
+rstcheck[sphinx]==6.2.0
+rstfmt==0.0.14
Sphinx==7.2.6
sphinx-copybutton==0.5.2
diff --git a/docs/source/about/installation.rst b/docs/source/about/installation.rst
index 6837cbd..b6d3b9b 100644
--- a/docs/source/about/installation.rst
+++ b/docs/source/about/installation.rst
@@ -3,14 +3,14 @@ Installation
..
The recommended method for running Themerr-jellyfin is to add the `repository`_ to Jellyfin.
-.. Tip:: See `Jellyfin Plugins `_ for more information about
+.. Tip:: See `Jellyfin Plugins `__ for more information about
installing plugins.
..
Repository
----------
- #. In Jellyfin, go to ``_.
+ #. In Jellyfin, go to ``__.
#. Add the repository ``https://repo.lizardbyte.dev/jellyfin/manifest.json``.
#. Go to Catalog and search for `Themerr`.
#. Select and install the plugin.
diff --git a/docs/source/about/troubleshooting.rst b/docs/source/about/troubleshooting.rst
index bd7e5ec..29c27d8 100644
--- a/docs/source/about/troubleshooting.rst
+++ b/docs/source/about/troubleshooting.rst
@@ -7,7 +7,7 @@ Jellyfin Server Logs
Unfortunately, Jellyfin does not separate the logs by plugin. You will need to review the server logs.
The log location varies, depending on your environment. See
-`Jellyfin Server Logs `_ for more
+`Jellyfin Server Logs `__ for more
information.
.. Attention:: Before uploading logs, it would be wise to review the data in the log file. Themerr does not have
diff --git a/docs/source/about/usage.rst b/docs/source/about/usage.rst
index 9441dcc..b10cbed 100644
--- a/docs/source/about/usage.rst
+++ b/docs/source/about/usage.rst
@@ -24,12 +24,12 @@ Manual
To initialize a download task manually, follow these steps:
-#. Navigate to ``_.
+#. Navigate to ``__.
#. Select `Download Theme Songs`.
Or alternatively:
-#. Navigate to ``_.
+#. Navigate to ``__.
#. Select `Download Theme Songs` under the `Themerr` section.
Scheduled
diff --git a/docs/source/contributing/build.rst b/docs/source/contributing/build.rst
index 94ba288..3c33ab0 100644
--- a/docs/source/contributing/build.rst
+++ b/docs/source/contributing/build.rst
@@ -2,13 +2,13 @@ Build
=====
Compiling Themerr-jellyfin requires the following:
-- `git `_
-- `.net6.0 SDK `_
-- `python 3.x `_
+- `git `__
+- `.net6.0 SDK `__
+- `python 3.x `__
Clone
-----
-Ensure `git `_ is installed and run the following:
+Ensure `git `__ is installed and run the following:
.. code-block:: bash
diff --git a/docs/source/contributing/database.rst b/docs/source/contributing/database.rst
index 0cb5b98..eed2404 100644
--- a/docs/source/contributing/database.rst
+++ b/docs/source/contributing/database.rst
@@ -1,5 +1,5 @@
Database
========
-The database of themes is held in our `ThemerrDB `_ repository. To contribute
+The database of themes is held in our `ThemerrDB `__ repository. To contribute
to the database, follow the documentation there.
diff --git a/docs/source/contributing/testing.rst b/docs/source/contributing/testing.rst
new file mode 100644
index 0000000..19632d0
--- /dev/null
+++ b/docs/source/contributing/testing.rst
@@ -0,0 +1,53 @@
+Testing
+=======
+
+flake8
+------
+Themerr-jellyfin uses `flake8 `__ for enforcing consistent code styling. flake8 is
+included in the ``requirements-dev.txt``.
+
+The config file for flake8 is ``.flake8``. This is already included in the root of the repo and should not be modified.
+
+Test with flake8
+ .. code-block:: bash
+
+ python -m flake8
+
+Sphinx
+------
+Themerr-jellyfin uses `Sphinx `__ for documentation building. Sphinx, along with
+other required python dependencies are included in the `./docs/requirements.txt` file. Python is required to build
+sphinx docs. Installation and setup of python will not be covered here.
+
+.. todo::
+ Add documentation within C# code to be included in sphinx docs.
+
+The config file for Sphinx is ``docs/source/conf.py``. This is already included in the root of the repo and should not
+be modified.
+
+Test with Sphinx
+ .. code-block:: bash
+
+ cd docs
+ make html
+
+ Alternatively
+
+ .. code-block:: bash
+
+ cd docs
+ sphinx-build -b html source build
+
+Lint with rstcheck
+ .. code-block:: bash
+
+ rstcheck -r .
+
+Unit Testing
+------------
+Themerr-jellyfin uses `xUnit `__ for unit testing.
+
+Test with xUnit
+ .. code-block:: bash
+
+ dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
diff --git a/docs/source/toc.rst b/docs/source/toc.rst
index 74a08c7..e95620f 100644
--- a/docs/source/toc.rst
+++ b/docs/source/toc.rst
@@ -14,3 +14,4 @@
contributing/database
contributing/build
+ contributing/testing
diff --git a/requirements-dev.txt b/requirements-dev.txt
index 2122a43..f93ea4d 100644
--- a/requirements-dev.txt
+++ b/requirements-dev.txt
@@ -1 +1,2 @@
+flake8==6.1.0
jprm==0.5.1