<#20739 Parametrized `python_tests` and `python_so...
# github-notifications
c
#20739 Parametrized `python_tests` and `python_sources` in same package not lining up when using explicit `dependencies` Issue created by ndellosa95 Describe the bug I have a
python_source
target in the same directory as a
python_test
target. Both are parametrized for multiple resolves/environments/interpreter constraints. The
python_test
target in question does not import the
python_source
target but instead calls it via the
subprocess
module, so I have the
python_source
target as an explicit dependency of the
python_test
one. This is causing an error because the
python_test
target is grabbing the first parametrization as the dependency instead of the matching one.
pants peek
output below:
Copy code
{
  "address": "my/python/tests/test_the_thing.py@parametrize=py311",
  "target_type": "python_test",
  "batch_compatibility_tag": null,
  "dependencies": [
    "my/inferred_dep/__init__.py@parametrize=py311",
    "my/python/tests/__init__.py:sources_for_tests@parametrize=py38",
    "my/python/tests/source_for_test.py:sources_for_tests@parametrize=py38"
  ],
  "dependencies_raw": [
    ":sources_for_tests"
  ],
  "description": null,
  "environment": "py311-test",
  "extra_env_vars": null,
  "interpreter_constraints": [
    "==3.11.*"
  ],
  "resolve": "py311",
  "run_goal_use_sandbox": null,
  "runtime_package_dependencies": null,
  "skip_black": false,
  "skip_docformatter": false,
  "skip_isort": false,
  "skip_mypy": true,
  "skip_ruff": true,
  "skip_tests": false,
  "source_raw": "test_the_thing.py",
  "sources": [
    "my/python/tests/test_the_thing.py"
  ],
  "sources_fingerprint": "b1274e36d37387cc0fca9f18cd77e456483663e6ac869ec1ecce9aaa502a8d83",
  "tags": null,
  "timeout": null,
  "xdist_concurrency": null
}
Pants version 2.19.1 OS Intel Mac pantsbuild/pants