Development

Python virtual environment

At this point of writing, when setting up for python3.11.2 in debian 12

setup

python3 -m venv --system-site-packages venv
source venv/bin/activate
pip3 install --upgrade pip
pip3 install swig==4.1.1.post1
pip3 install pykcs11==1.4.4
pip3 install dmarc endesive bs4 sqlalchemy aioprocessing python-magic python-libmilter

IDE

When using vscode 1.85.2. cd to the root of the project that contain the python virtual environment as setup described in setup

VScode

vscode should auto detect. Verify by open a terminal within vscode.

vscode .

unit test

Ensure you have the virtual environment setup . Then install test dependencies.

pip3 install --editable '.[test]'

different ways to test

# run all unittests under fuglu/tests/unit
$ python3 -m pytest fuglu/tests/unit

# run a single unit module
$ python3 -m pytest fuglu/tests/unit/shared_test.py

# run a single unit class
$ python3 -m pytest -v fuglu/tests/unit/milterplugin_test.py::TestMilterPluginBase

# run a single unit function
$ python3 -m pytest -v fuglu/tests/unit/milterplugin_test.py::TestMilterPluginBase::test_lint_ok

# exclude a test
$ python3 -m pytest -v  fuglu/tests/unit/milterplugin_test.py::TestMilterPluginBase -k 'not test_lint_notimpl'