Skip to content

Commit b84bbe4

Browse files
authored
Fix for TypeError in Resolve Dependencies workflow (#22127)
* Fix for TypeError in Resolve Dependencies workflow * Add test
1 parent 9e039f7 commit b84bbe4

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

.builders/tests/test_upload.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,3 +373,19 @@ def test_lockfile_generation(tmp_path, setup_targets_dir):
373373
linux_aarch64_lockfile = lockfile_map["linux-aarch64_3.12.txt"]
374374
assert linux_aarch64_lockfile == f'existing @ https://agent-int-packages.datadoghq.com/built/existing/existing-1.1.1-{frozen_timestamp}-cp312-cp312-manylinux2010_aarch64.whl#sha256=built-hash'
375375
assert len(lock_files) == 2
376+
377+
378+
def test_generate_lockfiles_accepts_string_path(tmp_path):
379+
380+
lockfile = {'linux-x86_64': ['dep @ https://example.com/dep.whl#sha256=abc', '']}
381+
382+
fake_deps_dir = tmp_path / ".deps"
383+
fake_resolved_dir = fake_deps_dir / "resolved"
384+
fake_deps_dir.mkdir()
385+
fake_resolved_dir.mkdir()
386+
(tmp_path / "targets").mkdir()
387+
388+
with mock.patch.object(upload, "RESOLUTION_DIR", fake_deps_dir), \
389+
mock.patch.object(upload, "LOCK_FILE_DIR", fake_resolved_dir):
390+
# Should not raise TypeError: unsupported operand type(s) for /: 'str' and 'str'
391+
upload.generate_lockfiles(str(tmp_path / "targets"), lockfile)

.builders/upload.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ def _build_number_of_wheel_blob(wheel_path: Blob) -> int:
8484

8585

8686
def generate_lockfiles(targets_dir, lockfiles):
87+
targets_dir = Path(targets_dir)
8788
LOCK_FILE_DIR.mkdir(parents=True, exist_ok=True)
8889
with RESOLUTION_DIR.joinpath('metadata.json').open('w', encoding='utf-8') as f:
8990
contents = json.dumps(

0 commit comments

Comments
 (0)