From d3c7c31740b988dcdb32b7728738a597e6c02655 Mon Sep 17 00:00:00 2001 From: Luc LAURENT Date: Wed, 9 Oct 2024 16:32:18 +0200 Subject: [PATCH] move tests folder in packages folder + rewrite pyproject.toml to work with pdm-backend + add tests' settings for vscode --- .gitignore | 7 +++ .vscode/settings.json | 11 ++++ {tests => amc2moodle/tests}/__init__.py | 0 .../tests}/payload_test_amc2moodle/4.png | Bin .../Figures/other/4r.png | Bin .../Figures/other/schema_interpL.png | Bin .../Figures/tinymonk.pdf | Bin .../tests}/payload_test_amc2moodle/QCM.pdf | Bin .../tests}/payload_test_amc2moodle/QCM.tex | 0 .../tests}/payload_test_amc2moodle/QCM.xml | 0 .../payload_test_amc2moodle/QCM_wo-tikz.tex | 0 .../payload_test_amc2moodle/QCM_wo-tikz.xml | 0 .../payload_test_amc2moodle/cleaning.tex | 0 .../payload_test_amc2moodle/cleaning.xml | 0 .../payload_test_amc2moodle/common-bank.tex | 0 .../payload_test_amc2moodle/element.tex | 0 .../payload_test_amc2moodle/includestyles.tex | 0 .../payload_test_amc2moodle/numerical.tex | 0 .../payload_test_amc2moodle/numerical.xml | 0 .../tests}/payload_test_amc2moodle/tikz.tex | 0 .../automultiplechoice.sty | 0 .../moodle-bank-exemple.pdf | Bin .../moodle-bank-exemple.tex | 0 .../moodle-bank-exemple.xml | 0 .../tests}/test_amc2moodle.py | 0 .../tests}/test_moodle2amc.py | 0 .../tests}/test_utils_calculatedParser.py | 0 .../tests}/test_utils_text.py | 0 pyproject.toml | 55 ++++++++++++++++-- 29 files changed, 67 insertions(+), 6 deletions(-) create mode 100644 .vscode/settings.json rename {tests => amc2moodle/tests}/__init__.py (100%) rename {tests => amc2moodle/tests}/payload_test_amc2moodle/4.png (100%) rename {tests => amc2moodle/tests}/payload_test_amc2moodle/Figures/other/4r.png (100%) rename {tests => amc2moodle/tests}/payload_test_amc2moodle/Figures/other/schema_interpL.png (100%) rename {tests => amc2moodle/tests}/payload_test_amc2moodle/Figures/tinymonk.pdf (100%) rename {tests => amc2moodle/tests}/payload_test_amc2moodle/QCM.pdf (100%) rename {tests => amc2moodle/tests}/payload_test_amc2moodle/QCM.tex (100%) rename {tests => amc2moodle/tests}/payload_test_amc2moodle/QCM.xml (100%) rename {tests => amc2moodle/tests}/payload_test_amc2moodle/QCM_wo-tikz.tex (100%) rename {tests => amc2moodle/tests}/payload_test_amc2moodle/QCM_wo-tikz.xml (100%) rename {tests => amc2moodle/tests}/payload_test_amc2moodle/cleaning.tex (100%) rename {tests => amc2moodle/tests}/payload_test_amc2moodle/cleaning.xml (100%) rename {tests => amc2moodle/tests}/payload_test_amc2moodle/common-bank.tex (100%) rename {tests => amc2moodle/tests}/payload_test_amc2moodle/element.tex (100%) rename {tests => amc2moodle/tests}/payload_test_amc2moodle/includestyles.tex (100%) rename {tests => amc2moodle/tests}/payload_test_amc2moodle/numerical.tex (100%) rename {tests => amc2moodle/tests}/payload_test_amc2moodle/numerical.xml (100%) rename {tests => amc2moodle/tests}/payload_test_amc2moodle/tikz.tex (100%) rename {tests => amc2moodle/tests}/payload_test_moodle2amc/automultiplechoice.sty (100%) rename {tests => amc2moodle/tests}/payload_test_moodle2amc/moodle-bank-exemple.pdf (100%) rename {tests => amc2moodle/tests}/payload_test_moodle2amc/moodle-bank-exemple.tex (100%) rename {tests => amc2moodle/tests}/payload_test_moodle2amc/moodle-bank-exemple.xml (100%) rename {tests => amc2moodle/tests}/test_amc2moodle.py (100%) rename {tests => amc2moodle/tests}/test_moodle2amc.py (100%) rename {tests => amc2moodle/tests}/test_utils_calculatedParser.py (100%) rename {tests => amc2moodle/tests}/test_utils_text.py (100%) diff --git a/.gitignore b/.gitignore index 8c87025..8ba88e0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,12 @@ # Byte-code __pycache__/ +**/__pycache__/ *.py[cod] # Distribution / packaging *.egg-info/ build/ +dist/ # pdoc html/ @@ -40,3 +42,8 @@ html/ *.mtc1 *.out *.synctex* + +# specific amc2moodle artifacts +**/xmlclean* +**/*_magic.tex +output_tests/ diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..9668092 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,11 @@ +{ + "python.testing.unittestArgs": [ + "-v", + "-s", + "./amc2moodle/tests", + "-p", + "test_*.py" + ], + "python.testing.pytestEnabled": false, + "python.testing.unittestEnabled": true +} \ No newline at end of file diff --git a/tests/__init__.py b/amc2moodle/tests/__init__.py similarity index 100% rename from tests/__init__.py rename to amc2moodle/tests/__init__.py diff --git a/tests/payload_test_amc2moodle/4.png b/amc2moodle/tests/payload_test_amc2moodle/4.png similarity index 100% rename from tests/payload_test_amc2moodle/4.png rename to amc2moodle/tests/payload_test_amc2moodle/4.png diff --git a/tests/payload_test_amc2moodle/Figures/other/4r.png b/amc2moodle/tests/payload_test_amc2moodle/Figures/other/4r.png similarity index 100% rename from tests/payload_test_amc2moodle/Figures/other/4r.png rename to amc2moodle/tests/payload_test_amc2moodle/Figures/other/4r.png diff --git a/tests/payload_test_amc2moodle/Figures/other/schema_interpL.png b/amc2moodle/tests/payload_test_amc2moodle/Figures/other/schema_interpL.png similarity index 100% rename from tests/payload_test_amc2moodle/Figures/other/schema_interpL.png rename to amc2moodle/tests/payload_test_amc2moodle/Figures/other/schema_interpL.png diff --git a/tests/payload_test_amc2moodle/Figures/tinymonk.pdf b/amc2moodle/tests/payload_test_amc2moodle/Figures/tinymonk.pdf similarity index 100% rename from tests/payload_test_amc2moodle/Figures/tinymonk.pdf rename to amc2moodle/tests/payload_test_amc2moodle/Figures/tinymonk.pdf diff --git a/tests/payload_test_amc2moodle/QCM.pdf b/amc2moodle/tests/payload_test_amc2moodle/QCM.pdf similarity index 100% rename from tests/payload_test_amc2moodle/QCM.pdf rename to amc2moodle/tests/payload_test_amc2moodle/QCM.pdf diff --git a/tests/payload_test_amc2moodle/QCM.tex b/amc2moodle/tests/payload_test_amc2moodle/QCM.tex similarity index 100% rename from tests/payload_test_amc2moodle/QCM.tex rename to amc2moodle/tests/payload_test_amc2moodle/QCM.tex diff --git a/tests/payload_test_amc2moodle/QCM.xml b/amc2moodle/tests/payload_test_amc2moodle/QCM.xml similarity index 100% rename from tests/payload_test_amc2moodle/QCM.xml rename to amc2moodle/tests/payload_test_amc2moodle/QCM.xml diff --git a/tests/payload_test_amc2moodle/QCM_wo-tikz.tex b/amc2moodle/tests/payload_test_amc2moodle/QCM_wo-tikz.tex similarity index 100% rename from tests/payload_test_amc2moodle/QCM_wo-tikz.tex rename to amc2moodle/tests/payload_test_amc2moodle/QCM_wo-tikz.tex diff --git a/tests/payload_test_amc2moodle/QCM_wo-tikz.xml b/amc2moodle/tests/payload_test_amc2moodle/QCM_wo-tikz.xml similarity index 100% rename from tests/payload_test_amc2moodle/QCM_wo-tikz.xml rename to amc2moodle/tests/payload_test_amc2moodle/QCM_wo-tikz.xml diff --git a/tests/payload_test_amc2moodle/cleaning.tex b/amc2moodle/tests/payload_test_amc2moodle/cleaning.tex similarity index 100% rename from tests/payload_test_amc2moodle/cleaning.tex rename to amc2moodle/tests/payload_test_amc2moodle/cleaning.tex diff --git a/tests/payload_test_amc2moodle/cleaning.xml b/amc2moodle/tests/payload_test_amc2moodle/cleaning.xml similarity index 100% rename from tests/payload_test_amc2moodle/cleaning.xml rename to amc2moodle/tests/payload_test_amc2moodle/cleaning.xml diff --git a/tests/payload_test_amc2moodle/common-bank.tex b/amc2moodle/tests/payload_test_amc2moodle/common-bank.tex similarity index 100% rename from tests/payload_test_amc2moodle/common-bank.tex rename to amc2moodle/tests/payload_test_amc2moodle/common-bank.tex diff --git a/tests/payload_test_amc2moodle/element.tex b/amc2moodle/tests/payload_test_amc2moodle/element.tex similarity index 100% rename from tests/payload_test_amc2moodle/element.tex rename to amc2moodle/tests/payload_test_amc2moodle/element.tex diff --git a/tests/payload_test_amc2moodle/includestyles.tex b/amc2moodle/tests/payload_test_amc2moodle/includestyles.tex similarity index 100% rename from tests/payload_test_amc2moodle/includestyles.tex rename to amc2moodle/tests/payload_test_amc2moodle/includestyles.tex diff --git a/tests/payload_test_amc2moodle/numerical.tex b/amc2moodle/tests/payload_test_amc2moodle/numerical.tex similarity index 100% rename from tests/payload_test_amc2moodle/numerical.tex rename to amc2moodle/tests/payload_test_amc2moodle/numerical.tex diff --git a/tests/payload_test_amc2moodle/numerical.xml b/amc2moodle/tests/payload_test_amc2moodle/numerical.xml similarity index 100% rename from tests/payload_test_amc2moodle/numerical.xml rename to amc2moodle/tests/payload_test_amc2moodle/numerical.xml diff --git a/tests/payload_test_amc2moodle/tikz.tex b/amc2moodle/tests/payload_test_amc2moodle/tikz.tex similarity index 100% rename from tests/payload_test_amc2moodle/tikz.tex rename to amc2moodle/tests/payload_test_amc2moodle/tikz.tex diff --git a/tests/payload_test_moodle2amc/automultiplechoice.sty b/amc2moodle/tests/payload_test_moodle2amc/automultiplechoice.sty similarity index 100% rename from tests/payload_test_moodle2amc/automultiplechoice.sty rename to amc2moodle/tests/payload_test_moodle2amc/automultiplechoice.sty diff --git a/tests/payload_test_moodle2amc/moodle-bank-exemple.pdf b/amc2moodle/tests/payload_test_moodle2amc/moodle-bank-exemple.pdf similarity index 100% rename from tests/payload_test_moodle2amc/moodle-bank-exemple.pdf rename to amc2moodle/tests/payload_test_moodle2amc/moodle-bank-exemple.pdf diff --git a/tests/payload_test_moodle2amc/moodle-bank-exemple.tex b/amc2moodle/tests/payload_test_moodle2amc/moodle-bank-exemple.tex similarity index 100% rename from tests/payload_test_moodle2amc/moodle-bank-exemple.tex rename to amc2moodle/tests/payload_test_moodle2amc/moodle-bank-exemple.tex diff --git a/tests/payload_test_moodle2amc/moodle-bank-exemple.xml b/amc2moodle/tests/payload_test_moodle2amc/moodle-bank-exemple.xml similarity index 100% rename from tests/payload_test_moodle2amc/moodle-bank-exemple.xml rename to amc2moodle/tests/payload_test_moodle2amc/moodle-bank-exemple.xml diff --git a/tests/test_amc2moodle.py b/amc2moodle/tests/test_amc2moodle.py similarity index 100% rename from tests/test_amc2moodle.py rename to amc2moodle/tests/test_amc2moodle.py diff --git a/tests/test_moodle2amc.py b/amc2moodle/tests/test_moodle2amc.py similarity index 100% rename from tests/test_moodle2amc.py rename to amc2moodle/tests/test_moodle2amc.py diff --git a/tests/test_utils_calculatedParser.py b/amc2moodle/tests/test_utils_calculatedParser.py similarity index 100% rename from tests/test_utils_calculatedParser.py rename to amc2moodle/tests/test_utils_calculatedParser.py diff --git a/tests/test_utils_text.py b/amc2moodle/tests/test_utils_text.py similarity index 100% rename from tests/test_utils_text.py rename to amc2moodle/tests/test_utils_text.py diff --git a/pyproject.toml b/pyproject.toml index 993f1dd..93fb7f5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [build-system] -requires = ["setuptools", "wheel"] -build-backend = "setuptools.build_meta" +requires = ["pdm-backend"] +build-backend = "pdm.backend" [project] name = "amc2moodle" @@ -35,11 +35,54 @@ Issues = "https://github.com/nennigb/amc2moodle/issues" amc2moodle = "amc2moodle.amc2moodle.bin.amc2moodle:run" moodle2amc = "amc2moodle.moodle2amc.bin.moodle2amc:run" -[tool.setuptools.dynamic] -version = {attr = "amc2moodle.__version__"} +[tool.pdm.version] +source = "file" +path = "amc2moodle/_version.py" -[tool.setuptools] -package-dir = { "amc2moodle" = "amc2moodle", "amc2moodle.tests" = "tests"} +[tool.pdm.build] +source-includes = [ + "LICENSE", + "README.md" +] +includes = [ + "amc2moodle/", + "amc2moodle/moodle2amc/README.md", + "amc2moodle/amc2moodle/README.md", + "amc2moodle/amc2moodle/bin/amc2moodle", + "amc2moodle/amc2moodle/*.xslt", + "amc2moodle/amc2moodle/*sty.ltxml", + "amc2moodle/moodle2amc/bin/moodle2amc", + "amc2moodle/moodle2amc/html2tex.xslt", + "amc2moodle/moodle2amc/struc2tex.xslt", + "amc2moodle/tests/payload_test_amc2moodle/Figures/*", + "amc2moodle/tests/payload_test_amc2moodle/Figures/other/*", + "amc2moodle/tests/payload_test_amc2moodle/4.png", + "amc2moodle/tests/payload_test_amc2moodle/QCM.pdf", + "amc2moodle/tests/payload_test_amc2moodle/QCM.tex", + "amc2moodle/tests/payload_test_amc2moodle/QCM.xml", + "amc2moodle/tests/payload_test_amc2moodle/QCM_wo-tikz.tex", + "amc2moodle/tests/payload_test_amc2moodle/QCM_wo-tikz.xml", + "amc2moodle/tests/payload_test_amc2moodle/tikz.tex", + "amc2moodle/tests/payload_test_amc2moodle/common-bank.tex", + "amc2moodle/tests/payload_test_amc2moodle/numerical.tex", + "amc2moodle/tests/payload_test_amc2moodle/numerical.xml", + "amc2moodle/tests/payload_test_amc2moodle/cleaning.tex", + "amc2moodle/tests/payload_test_amc2moodle/cleaning.xml", + "amc2moodle/tests/payload_test_amc2moodle/element.tex", + "amc2moodle/tests/payload_test_amc2moodle/includestyles.tex", + "amc2moodle/tests/payload_test_moodle2amc/automultiplechoice.sty", + "amc2moodle/tests/payload_test_moodle2amc/moodle-bank-exemple.xml", + "amc2moodle/tests/payload_test_moodle2amc/moodle-bank-exemple.tex", + "amc2moodle/tests/payload_test_moodle2amc/moodle-bank-exemple.pdf" +] +excludes = [ + "**/*_magic.tex", + "**/xmlclean*", + "**/__pycache__" +] + +# [tool.setuptools] +# package-dir = { "amc2moodle" = "amc2moodle", "amc2moodle.tests" = "tests"} [tool.coverage.run] branch = true