# first bad commit: [785b8f2119631cfab2c73347e486709936f0aa9e] Update Coursier default version to v2.1.24 (#22906)
from __future__ import annotations
import textwrap
from pants.engine.fs import EMPTY_DIGEST
from pants.jvm.resolve.coordinate import Coordinate
from pants.jvm.resolve.coursier_fetch import CoursierResolvedLockfile
from pants.jvm.resolve.key import CoursierResolveKey
from pants.jvm.resolve.lockfile_metadata import JVMLockfileMetadata
def test_missing_entry_for_transitive_arrow_dependency_from_forge_lockfile() -> None:
metadata = JVMLockfileMetadata.new([])
lockfile = CoursierResolvedLockfile.from_serialized(
metadata.add_header_to_lockfile(
textwrap.dedent(
"""\
[[entries]]
file_name = "org.apache.hive_hive-exec_3.1.3.jar"
[[entries.directDependencies]]
group = "commons-codec"
artifact = "commons-codec"
version = "1.17.0"
packaging = "jar"
[[entries.dependencies]]
group = "commons-codec"
artifact = "commons-codec"
version = "1.17.0"
packaging = "jar"
[[entries.dependencies]]
group = "org.apache.arrow"
artifact = "arrow-memory"
version = "0.8.0"
packaging = "jar"
[entries.coord]
group = "org.apache.hive"
artifact = "hive-exec"
version = "3.1.3"
packaging = "jar"
[entries.file_digest]
fingerprint = "a39058a6028ad36a74f97639663c94d9d4c52d9d32fab31032270565d01424af"
serialized_bytes_length = 492916
[[entries]]
directDependencies = []
dependencies = []
file_name = "commons-codec_commons-codec_1.17.0.jar"
[entries.coord]
group = "commons-codec"
artifact = "commons-codec"
version = "1.17.0"
packaging = "jar"
[entries.file_digest]
fingerprint = "0000000000000000000000000000000000000000000000000000000000000000"
serialized_bytes_length = 1
"""
).encode(),
regenerate_command="N/A - regression fixture",
delimeter="#",
)
)
root_entry, transitive_entries = lockfile.dependencies(
CoursierResolveKey(
name="forge-jvm-spark-3-5",
path="lockfiles/jvm-spark-3-5.lock",
digest=EMPTY_DIGEST,
),
Coordinate(group="org.apache.hive", artifact="hive-exec", version="3.1.3"),
)
assert root_entry.coord == Coordinate(
group="org.apache.hive",
artifact="hive-exec",
version="3.1.3",
strict=True,
)
assert {(entry.coord.group, entry.coord.artifact) for entry in transitive_entries} == {
("commons-codec", "commons-codec"),
}
assert {(dep.group, dep.artifact) for dep in root_entry.dependencies} == {
("commons-codec", "commons-codec"),
("org.apache.arrow", "arrow-memory"),
}
Describe the bug
Running
pants check --only src/jvm::fails withKeyError: ('org.apache.arrow', 'arrow-memory', None)I bisected the problem to the commit 785b8f2
A test to reproduce:
src/python/pants/jvm/resolve/coursier_fetch_missing_entry_test.py