@@ -107,14 +107,7 @@ def _test_simple(env):
107107                extra_pip_args  =  [],
108108                sdist  =  None ,
109109                is_exposed  =  True ,
110-                 srcs  =  struct (
111-                     marker  =  "" ,
112-                     requirement  =  "foo[extra]==0.0.1" ,
113-                     requirement_line  =  "foo[extra]==0.0.1 --hash=sha256:deadbeef" ,
114-                     shas  =  ["deadbeef" ],
115-                     version  =  "0.0.1" ,
116-                     url  =  "" ,
117-                 ),
110+                 line  =  "foo[extra]==0.0.1 --hash=sha256:deadbeef" ,
118111                target_platforms  =  [
119112                    "linux_x86_64" ,
120113                    "windows_x86_64" ,
@@ -123,12 +116,6 @@ def _test_simple(env):
123116            ),
124117        ],
125118    })
126-     env .expect .that_str (
127-         select_requirement (
128-             got ["foo" ],
129-             platform  =  "linux_x86_64" ,
130-         ).srcs .version ,
131-     ).equals ("0.0.1" )
132119
133120_tests .append (_test_simple )
134121
@@ -147,14 +134,7 @@ def _test_direct_urls_integration(env):
147134                extra_pip_args  =  [],
148135                sdist  =  None ,
149136                is_exposed  =  True ,
150-                 srcs  =  struct (
151-                     marker  =  "" ,
152-                     requirement  =  "foo[extra]" ,
153-                     requirement_line  =  "foo[extra] @ https://some-url/package.whl" ,
154-                     shas  =  [],
155-                     version  =  "" ,
156-                     url  =  "https://some-url/package.whl" ,
157-                 ),
137+                 line  =  "foo[extra]" ,
158138                target_platforms  =  ["linux_x86_64" ],
159139                whls  =  [struct (
160140                    url  =  "https://some-url/package.whl" ,
@@ -183,27 +163,14 @@ def _test_extra_pip_args(env):
183163                extra_pip_args  =  ["--index-url=example.org" , "--trusted-host=example.org" ],
184164                sdist  =  None ,
185165                is_exposed  =  True ,
186-                 srcs  =  struct (
187-                     marker  =  "" ,
188-                     requirement  =  "foo[extra]==0.0.1" ,
189-                     requirement_line  =  "foo[extra]==0.0.1 --hash=sha256:deadbeef" ,
190-                     shas  =  ["deadbeef" ],
191-                     version  =  "0.0.1" ,
192-                     url  =  "" ,
193-                 ),
166+                 line  =  "foo[extra]==0.0.1 --hash=sha256:deadbeef" ,
194167                target_platforms  =  [
195168                    "linux_x86_64" ,
196169                ],
197170                whls  =  [],
198171            ),
199172        ],
200173    })
201-     env .expect .that_str (
202-         select_requirement (
203-             got ["foo" ],
204-             platform  =  "linux_x86_64" ,
205-         ).srcs .version ,
206-     ).equals ("0.0.1" )
207174
208175_tests .append (_test_extra_pip_args )
209176
@@ -221,14 +188,7 @@ def _test_dupe_requirements(env):
221188                extra_pip_args  =  [],
222189                sdist  =  None ,
223190                is_exposed  =  True ,
224-                 srcs  =  struct (
225-                     marker  =  "" ,
226-                     requirement  =  "foo[extra,extra_2]==0.0.1" ,
227-                     requirement_line  =  "foo[extra,extra_2]==0.0.1 --hash=sha256:deadbeef" ,
228-                     shas  =  ["deadbeef" ],
229-                     version  =  "0.0.1" ,
230-                     url  =  "" ,
231-                 ),
191+                 line  =  "foo[extra,extra_2]==0.0.1 --hash=sha256:deadbeef" ,
232192                target_platforms  =  ["linux_x86_64" ],
233193                whls  =  [],
234194            ),
@@ -251,14 +211,7 @@ def _test_multi_os(env):
251211            struct (
252212                distribution  =  "bar" ,
253213                extra_pip_args  =  [],
254-                 srcs  =  struct (
255-                     marker  =  "" ,
256-                     requirement  =  "bar==0.0.1" ,
257-                     requirement_line  =  "bar==0.0.1 --hash=sha256:deadb00f" ,
258-                     shas  =  ["deadb00f" ],
259-                     version  =  "0.0.1" ,
260-                     url  =  "" ,
261-                 ),
214+                 line  =  "bar==0.0.1 --hash=sha256:deadb00f" ,
262215                target_platforms  =  ["windows_x86_64" ],
263216                whls  =  [],
264217                sdist  =  None ,
@@ -269,14 +222,7 @@ def _test_multi_os(env):
269222            struct (
270223                distribution  =  "foo" ,
271224                extra_pip_args  =  [],
272-                 srcs  =  struct (
273-                     marker  =  "" ,
274-                     requirement  =  "foo==0.0.3" ,
275-                     requirement_line  =  "foo==0.0.3 --hash=sha256:deadbaaf" ,
276-                     shas  =  ["deadbaaf" ],
277-                     version  =  "0.0.3" ,
278-                     url  =  "" ,
279-                 ),
225+                 line  =  "foo==0.0.3 --hash=sha256:deadbaaf" ,
280226                target_platforms  =  ["linux_x86_64" ],
281227                whls  =  [],
282228                sdist  =  None ,
@@ -285,14 +231,7 @@ def _test_multi_os(env):
285231            struct (
286232                distribution  =  "foo" ,
287233                extra_pip_args  =  [],
288-                 srcs  =  struct (
289-                     marker  =  "" ,
290-                     requirement  =  "foo[extra]==0.0.2" ,
291-                     requirement_line  =  "foo[extra]==0.0.2 --hash=sha256:deadbeef" ,
292-                     shas  =  ["deadbeef" ],
293-                     version  =  "0.0.2" ,
294-                     url  =  "" ,
295-                 ),
234+                 line  =  "foo[extra]==0.0.2 --hash=sha256:deadbeef" ,
296235                target_platforms  =  ["windows_x86_64" ],
297236                whls  =  [],
298237                sdist  =  None ,
@@ -304,8 +243,8 @@ def _test_multi_os(env):
304243        select_requirement (
305244            got ["foo" ],
306245            platform  =  "windows_x86_64" ,
307-         ).srcs . version ,
308-     ).equals ("0.0.2" )
246+         ).line ,
247+     ).equals ("foo[extra]== 0.0.2 --hash=sha256:deadbeef " )
309248
310249_tests .append (_test_multi_os )
311250
@@ -325,14 +264,7 @@ def _test_multi_os_legacy(env):
325264                extra_pip_args  =  ["--platform=manylinux_2_17_x86_64" , "--python-version=39" , "--implementation=cp" , "--abi=cp39" ],
326265                is_exposed  =  False ,
327266                sdist  =  None ,
328-                 srcs  =  struct (
329-                     marker  =  "" ,
330-                     requirement  =  "bar==0.0.1" ,
331-                     requirement_line  =  "bar==0.0.1 --hash=sha256:deadb00f" ,
332-                     shas  =  ["deadb00f" ],
333-                     version  =  "0.0.1" ,
334-                     url  =  "" ,
335-                 ),
267+                 line  =  "bar==0.0.1 --hash=sha256:deadb00f" ,
336268                target_platforms  =  ["cp39_linux_x86_64" ],
337269                whls  =  [],
338270            ),
@@ -343,14 +275,7 @@ def _test_multi_os_legacy(env):
343275                extra_pip_args  =  ["--platform=manylinux_2_17_x86_64" , "--python-version=39" , "--implementation=cp" , "--abi=cp39" ],
344276                is_exposed  =  True ,
345277                sdist  =  None ,
346-                 srcs  =  struct (
347-                     marker  =  "" ,
348-                     requirement  =  "foo==0.0.1" ,
349-                     requirement_line  =  "foo==0.0.1 --hash=sha256:deadbeef" ,
350-                     shas  =  ["deadbeef" ],
351-                     version  =  "0.0.1" ,
352-                     url  =  "" ,
353-                 ),
278+                 line  =  "foo==0.0.1 --hash=sha256:deadbeef" ,
354279                target_platforms  =  ["cp39_linux_x86_64" ],
355280                whls  =  [],
356281            ),
@@ -359,14 +284,7 @@ def _test_multi_os_legacy(env):
359284                extra_pip_args  =  ["--platform=macosx_10_9_arm64" , "--python-version=39" , "--implementation=cp" , "--abi=cp39" ],
360285                is_exposed  =  True ,
361286                sdist  =  None ,
362-                 srcs  =  struct (
363-                     marker  =  "" ,
364-                     requirement_line  =  "foo==0.0.3 --hash=sha256:deadbaaf" ,
365-                     requirement  =  "foo==0.0.3" ,
366-                     shas  =  ["deadbaaf" ],
367-                     version  =  "0.0.3" ,
368-                     url  =  "" ,
369-                 ),
287+                 line  =  "foo==0.0.3 --hash=sha256:deadbaaf" ,
370288                target_platforms  =  ["cp39_osx_aarch64" ],
371289                whls  =  [],
372290            ),
@@ -413,14 +331,7 @@ def _test_env_marker_resolution(env):
413331                extra_pip_args  =  [],
414332                is_exposed  =  True ,
415333                sdist  =  None ,
416-                 srcs  =  struct (
417-                     marker  =  "" ,
418-                     requirement  =  "bar==0.0.1" ,
419-                     requirement_line  =  "bar==0.0.1 --hash=sha256:deadbeef" ,
420-                     shas  =  ["deadbeef" ],
421-                     version  =  "0.0.1" ,
422-                     url  =  "" ,
423-                 ),
334+                 line  =  "bar==0.0.1 --hash=sha256:deadbeef" ,
424335                target_platforms  =  ["cp311_linux_super_exotic" , "cp311_windows_x86_64" ],
425336                whls  =  [],
426337            ),
@@ -431,25 +342,12 @@ def _test_env_marker_resolution(env):
431342                extra_pip_args  =  [],
432343                is_exposed  =  False ,
433344                sdist  =  None ,
434-                 srcs  =  struct (
435-                     marker  =  "marker" ,
436-                     requirement  =  "foo[extra]==0.0.1" ,
437-                     requirement_line  =  "foo[extra]==0.0.1 --hash=sha256:deadbeef" ,
438-                     shas  =  ["deadbeef" ],
439-                     version  =  "0.0.1" ,
440-                     url  =  "" ,
441-                 ),
345+                 line  =  "foo[extra]==0.0.1 --hash=sha256:deadbeef" ,
442346                target_platforms  =  ["cp311_windows_x86_64" ],
443347                whls  =  [],
444348            ),
445349        ],
446350    })
447-     env .expect .that_str (
448-         select_requirement (
449-             got ["foo" ],
450-             platform  =  "windows_x86_64" ,
451-         ).srcs .version ,
452-     ).equals ("0.0.1" )
453351
454352_tests .append (_test_env_marker_resolution )
455353
@@ -467,14 +365,7 @@ def _test_different_package_version(env):
467365                extra_pip_args  =  [],
468366                is_exposed  =  True ,
469367                sdist  =  None ,
470-                 srcs  =  struct (
471-                     marker  =  "" ,
472-                     requirement  =  "foo==0.0.1" ,
473-                     requirement_line  =  "foo==0.0.1 --hash=sha256:deadb00f" ,
474-                     shas  =  ["deadb00f" ],
475-                     version  =  "0.0.1" ,
476-                     url  =  "" ,
477-                 ),
368+                 line  =  "foo==0.0.1 --hash=sha256:deadb00f" ,
478369                target_platforms  =  ["linux_x86_64" ],
479370                whls  =  [],
480371            ),
@@ -483,14 +374,7 @@ def _test_different_package_version(env):
483374                extra_pip_args  =  [],
484375                is_exposed  =  True ,
485376                sdist  =  None ,
486-                 srcs  =  struct (
487-                     marker  =  "" ,
488-                     requirement  =  "foo==0.0.1+local" ,
489-                     requirement_line  =  "foo==0.0.1+local --hash=sha256:deadbeef" ,
490-                     shas  =  ["deadbeef" ],
491-                     version  =  "0.0.1+local" ,
492-                     url  =  "" ,
493-                 ),
377+                 line  =  "foo==0.0.1+local --hash=sha256:deadbeef" ,
494378                target_platforms  =  ["linux_x86_64" ],
495379                whls  =  [],
496380            ),
@@ -513,14 +397,7 @@ def _test_optional_hash(env):
513397                extra_pip_args  =  [],
514398                sdist  =  None ,
515399                is_exposed  =  True ,
516-                 srcs  =  struct (
517-                     marker  =  "" ,
518-                     requirement  =  "foo==0.0.4" ,
519-                     requirement_line  =  "foo==0.0.4 @ https://example.org/foo-0.0.4.whl" ,
520-                     shas  =  [],
521-                     version  =  "0.0.4" ,
522-                     url  =  "https://example.org/foo-0.0.4.whl" ,
523-                 ),
400+                 line  =  "foo==0.0.4" ,
524401                target_platforms  =  ["linux_x86_64" ],
525402                whls  =  [struct (
526403                    url  =  "https://example.org/foo-0.0.4.whl" ,
@@ -534,14 +411,7 @@ def _test_optional_hash(env):
534411                extra_pip_args  =  [],
535412                sdist  =  None ,
536413                is_exposed  =  True ,
537-                 srcs  =  struct (
538-                     marker  =  "" ,
539-                     requirement  =  "foo==0.0.5" ,
540-                     requirement_line  =  "foo==0.0.5 @ https://example.org/foo-0.0.5.whl --hash=sha256:deadbeef" ,
541-                     shas  =  ["deadbeef" ],
542-                     version  =  "0.0.5" ,
543-                     url  =  "https://example.org/foo-0.0.5.whl" ,
544-                 ),
414+                 line  =  "foo==0.0.5" ,
545415                target_platforms  =  ["linux_x86_64" ],
546416                whls  =  [struct (
547417                    url  =  "https://example.org/foo-0.0.5.whl" ,
@@ -569,14 +439,7 @@ def _test_git_sources(env):
569439                extra_pip_args  =  [],
570440                is_exposed  =  True ,
571441                sdist  =  None ,
572-                 srcs  =  struct (
573-                     marker  =  "" ,
574-                     requirement  =  "foo @ git+https://github.com/org/foo.git@deadbeef" ,
575-                     requirement_line  =  "foo @ git+https://github.com/org/foo.git@deadbeef" ,
576-                     shas  =  [],
577-                     url  =  "git+https://github.com/org/foo.git@deadbeef" ,
578-                     version  =  "" ,
579-                 ),
442+                 line  =  "foo @ git+https://github.com/org/foo.git@deadbeef" ,
580443                target_platforms  =  ["linux_x86_64" ],
581444                whls  =  [],
582445            ),
0 commit comments