Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ on:
pull_request:

jobs:
# All tests against the installed package. Without sclang, the SCDoc tests are skipped.
# All tests against the installed package. Without sclang, the SCDoc tests are skipped. The citation tests run
# with the pandoc of Ubuntu; the comparison of whole files is skipped if it is not the version in
# tests/schelp/PANDOC_VERSION.
python:
runs-on: ubuntu-24.04
strategy:
Expand All @@ -17,6 +19,7 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- run: sudo apt-get update && sudo apt-get install --yes --no-install-recommends pandoc
- run: python -m pip install ".[test]"
# From another folder, so that the tests import the installed package and not the checkout
- name: Test the installed package
Expand All @@ -32,9 +35,10 @@ jobs:
container: debian:forky
env:
MD2MISC_REQUIRE_SCLANG: "1"
MD2MISC_REQUIRE_PANDOC: "1"
QT_QPA_PLATFORM: offscreen
steps:
- uses: actions/checkout@v4
- run: apt-get update && apt-get install --yes --no-install-recommends python3 python3-venv supercollider-language
- run: apt-get update && apt-get install --yes --no-install-recommends python3 python3-venv supercollider-language pandoc
- run: python3 -m venv /opt/venv && /opt/venv/bin/python -m pip install ".[test]"
- run: /opt/venv/bin/python -m pytest -k schelp -rs
3 changes: 2 additions & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ Markdown to TeX (the same output as md2tex) and to SuperCollider help (schelp).
- The SCDoc tests need `sclang`; they are skipped without it. The host `sclang` (3.14.1, the version in `tests/schelp/SCLANG_VERSION`) is on `PATH` in the container. GitHub Actions (`.github/workflows/tests.yml`) runs the tests against the installed package, and the SCDoc tests in a `debian:forky` container, for `sclang` 3.14 (Ubuntu 24.04 has 3.13, which does not know `math::` and `subsubsection::`).
- `tests/fixtures/*.tex` is the output of md2tex f90f23b. It is the reference. Never run `tests/battery.py build` against changed converter code. Change a `.tex` file only if the TeX output is meant to change.
- The fixtures test article-numbered TeX and the heading variants only. After a change in the converters, also compare with the old code on edge cases.
- After a schelp change, run `.venv/bin/python tests/schelp_fixtures.py update` in the container (needs `sclang`) and read the diff. It also writes the `sclang` version to `tests/schelp/SCLANG_VERSION`.
- The citation tests need `pandoc`. It is not on the host or in the container: give a Nix store path with `PANDOC`. Get the path on the host with `nix build nixpkgs#pandoc --no-link --print-out-paths` (the program is `<path>/bin/pandoc`), then `distrobox enter dev -- fish -lc 'cd ~/gp/md2misc; and env PANDOC=<path>/bin/pandoc .venv/bin/python -m pytest'`.
- After a schelp change, run `.venv/bin/python tests/schelp_fixtures.py update` in the container (needs `sclang`, and `pandoc` through `PANDOC`) and read the diff. It also writes the versions to `tests/schelp/SCLANG_VERSION` and `tests/schelp/PANDOC_VERSION`.

## Design

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Each output format is a *backend*:

## Installation

`md2misc` needs Python 3.10 or later. It uses only the Python standard library.
`md2misc` needs Python 3.10 or later. It uses only the Python standard library. The citations of the schelp backend need the program [`pandoc`](https://pandoc.org) (see [docs/schelp.md](docs/schelp.md#citations)).

```bash
pip install git+https://github.com/aeskildsen/md2misc
Expand Down
10 changes: 7 additions & 3 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ The tests of the SCDoc output run headless `sclang` (SuperCollider). They are sk

Each version of `sclang` from 3.14 must parse the schelp output with no error and give the expected parts of the pages. The `.html` files hold whole pages of the SuperCollider version in `tests/schelp/SCLANG_VERSION`. The tests compare whole pages only with that version.

GitHub Actions (`.github/workflows/tests.yml`) runs all tests against the installed package with several Python versions. It runs the SCDoc tests with the SuperCollider of Debian forky (Ubuntu 24.04 has 3.13).
The tests of the citations run `pandoc`. They are skipped if `pandoc` is not on `PATH` or in the `PANDOC` environment variable. With `MD2MISC_REQUIRE_PANDOC=1`, a missing `pandoc` is an error. The text of a citation can change between versions of Pandoc: the tests compare the files of the fixtures with a bibliography only with the version in `tests/schelp/PANDOC_VERSION`.

GitHub Actions (`.github/workflows/tests.yml`) runs all tests against the installed package with several Python versions. It runs the SCDoc tests with the SuperCollider of Debian forky (Ubuntu 24.04 has 3.13). Both jobs install the `pandoc` of the distribution.

## Test files

Expand All @@ -26,14 +28,16 @@ GitHub Actions (`.github/workflows/tests.yml`) runs all tests against the instal
- `tests/test_schelp_errors.py`: the constructs without a schelp form stop the conversion with the file, line and construct, and look-alikes in code are accepted.
- `tests/test_schelp_writer.py`: the writers of the schelp backend stop at the constructs too, when the check of the source does not find them.
- `tests/test_schelp_behavior.py`: the output of single cases.
- `tests/test_schelp_methods.py`: the class methods section: method headings, the forms of the argument table, the cells and the return value.
- `tests/test_schelp_methods.py`: the methods sections: method headings, the forms of the argument table, the cells, the return value and the discussion.
- `tests/test_schelp_tables.py`: the tables outside the methods sections.
- `tests/test_schelp_citations.py`: the citations, with the bibliography `tests/schelp/citations.bib`.
- `tests/test_tables.py`: the rows of a pipe table (`md2misc/tables.py`): which lines are a table, the cells and the end of the table. The expected values are those of cmark-gfm, the GFM parser of GitHub, where a comment does not say otherwise.
- `tests/test_tex_library.py`: the arguments of `convert`, the default template, the warnings and the errors of the TeX backend, and that the package needs only the standard library.

## Fixture tools

- `python3 tests/battery.py build` makes the TeX fixtures. It needs `pip install -e ".[battery]"` and private checkouts of the book that the fixtures come from, so contributors do not run it. The `.tex` files are the frozen reference (the output of `md2tex`).
- `python3 tests/schelp_fixtures.py update` makes the `.schelp` and `.html` files and `SCLANG_VERSION`. Read the diff afterwards. After an update of SuperCollider, the HTML can change: make the files again and read the diff.
- `python3 tests/schelp_fixtures.py update` makes the `.schelp` and `.html` files, `SCLANG_VERSION` and `PANDOC_VERSION`. It needs `sclang` and `pandoc`. Read the diff afterwards. After an update of SuperCollider or Pandoc, the output can change: make the files again and read the diff. The files in `tests/schelp/images` are next to the schelp files when SCDoc renders them.

## Releases

Expand Down
Loading
Loading