One solution would be for the distributors to remove those files from the build. But another (better) solution would be to not include them in the first place.
This can be achieved by moving the tests outside of the application code. Doing that is actually the recommended layout from pytest:
Tests are included in the build, which means they are typically shipped when distributed: https://packages.ubuntu.com/focal/all/python3-blockdiag/filelist
One solution would be for the distributors to remove those files from the build. But another (better) solution would be to not include them in the first place.
This can be achieved by moving the tests outside of the application code. Doing that is actually the recommended layout from pytest:
https://docs.pytest.org/en/stable/explanation/goodpractices.html#tests-outside-application-code
This patch just move files, modify some links, and add a conftest.py file, needed to modify sys.path