@@ -364,7 +364,19 @@ def test_create_long_path(tmp_path):
364
364
@pytest .mark .parametrize ("creator" , sorted (set (PythonInfo .current_system ().creators ().key_to_class ) - {"builtin" }))
365
365
@pytest .mark .usefixtures ("session_app_data" )
366
366
def test_create_distutils_cfg (creator , tmp_path , monkeypatch ):
367
- result = cli_run ([str (tmp_path / "venv" ), "--activators" , "" , "--creator" , creator ])
367
+ result = cli_run (
368
+ [
369
+ str (tmp_path / "venv" ),
370
+ "--activators" ,
371
+ "" ,
372
+ "--creator" ,
373
+ creator ,
374
+ "--setuptools" ,
375
+ "bundle" ,
376
+ "--wheel" ,
377
+ "bundle" ,
378
+ ],
379
+ )
368
380
369
381
app = Path (__file__ ).parent / "console_app"
370
382
dest = tmp_path / "console_app"
@@ -417,7 +429,9 @@ def list_files(path):
417
429
418
430
def test_zip_importer_can_import_setuptools (tmp_path ):
419
431
"""We're patching the loaders so might fail on r/o loaders, such as zipimporter on CPython<3.8"""
420
- result = cli_run ([str (tmp_path / "venv" ), "--activators" , "" , "--no-pip" , "--no-wheel" , "--copies" ])
432
+ result = cli_run (
433
+ [str (tmp_path / "venv" ), "--activators" , "" , "--no-pip" , "--no-wheel" , "--copies" , "--setuptools" , "bundle" ],
434
+ )
421
435
zip_path = tmp_path / "site-packages.zip"
422
436
with zipfile .ZipFile (str (zip_path ), "w" , zipfile .ZIP_DEFLATED ) as zip_handler :
423
437
lib = str (result .creator .purelib )
@@ -451,6 +465,7 @@ def test_no_preimport_threading(tmp_path):
451
465
out = subprocess .check_output (
452
466
[str (session .creator .exe ), "-c" , r"import sys; print('\n'.join(sorted(sys.modules)))" ],
453
467
text = True ,
468
+ encoding = "utf-8" ,
454
469
)
455
470
imported = set (out .splitlines ())
456
471
assert "threading" not in imported
@@ -467,6 +482,7 @@ def test_pth_in_site_vs_python_path(tmp_path):
467
482
out = subprocess .check_output (
468
483
[str (session .creator .exe ), "-c" , r"import sys; print(sys.testpth)" ],
469
484
text = True ,
485
+ encoding = "utf-8" ,
470
486
)
471
487
assert out == "ok\n "
472
488
# same with $PYTHONPATH pointing to site_packages
@@ -479,6 +495,7 @@ def test_pth_in_site_vs_python_path(tmp_path):
479
495
[str (session .creator .exe ), "-c" , r"import sys; print(sys.testpth)" ],
480
496
text = True ,
481
497
env = env ,
498
+ encoding = "utf-8" ,
482
499
)
483
500
assert out == "ok\n "
484
501
@@ -492,6 +509,7 @@ def test_getsitepackages_system_site(tmp_path):
492
509
out = subprocess .check_output (
493
510
[str (session .creator .exe ), "-c" , r"import site; print(site.getsitepackages())" ],
494
511
text = True ,
512
+ encoding = "utf-8" ,
495
513
)
496
514
site_packages = ast .literal_eval (out )
497
515
@@ -506,6 +524,7 @@ def test_getsitepackages_system_site(tmp_path):
506
524
out = subprocess .check_output (
507
525
[str (session .creator .exe ), "-c" , r"import site; print(site.getsitepackages())" ],
508
526
text = True ,
527
+ encoding = "utf-8" ,
509
528
)
510
529
site_packages = [str (Path (i ).resolve ()) for i in ast .literal_eval (out )]
511
530
@@ -531,6 +550,7 @@ def test_get_site_packages(tmp_path):
531
550
out = subprocess .check_output (
532
551
[str (session .creator .exe ), "-c" , r"import site; print(site.getsitepackages())" ],
533
552
text = True ,
553
+ encoding = "utf-8" ,
534
554
)
535
555
site_packages = ast .literal_eval (out )
536
556
@@ -569,7 +589,7 @@ def _get_sys_path(flag=None):
569
589
if flag :
570
590
cmd .append (flag )
571
591
cmd .extend (["-c" , "import json; import sys; print(json.dumps(sys.path))" ])
572
- return [i if case_sensitive else i .lower () for i in json .loads (subprocess .check_output (cmd ))]
592
+ return [i if case_sensitive else i .lower () for i in json .loads (subprocess .check_output (cmd , encoding = "utf-8" ))]
573
593
574
594
monkeypatch .delenv ("PYTHONPATH" , raising = False )
575
595
base = _get_sys_path ()
0 commit comments