spakin / SimpInkScr

Simple Inkscape Scripting
https://inkscape.org/~pakin/%E2%98%85simple-inkscape-scripting
GNU General Public License v3.0
330 stars 32 forks source link

Adding unit tests? #36

Closed OpenFoam-User closed 2 years ago

OpenFoam-User commented 2 years ago

Hi, Are there any plans to use unit tests and CI (github actions) for SimpInkScr?

This could make the developement and maintenance for several inkscape versions easier.

Thanks

spakin commented 2 years ago

At some point I'll read up on Inkscape's test framework and write some unit tests for Simple Inkscape Scripting. Once that's done I'd hope it should be fairly straightforward to have those tests invoked by GitHub Actions.

spakin commented 2 years ago

As of 05fef6131282342364d1d4813c471307c78b31f7, Simple Inkscape Scripting includes two dozen unit tests based on the inkex.tester module and a GitHub Action that runs them.

OpenFoam-User commented 2 years ago

thanks for the update. I think some output should be added to .gitignore here is an example when git pull:

remote: Enumerating objects: 54, done.
remote: Counting objects: 100% (54/54), done.
remote: Compressing objects: 100% (25/25), done.
remote: Total 48 (delta 31), reused 40 (delta 23), pack-reused 0
Unpacking objects: 100% (48/48), 14.84 KiB | 330.00 KiB/s, done.
From github.com:spakin/SimpInkScr
   1b8afb4..c1c862a  master     -> origin/master
Updating 1b8afb4..c1c862a
Fast-forward
 simple_inkscape_scripting.py                                    |  6 +--
 svg_to_simp_ink_script.py                                       | 17 +++++++-
 ...________obj__rotate__15______center______first__True____.out | 41 +++++++++++++++++
 ...ple_inkscape_scripting__009fa6028769d24916a9e6032dc9d122.out | 13 ++++++
 ...ple_inkscape_scripting__0b76cdb52daf3cd259f54efc1e0643b7.out | 13 ++++++
 ...ple_inkscape_scripting__10926e00f595eea8f68837c808aae5d9.out | 13 ++++++
 ...ple_inkscape_scripting__197dea140a0144957bfb3358c908d972.out | 13 ++++++
 ...ple_inkscape_scripting__2ab64e02e5c184aec10b092a96627121.out | 13 ++++++
 ...ple_inkscape_scripting__52ccca6289d454b91a0efe640abe275d.out | 13 ++++++
 ...ple_inkscape_scripting__534f4e6759df14a97367b3bc42cc2d56.out | 13 ++++++
 ...ple_inkscape_scripting__5612bf002c492f74ef0cab8a162617b6.out | 13 ++++++
 ...ple_inkscape_scripting__5cfa500aecc9fd562886c02056d56e85.out | 13 ++++++
 ...ple_inkscape_scripting__5f77373b3c2858988b0ab9e2665b2f0e.out | 13 ++++++
 ...ple_inkscape_scripting__604024f0de3aa21fc2262da806e75d0b.out | 13 ++++++
 ...ple_inkscape_scripting__62f59a6f2ce8aecf0aa594a2267ff08f.out | 13 ++++++
 ...ple_inkscape_scripting__7b2a331532fd7385b9a464c44790a3a8.out | 13 ++++++
 ...ple_inkscape_scripting__a8a14503fa73684f2bb6949311274abd.out | 13 ++++++
 ...ple_inkscape_scripting__b2fdd850fd9705d57ccdbe9a1a861fd2.out | 13 ++++++
 ...ple_inkscape_scripting__c4db415c310852834e0d90a14d7b2faf.out | 13 ++++++
 tests/test_simple_inkscape_scripting.py                         | 68 ++++++++++++++++++++++++++++-
 20 files changed, 335 insertions(+), 5 deletions(-)
 create mode 100644 tests/data/refs/simple_inkscape_scripting__--program____for__obj__in__all_shapes________________obj__rotate__15______center______first__True____.out
 create mode 100644 tests/data/refs/simple_inkscape_scripting__009fa6028769d24916a9e6032dc9d122.out
 create mode 100644 tests/data/refs/simple_inkscape_scripting__0b76cdb52daf3cd259f54efc1e0643b7.out
 create mode 100644 tests/data/refs/simple_inkscape_scripting__10926e00f595eea8f68837c808aae5d9.out
 create mode 100644 tests/data/refs/simple_inkscape_scripting__197dea140a0144957bfb3358c908d972.out
 create mode 100644 tests/data/refs/simple_inkscape_scripting__2ab64e02e5c184aec10b092a96627121.out
 create mode 100644 tests/data/refs/simple_inkscape_scripting__52ccca6289d454b91a0efe640abe275d.out
 create mode 100644 tests/data/refs/simple_inkscape_scripting__534f4e6759df14a97367b3bc42cc2d56.out
 create mode 100644 tests/data/refs/simple_inkscape_scripting__5612bf002c492f74ef0cab8a162617b6.out
 create mode 100644 tests/data/refs/simple_inkscape_scripting__5cfa500aecc9fd562886c02056d56e85.out
 create mode 100644 tests/data/refs/simple_inkscape_scripting__5f77373b3c2858988b0ab9e2665b2f0e.out
 create mode 100644 tests/data/refs/simple_inkscape_scripting__604024f0de3aa21fc2262da806e75d0b.out
 create mode 100644 tests/data/refs/simple_inkscape_scripting__62f59a6f2ce8aecf0aa594a2267ff08f.out
 create mode 100644 tests/data/refs/simple_inkscape_scripting__7b2a331532fd7385b9a464c44790a3a8.out
 create mode 100644 tests/data/refs/simple_inkscape_scripting__a8a14503fa73684f2bb6949311274abd.out
 create mode 100644 tests/data/refs/simple_inkscape_scripting__b2fdd850fd9705d57ccdbe9a1a861fd2.out
 create mode 100644 tests/data/refs/simple_inkscape_scripting__c4db415c310852834e0d90a14d7b2faf.out

It brings a lot of *.out files.

spakin commented 2 years ago

.gitignore instructs Git to ignore particular local files when it reports untracked files (e.g., with git status). Files committed to the repository should not appear in .gitignore. (Git might even issue a warning if you try to add an ignored file.) Those *.out files are committed to the repository because they represent the expected test output. Yes, there are a lot of them—I wrote a lot of unit tests—but you'll see only new/modified ones on subsequent git pull operations so future clutter shouldn't be too bad .