Skip to content

Running "tests/runtests.py" on Windows #13936

@hunterhogan

Description

@hunterhogan
(.venv) C:\clones\typeshed>tests\runtests -h
usage: runtests.py [-h] [--run-stubtest] [--python-version {3.9,3.10,3.11,3.12,3.13}] path

positional arguments:
  path                  Path of the stub to test in format <folder>/<stub>, from the root of the project.

...

(.venv) C:\clones\typeshed>tests\runtests.py /clones/typeshed/stdlib/ast.pyi                           
usage: runtests.py [-h] [--run-stubtest] [--python-version {3.9,3.10,3.11,3.12,3.13}] path
runtests.py: error: 'path' argument should be in format <folder>/<stub>.

Oh, oops!

(.venv) C:\clones\typeshed>tests\runtests.py stdlib/ast.pyi

...

--- TEST SUMMARY: One or more tests failed. See above for details. ---

pre-commit Success
Check structure: Success
Pyright: Success
mypy: Success
stubtest: Success
pytype: Failed
Pyright regression tests: Success
mypy regression test: Success

I troubleshoot for at least two hours, including reinstalling venv and installing editable ts_utils.

# to typeshed. Installing ts_utils editable would solve that, see

Now, pytype passes if I run it directly.

(.venv) C:\clones\typeshed\tests>pytype_test.py --print-stderr --typeshed-location /clones/typeshed \clones\typeshed\stdlib\ast.pyi 
Testing files with pytype...
Ran pytype with 1 pyis, got 0 errors.

The solution

After another 30 minutes, I am able to get:

(.venv) C:\clones\typeshed>tests\runtests.py stdlib\ast.pyi

...

--- TEST SUMMARY: All tests passed! ---

pre-commit Success
Check structure: Success
Pyright: Success
mypy: Success
stubtest: Success
pytype: Success
Pyright regression tests: Success
mypy regression test: Success

That was the solution. I didn't need to spend all that time troubleshooting and reinstalling.

from pathlib import PurePath

print(f"...in format {PurePath('<folder>', '<stub>')}")

import os.path

print(f"...in format <folder>{os.path.sep}<stub>")
(.venv) C:\clones\typeshed>C:\clones\typeshed\.venv\Scripts\python.exe c:/clones/typeshed/pp.py
...in format <folder>\<stub>
...in format <folder>\<stub>

How it looks on Linux-->

I prefer pathlib because it's a little more semantic.

Metadata

Metadata

Assignees

No one assigned

    Labels

    project: infrastructuretypeshed build, test, documentation, or distribution related

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions