Skip to content

Do not mangle a URL dependency as a factor-conditional - #353

Merged
gaborbernat merged 1 commit into
tox-dev:mainfrom
dchaudhari7177:fix/deps-url-not-conditional
Jul 26, 2026
Merged

Do not mangle a URL dependency as a factor-conditional#353
gaborbernat merged 1 commit into
tox-dev:mainfrom
dchaudhari7177:fix/deps-url-not-conditional

Conversation

@dchaudhari7177

Copy link
Copy Markdown
Contributor

Fixes #352.

Problem

tox-ini-fmt mangles a URL dependency, breaking the tox.ini:

[testenv]
deps =
  https://releases.wagtail.org/nightly/dist/latest.whl

is reformatted to https: //releases.wagtail.org/... — the injected space breaks the link and tox fails.

Cause

CONDITIONAL_MARKER ((?P<envs>[a-zA-Z0-9, ]+):(?P<value>.*)) recognises factor-conditional deps like py311: pytest. A URL scheme (https) is all alphanumerics followed by :, so https://... matches with envs="https", value="//...", and is re-emitted as f"{k}: {d}"https: //....

Fix

Add a (?!//) negative lookahead after the colon, so a scheme:// URL is never treated as a factor marker. A real factor-conditional never has // immediately after its colon, so behaviour for conditionals is unchanged. (git+https:// was already safe — the + isn't in the envs character class.)

Added test_deps_url_not_split_as_conditional; the full suite (95 passed, 1 skipped) and ruff check/ruff format --check stay green.

@gaborbernat
gaborbernat merged commit 69e8f0e into tox-dev:main Jul 26, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants