DevConf Pune 2026 Test Case Fix#5966
Conversation
| import tomli as tomllib | ||
|
|
||
|
|
||
| ROOT = pathlib.Path(__file__).parent |
There was a problem hiding this comment.
🔴 ROOT path points to test directory instead of repo root, causing test to always skip
The ROOT variable on line 12 is set to pathlib.Path(__file__).parent, which resolves to sdk/python/tests/unit/. Both parse_pyproject() and parse_setup() look for pyproject.toml and setup.py relative to this ROOT directory. However, neither file exists there — pyproject.toml is at the repo root (/) and setup.py is also at the repo root.
Root Cause and Impact
Since ROOT / "pyproject.toml" resolves to sdk/python/tests/unit/pyproject.toml which doesn't exist, parse_pyproject() returns (set(), {}) on line 33. Similarly, ROOT / "setup.py" resolves to sdk/python/tests/unit/setup.py which also doesn't exist, so parse_setup() returns (set(), {}) on line 87.
In test_dependencies_in_sync() at line 141, the condition if not py_core and not py_optional is always True, so pytest.skip() is always called. The test never actually validates anything — it silently skips every time.
The fix should set ROOT to the actual repository root directory, e.g.:
ROOT = pathlib.Path(__file__).resolve().parents[4]or find the root by traversing up to where pyproject.toml and setup.py actually exist.
Impact: The test is entirely non-functional. It was intended to verify that dependencies in pyproject.toml and setup.py are in sync, but it never runs the actual comparison logic.
Prompt for agents
In sdk/python/tests/unit/test_dependency_sync.py, line 12 sets ROOT = pathlib.Path(__file__).parent which resolves to sdk/python/tests/unit/. This directory contains neither pyproject.toml nor setup.py. The actual pyproject.toml is at the repository root, and setup.py is also at the repository root. Change ROOT to point to the repository root. For example, since the test file is at sdk/python/tests/unit/test_dependency_sync.py (4 levels deep from the repo root), you could use: ROOT = pathlib.Path(__file__).resolve().parents[4]. Alternatively, you could walk up the directory tree until you find a directory containing both pyproject.toml and setup.py.
Was this helpful? React with 👍 or 👎 to provide feedback.
|
Hi, do you mind to add more details to the PR like why we need this fix? Thank you in advance! |
What this PR does / why we need it:
Which issue(s) this PR fixes:
Misc