Add Lean Python unit tests CI workflow#142
Merged
jhonabreul merged 4 commits intoJul 16, 2026
Merged
Conversation
Runs Lean's Python/Pandas unit test suites plus every other Lean unit test class that exercises Python code against the freshly built Python.Runtime.dll. Test classes are selected by scanning Lean's test sources for Python interop usage and passing the resulting FullyQualifiedName filter through a runsettings file. Regression suites are excluded since Python regression algorithms are already covered by the Lean Python Regression Tests workflow.
Follow the pattern of Lean's own unit test CI job and this repo's main workflow: run directly in a quantconnect/lean:foundation container on a self-hosted runner instead of manually managing a docker container on a GitHub-hosted runner.
Container jobs default to sh, which does not support the here-string used when writing the runsettings file.
Follow the pattern of Lean's own regression tests CI job: run directly in a quantconnect/lean:foundation container on a self-hosted runner instead of manually managing a docker container on a GitHub-hosted runner.
Martin-Molinero
approved these changes
Jul 16, 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.
Description
Adds a new CI workflow (
Lean Python Unit Tests) that validates Python.Runtime.dll changes against Lean's Python unit tests:QuantConnect.Tests.Python:PandasConverterTests,PythonPackagesTests, etc.).Language.Pythontest cases, exception interpreter tests, wrapper model tests, ...).How it works
Mirrors the existing
Lean Python Regression Testsworkflow: builds this repo'sPython.Runtime.dllinsidequantconnect/lean:foundation, builds Lean, and drops the freshly built DLL over Lean's test output.Test selection is generated at run time: Lean's test sources are scanned for Python interop usage (
Py.GIL,PythonEngine,PyObject,Language.Python, ...) and each matching file's classes becomeFullyQualifiedName~<Namespace>.<Class>entries in aTestCaseFilter(currently ~368 class filters), passed via a runsettings file since the expression is too long for a command line. This keeps the selection in sync with Lean automatically as tests are added or moved.Exclusions mirror Lean's own unit test CI (
TestCategory!=TravisExclude,TestCategory!=ResearchRegressionTests) plusTestCategory!=RegressionTests, since Python regression algorithms are already covered by the Lean Python Regression Tests workflow.