diff --git a/tasks/make_zipapp.py b/tasks/make_zipapp.py index f83b9fff3..546d826cf 100644 --- a/tasks/make_zipapp.py +++ b/tasks/make_zipapp.py @@ -180,7 +180,7 @@ def get_dependencies(whl, version): platforms = [] platform_positions = WheelDownloader._marker_at(markers, "sys_platform") deleted = 0 - for pos in platform_positions: # can only be ore meaningfully + for pos in platform_positions: # can only be or meaningfully platform = f"{markers[pos][1].value}{markers[pos][2].value}" deleted += WheelDownloader._del_marker_at(markers, pos - deleted) platforms.append(platform) diff --git a/tests/unit/activation/test_python_activator.py b/tests/unit/activation/test_python_activator.py index 3da4331b1..24a3561c5 100644 --- a/tests/unit/activation/test_python_activator.py +++ b/tests/unit/activation/test_python_activator.py @@ -18,7 +18,7 @@ def __init__(self, session) -> None: sys.executable, activate_script="activate_this.py", extension="py", - non_source_fail_message="You must use exec(open(this_file).read(), {'__file__': this_file})", + non_source_fail_message="You must use import runpy; runpy.run_path(this_file)", ) self.unix_line_ending = not IS_WIN @@ -36,6 +36,7 @@ def _get_test_lines(activate_script): import os import sys import platform + import runpy def print_r(value): print(repr(value)) @@ -47,10 +48,7 @@ def print_r(value): file_at = {str(activate_script)!r} # CPython 2 requires non-ascii path open to be unicode - with open(file_at, "r", encoding='utf-8') as file_handler: - content = file_handler.read() - exec(content, {{"__file__": file_at}}) - + runpy.run_path(file_at) print_r(os.environ.get("VIRTUAL_ENV")) print_r(os.environ.get("VIRTUAL_ENV_PROMPT")) print_r(os.environ.get("PATH").split(os.pathsep))