Skip to content

pytype conformance tests crash if no python3.11 executable is in PATH #1758

Open
@AlexWaygood

Description

@AlexWaygood

I attempted to run the conformance tests locally using Python 3.12, following the instructions given in https://github.com/python/typing/blob/main/conformance/README.md#running-the-conformance-test-tool. The mypy, pyright and pyre tests all ran, but the pytype tests crashed with the following traceback:

Running tests for pytype
Traceback (most recent call last):
  File "/Users/alexw/dev/typing/conformance/.venv/lib/python3.12/site-packages/pytype/config.py", line 704, in _store_python_version
    self.output_options.python_exe = compiler.get_python_executable(version)
                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/alexw/dev/typing/conformance/.venv/lib/python3.12/site-packages/pytype/pyc/compiler.py", line 135, in get_python_executable
    raise PythonNotFoundError()
pytype.pyc.compiler.PythonNotFoundError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/alexw/dev/typing/conformance/src/main.py", line 258, in <module>
    main()
  File "/Users/alexw/dev/typing/conformance/src/main.py", line 251, in main
    run_tests(root_dir, type_checker, test_cases, skip_timing=options.skip_timing)
  File "/Users/alexw/dev/typing/conformance/src/main.py", line 30, in run_tests
    tests_output = type_checker.run_tests([file.name for file in test_cases])
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/alexw/dev/typing/conformance/src/type_checker.py", line 287, in run_tests
    options = pytype_config.Options.create(python_version=(3, 11), quick=True)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/alexw/dev/typing/conformance/.venv/lib/python3.12/site-packages/pytype/config.py", line 107, in create
    return cls(options)
           ^^^^^^^^^^^^
  File "/Users/alexw/dev/typing/conformance/.venv/lib/python3.12/site-packages/pytype/config.py", line 88, in __init__
    Postprocessor(names, opt_map, options, self).process()
  File "/Users/alexw/dev/typing/conformance/.venv/lib/python3.12/site-packages/pytype/config.py", line 587, in process
    node.processor(value)
  File "/Users/alexw/dev/typing/conformance/.venv/lib/python3.12/site-packages/pytype/config.py", line 706, in _store_python_version
    self.error("Need a valid python%d.%d executable in $PATH" % version)
  File "/Users/alexw/dev/typing/conformance/.venv/lib/python3.12/site-packages/pytype/config.py", line 594, in error
    raise PostprocessingError(message)
pytype.config.PostprocessingError: Need a valid python3.11 executable in $PATH

It sounded like pytype wanted Python 3.11, so I tried again, this time creating an environment with Python 3.11. But I didn't get nearly as far:

(311-env) ~/dev/typing/conformance/src (type-type)⚡ % python main.py
Traceback (most recent call last):
  File "/Users/alexw/dev/typing/conformance/src/main.py", line 258, in <module>
    main()
  File "/Users/alexw/dev/typing/conformance/src/main.py", line 230, in main
    assert sys.version_info >= (3, 12)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions