# HG changeset patch # User Franz Glasner # Date 1776684702 -7200 # Node ID b92f660f24610fbe73bde27becd365c49148fc0d # Parent db0171f62e5a756488c70868304a779c92bc02d1 Begin a test infrastructure: using unittest and flake8. Need a requirements-dev.txt now also. diff -r db0171f62e5a -r b92f660f2461 MANIFEST.in --- a/MANIFEST.in Mon Apr 20 09:06:51 2026 +0200 +++ b/MANIFEST.in Mon Apr 20 13:31:42 2026 +0200 @@ -1,1 +1,3 @@ -include requirements.txt +include .hg* *.txt +graft tests +global-exclude *.pyc *.pyo diff -r db0171f62e5a -r b92f660f2461 Makefile --- a/Makefile Mon Apr 20 09:06:51 2026 +0200 +++ b/Makefile Mon Apr 20 13:31:42 2026 +0200 @@ -4,11 +4,13 @@ # SPDX-License-Identifier: MIT # :- -.PHONY: help clean distclean dist build +.PHONY: help all clean distclean dist build tests flake8 help: @echo Targets: help, clean, distclean, dist, build +all: tests flake8 + build: python -m build @@ -20,3 +22,10 @@ clean: rm -rf __arch/ find . -name '*.pyc' -delete + +tests: + -python -m unittest discover -s tests + +flake8: + -flake8 pygments_lexer_pseudocode2 + -flake8 tests diff -r db0171f62e5a -r b92f660f2461 requirements-dev.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/requirements-dev.txt Mon Apr 20 13:31:42 2026 +0200 @@ -0,0 +1,2 @@ +-r requirements.txt +flake8 diff -r db0171f62e5a -r b92f660f2461 tests/_tsetup.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/_tsetup.py Mon Apr 20 13:31:42 2026 +0200 @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- +# :- +# SPDX-FileCopyrightText: © 2026 Franz Glasner +# SPDX-License-Identifier: MIT +r"""Automatic unittest context configuration. + +Side-effects of import configure the test environment! + +""" + +import logging +import os +import sys + + +sys.path.insert( + 0, + os.path.abspath( + os.path.normpath(os.path.join(os.path.dirname(__file__), "..")))) + + +TESTDATADIR = os.path.join( + os.path.abspath(os.path.dirname(__file__)), + "data") + + +# Setup logging for the unittests: use a known fixed format w/o time +logging.captureWarnings(True) +logging.basicConfig( + level=logging.DEBUG, + style='%', + format="[%(name)s][%(filename)s:%(lineno)d:%(funcName)s][%(levelname)s] %(message)s") # noqa: E501 (line too long) diff -r db0171f62e5a -r b92f660f2461 tests/test_fr.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test_fr.py Mon Apr 20 13:31:42 2026 +0200 @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- +# :- +# SPDX-FileCopyrightText: © 2026 Franz Glasner +# SPDX-License-Identifier: MIT +# :- + +import _tsetup # noqa:F401 (imported but unused) + +import unittest + + +if __name__ == "__main__": + unittest.main() + +