1
1
Fork 0
mirror of https://github.com/pypa/pip synced 2023-12-13 21:30:23 +01:00
pip/tests/unit/test_utils_filesystem.py
Tzu-ping Chung 42359a9605 Migrate tests to use pathlib.Path
The pip-specific Path implementation has been removed, and all its
usages replaced by pathlib.Path. The tmpdir and tmpdir_factory fixtures
are also removed, and all usages are replaced by tmp_path and
tmp_path_factory, which use pathlib.Path.

The pip() function now also accepts pathlib.Path so we don't need to put
str() everywhere. Path arguments are coerced with os.fspath() into str.
2022-06-08 19:58:46 +08:00

20 lines
342 B
Python

import os
from pathlib import Path
def make_file(path: str) -> None:
Path(path).touch()
def make_valid_symlink(path: str) -> None:
target = path + "1"
make_file(target)
os.symlink(target, path)
def make_broken_symlink(path: str) -> None:
os.symlink("foo", path)
def make_dir(path: str) -> None:
os.mkdir(path)