@@ -351,3 +351,72 @@ def test_install_skip_lock(pipenv_instance_private_pypi):
351
351
assert c .returncode == 0
352
352
c = p .pipenv ('run python -c "import six"' )
353
353
assert c .returncode == 0
354
+
355
+
356
+ @pytest .mark .install
357
+ @pytest .mark .skip_lock
358
+ def test_skip_lock_installs_correct_version (pipenv_instance_pypi ):
359
+ """Ensure --skip-lock installs the exact version specified in Pipfile."""
360
+ with pipenv_instance_pypi () as p :
361
+ with open (p .pipfile_path , "w" ) as f :
362
+ contents = """
363
+ [[source]]
364
+ url = "https://pypi.org/simple"
365
+ verify_ssl = true
366
+ name = "pypi"
367
+
368
+ [packages]
369
+ gunicorn = "==20.0.2"
370
+ """ .strip ()
371
+ f .write (contents )
372
+
373
+ # Install with --skip-lock
374
+ c = p .pipenv ("install --skip-lock" )
375
+ assert c .returncode == 0
376
+
377
+ # Verify installed version matches Pipfile specification
378
+ c = p .pipenv ("run pip freeze" )
379
+ assert c .returncode == 0
380
+
381
+ # Find gunicorn in pip freeze output
382
+ packages = [line .strip () for line in c .stdout .split ("\n " )]
383
+ gunicorn_line = next (line for line in packages if line .startswith ("gunicorn" ))
384
+
385
+ assert gunicorn_line == "gunicorn==20.0.2"
386
+
387
+
388
+ @pytest .mark .install
389
+ @pytest .mark .skip_lock
390
+ def test_skip_lock_respects_markers (pipenv_instance_pypi ):
391
+ """Ensure --skip-lock correctly handles packages with markers."""
392
+ with pipenv_instance_pypi () as p :
393
+ with open (p .pipfile_path , "w" ) as f :
394
+ contents = """
395
+ [[source]]
396
+ url = "https://pypi.org/simple"
397
+ verify_ssl = true
398
+ name = "pypi"
399
+
400
+ [packages]
401
+ # Use python version markers since they're platform-independent
402
+ simplejson = {version = "==3.17.2", markers = "python_version < '4'"}
403
+ urllib3 = {version = "==1.26.6", markers = "python_version < '2'"}
404
+ """ .strip ()
405
+ f .write (contents )
406
+
407
+ # Install with --skip-lock
408
+ c = p .pipenv ("install --skip-lock" )
409
+ assert c .returncode == 0
410
+
411
+ # Verify installed versions match markers
412
+ c = p .pipenv ("run pip freeze" )
413
+ assert c .returncode == 0
414
+ packages = [line .strip () for line in c .stdout .split ("\n " )]
415
+
416
+ # simplejson should be installed (python_version < '4' is always True for Python 3.x)
417
+ simplejson_line = next ((line for line in packages if line .startswith ("simplejson" )), None )
418
+ assert simplejson_line == "simplejson==3.17.2"
419
+
420
+ # urllib3 should not be installed (python_version < '2' is always False for Python 3.x)
421
+ urllib3_line = next ((line for line in packages if line .startswith ("urllib3" )), None )
422
+ assert urllib3_line is None
0 commit comments