11from __future__ import annotations
22
33import sys
4- import warnings
54from typing import TYPE_CHECKING
65
76import pytest
@@ -21,17 +20,38 @@ def test_download_cli_flag(args, download, tmp_path):
2120 assert session .seeder .download is download
2221
2322
24- @pytest .mark .skipif (sys .version_info [:2 ] == (3 , 8 ), reason = "We still bundle wheels for Python 3.8" )
25- def test_download_deprecated_cli_flag (tmp_path ):
26- with warnings .catch_warnings (record = True ) as w :
27- warnings .simplefilter ("always" )
28- session_via_cli (["--no-wheel" , str (tmp_path )])
29- assert len (w ) == 1
30- assert issubclass (w [- 1 ].category , DeprecationWarning )
31- assert str (w [- 1 ].message ) == (
32- "The --no-wheel option is deprecated. It has no effect for Python >= "
33- "3.8 as wheel is no longer bundled in virtualenv."
34- )
23+ @pytest .mark .skipif (sys .version_info [:2 ] == (3 , 8 ), reason = "We still bundle wheel for Python 3.8" )
24+ @pytest .mark .parametrize ("flag" , ["--no-wheel" , "--wheel=none" , "--wheel=embed" , "--wheel=bundle" ])
25+ def test_wheel_cli_flags_do_nothing (tmp_path , flag ):
26+ session = session_via_cli ([flag , str (tmp_path )])
27+ if sys .version_info [:2 ] >= (3 , 12 ):
28+ expected = {"pip" : "bundle" }
29+ else :
30+ expected = {"pip" : "bundle" , "setuptools" : "bundle" }
31+ assert session .seeder .distribution_to_versions () == expected
32+
33+
34+ @pytest .mark .skipif (sys .version_info [:2 ] == (3 , 8 ), reason = "We still bundle wheel for Python 3.8" )
35+ @pytest .mark .parametrize ("flag" , ["--no-wheel" , "--wheel=none" , "--wheel=embed" , "--wheel=bundle" ])
36+ def test_wheel_cli_flags_warn (tmp_path , flag , capsys ):
37+ session_via_cli ([flag , str (tmp_path )])
38+ out , err = capsys .readouterr ()
39+ assert "The --no-wheel and --wheel options are deprecated." in out + err
40+
41+
42+ @pytest .mark .skipif (sys .version_info [:2 ] == (3 , 8 ), reason = "We still bundle wheel for Python 3.8" )
43+ def test_unused_wheel_cli_flags_dont_warn (tmp_path , capsys ):
44+ session_via_cli ([str (tmp_path )])
45+ out , err = capsys .readouterr ()
46+ assert "The --no-wheel and --wheel options are deprecated." not in out + err
47+
48+
49+ @pytest .mark .skipif (sys .version_info [:2 ] != (3 , 8 ), reason = "We only bundle wheel for Python 3.8" )
50+ @pytest .mark .parametrize ("flag" , ["--no-wheel" , "--wheel=none" , "--wheel=embed" , "--wheel=bundle" ])
51+ def test_wheel_cli_flags_dont_warn_on_38 (tmp_path , flag , capsys ):
52+ session_via_cli ([flag , str (tmp_path )])
53+ out , err = capsys .readouterr ()
54+ assert "The --no-wheel and --wheel options are deprecated." not in out + err
3555
3656
3757def test_embed_wheel_versions (tmp_path : Path ) -> None :
0 commit comments