Fix functional test runner invocation (unittest discover)#326
Open
sibson wants to merge 1 commit into
Open
Conversation
Run unittest discover with the repository as top-level dir (-t .) so the package-relative imports in tests/functional resolve. Fixes 'attempted relative import with no known parent package' from 'make test-func' and the command documented in DEVELOP.rst. Addresses feedback on #303.
This was referenced Jun 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the functional test runner reported broken in #303.
python -m unittest discover tests/functionalsets the top-level dir totests/functional, so the test modules are imported as top-level names (test_proxy) andfrom .cli import spawn_commandfails with "attempted relative import with no known parent package." The Makefile'stest-libvnctarget had the same bug because$(UNITTEST_ARGS)was never defined.This PR keeps the project on the standard library
unittestrunner (no new pytest dependency — CI and tox already useunittest discover):libvncserver.mk: defaultUNITTEST_ARGS?=-t .and rundiscover $(UNITTEST_ARGS) -s tests/functional, preserving thetests.functionalpackage context formake test-func.DEVELOP.rst: documented command updated topython -m unittest discover -t . -s tests/functional.Testing
python -m unittest discover -t . -s tests/functionalnow imports modules astests.functional.*(relative imports resolve).https://claude.ai/code/session_01Tvg8Ce2dzGiY9a9Pg71pp6
Generated by Claude Code