Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion metaflow/plugins/pypi/pip.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def __init__(self, error):
self.package_spec = re.search(
"ERROR: No matching distribution found for (.*)", self.error
)[1]
self.package_name = re.match("\w*", self.package_spec)[0]
self.package_name = re.match(r"\w*", self.package_spec)[0]
Comment thread
agsaru marked this conversation as resolved.
except Exception:
pass

Expand Down
10 changes: 2 additions & 8 deletions test/plugins/pip/test_pip_indices.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from unittest.mock import MagicMock

from metaflow.plugins.pypi.pip import Pip


Expand All @@ -9,22 +7,18 @@ def _make_pip():
return pip


def test_multiple_extra_index_urls_literal_newline(monkeypatch):
def test_multiple_extra_index_urls_literal_newline(mocker):
Comment thread
agsaru marked this conversation as resolved.
Comment thread
agsaru marked this conversation as resolved.
"""Regression test: pip config list separates multiple URLs with literal \\n."""
pip = _make_pip()
config_output = (
"global.index-url='https://pypi.org/simple'\n"
r"global.extra-index-url='https://extra1.example.com/simple'\n'https://extra2.example.com/simple'"
)

# Use monkeypatch instead of unittest.mock.patch
mock_call = MagicMock(return_value=config_output)
monkeypatch.setattr(pip, "_call", mock_call)
mocker.patch.object(pip, "_call", return_value=config_output)
Comment thread
agsaru marked this conversation as resolved.

# Execute
index, extras = pip.indices("dummy")

# Assert
assert index == "https://pypi.org/simple"
assert extras == [
"https://extra1.example.com/simple",
Expand Down
Loading