Docs
This commit is contained in:
parent
e867798f1a
commit
be27caa26c
1
AUTHORS
1
AUTHORS
|
@ -309,6 +309,7 @@ Pavel Karateev
|
||||||
Paweł Adamczak
|
Paweł Adamczak
|
||||||
Pedro Algarvio
|
Pedro Algarvio
|
||||||
Petter Strandmark
|
Petter Strandmark
|
||||||
|
Philipp A.
|
||||||
Philipp Loose
|
Philipp Loose
|
||||||
Pierre Sassoulas
|
Pierre Sassoulas
|
||||||
Pieter Mulder
|
Pieter Mulder
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Fix some instances of importing doctests’ parent modules when using `--import-mode=importlib`.
|
|
@ -173,6 +173,9 @@ ignore = [
|
||||||
[tool.ruff.format]
|
[tool.ruff.format]
|
||||||
docstring-code-format = true
|
docstring-code-format = true
|
||||||
|
|
||||||
|
[tool.ruff.lint]
|
||||||
|
allowed-confusables = ["’", "×"]
|
||||||
|
|
||||||
[tool.ruff.lint.pycodestyle]
|
[tool.ruff.lint.pycodestyle]
|
||||||
# In order to be able to format for 88 char in ruff format
|
# In order to be able to format for 88 char in ruff format
|
||||||
max-line-length = 120
|
max-line-length = 120
|
||||||
|
|
|
@ -617,7 +617,7 @@ def module_name_from_path(path: Path, root: Path) -> str:
|
||||||
_module_name_from_path(path, dir)
|
_module_name_from_path(path, dir)
|
||||||
for dir in itertools.chain([root], map(Path, sys.path))
|
for dir in itertools.chain([root], map(Path, sys.path))
|
||||||
)
|
)
|
||||||
return ".".join(min(candidates, key=len))
|
return ".".join(min(candidates, key=len)) # type: ignore[arg-type]
|
||||||
|
|
||||||
|
|
||||||
def _module_name_from_path(path: Path, root: Path) -> tuple[str, ...]:
|
def _module_name_from_path(path: Path, root: Path) -> tuple[str, ...]:
|
||||||
|
|
|
@ -691,6 +691,7 @@ class TestImportLibMode:
|
||||||
init = pkgdir / "__init__.py"
|
init = pkgdir / "__init__.py"
|
||||||
init.write_text("", encoding="ascii")
|
init.write_text("", encoding="ascii")
|
||||||
|
|
||||||
|
# the PyTest root is `proj_dir`, but the package is imported from `pkgs_dir`
|
||||||
mod = import_path(init, root=proj_dir, mode=ImportMode.importlib)
|
mod = import_path(init, root=proj_dir, mode=ImportMode.importlib)
|
||||||
# assert that it’s imported with the canonical name, not “path.to.package.<name>”
|
# assert that it’s imported with the canonical name, not “path.to.package.<name>”
|
||||||
mod_names = [n for n, m in sys.modules.items() if m is mod]
|
mod_names = [n for n, m in sys.modules.items() if m is mod]
|
||||||
|
|
Loading…
Reference in New Issue