@@ -111,7 +111,7 @@ def add_gitignore(_name):
111
111
)
112
112
113
113
114
- @pytest .mark .parametrize ("install_type" , ["requirements" , "pyproject" ])
114
+ @pytest .mark .parametrize ("install_type" , ["requirements" , "pyproject" , "both" ])
115
115
def test_install_packages (install_type ):
116
116
importlib .reload (create_venv )
117
117
create_venv .is_installed = lambda _x : True
@@ -120,16 +120,20 @@ def test_install_packages(install_type):
120
120
pip_upgraded = False
121
121
installing = None
122
122
123
+ order = []
124
+
123
125
def run_process (args , error_message ):
124
- nonlocal pip_upgraded , installing
126
+ nonlocal pip_upgraded , installing , order
125
127
if args [1 :] == ["-m" , "pip" , "install" , "--upgrade" , "pip" ]:
126
128
pip_upgraded = True
127
129
assert error_message == "CREATE_VENV.UPGRADE_PIP_FAILED"
128
130
elif args [1 :- 1 ] == ["-m" , "pip" , "install" , "-r" ]:
129
131
installing = "requirements"
132
+ order += ["requirements" ]
130
133
assert error_message == "CREATE_VENV.PIP_FAILED_INSTALL_REQUIREMENTS"
131
134
elif args [1 :] == ["-m" , "pip" , "install" , "-e" , ".[test]" ]:
132
135
installing = "pyproject"
136
+ order += ["pyproject" ]
133
137
assert error_message == "CREATE_VENV.PIP_FAILED_INSTALL_PYPROJECT"
134
138
135
139
create_venv .run_process = run_process
@@ -138,9 +142,23 @@ def run_process(args, error_message):
138
142
create_venv .main (["--requirements" , "requirements-for-test.txt" ])
139
143
elif install_type == "pyproject" :
140
144
create_venv .main (["--toml" , "pyproject.toml" , "--extras" , "test" ])
145
+ elif install_type == "both" :
146
+ create_venv .main (
147
+ [
148
+ "--requirements" ,
149
+ "requirements-for-test.txt" ,
150
+ "--toml" ,
151
+ "pyproject.toml" ,
152
+ "--extras" ,
153
+ "test" ,
154
+ ]
155
+ )
141
156
142
157
assert pip_upgraded
143
- assert installing == install_type
158
+ if install_type == "both" :
159
+ assert order == ["requirements" , "pyproject" ]
160
+ else :
161
+ assert installing == install_type
144
162
145
163
146
164
@pytest .mark .parametrize (
0 commit comments