Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit31e1c03

Browse files
committed
Use static notation forsetuptools in installation test
The `VirtualEnvironment` test helper is used in multiple places,but it is only told to install/upgrade `pip` when used from`test_installation`. It implements the functionality it wouldideally obtain by `upgrade_deps`, since the `upgrade_deps`parameter is only avaiilable in `venv` when using Python 3.9 andlater.When `pip` is installed, `upgrade_deps` would install `setuptools`when using Python 3.11 or lower, but not when using Python 3.12 orhigher. `VirtualEnvironment` does the same. (The reason for this isnot just to avoid needlessly departing from what `upgrade_deps`would do. Rather, it should not generally be necessary to have`setuptools` installed for package management since Python 3.12,and if it were necessary then this would a bug we would want todetect while running tests.)Previously this conditional specification of `setuptools` was doneby building different lists of package arguments to pass to `pip`,by checking `sys.version_info` to decide whether to append thestring `setuptools`.This commit changes how it is done, to use a static list of packagearguments instead. (The Python intepreter path continues to beobtained dynamically, but all its positional arguments, includingthose specifying packages, are now string literals.) Theconditional `setuptools` requirement is now expressed staticallyusing notation recognized by `pip`, as the string`setuptools; python_version<"3.12"`.
1 parente337e99 commit31e1c03

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

‎test/lib/helper.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -415,9 +415,15 @@ def __init__(self, env_dir, *, with_pip):
415415

416416
ifwith_pip:
417417
# The upgrade_deps parameter to venv.create is 3.9+ only, so do it this way.
418-
command= [self.python,"-m","pip","install","--upgrade","pip"]
419-
ifsys.version_info< (3,12):
420-
command.append("setuptools")
418+
command= [
419+
self.python,
420+
"-m",
421+
"pip",
422+
"install",
423+
"--upgrade",
424+
"pip",
425+
'setuptools; python_version<"3.12"',
426+
]
421427
subprocess.check_output(command)
422428

423429
@property

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp