Skip to content

Commit e3dc34e

Browse files
author
hauntsaninja
committed
fixup comments
1 parent da66f00 commit e3dc34e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/_pytest/assertion/rewrite.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -685,8 +685,8 @@ def run(self, mod: ast.Module) -> None:
685685
# Nothing to do.
686686
return
687687

688-
# Insert some special imports at the top of the module but after any
689-
# docstrings and __future__ imports.
688+
# We'll insert some special imports at the top of the module, but after any
689+
# docstrings and __future__ imports, so first figure out where that is.
690690
doc = getattr(mod, "docstring", None)
691691
expect_docstring = doc is None
692692
if doc is not None and self.is_rewrite_disabled(doc):
@@ -718,6 +718,7 @@ def run(self, mod: ast.Module) -> None:
718718
lineno = item.decorator_list[0].lineno
719719
else:
720720
lineno = item.lineno
721+
# Now actually insert the special imports.
721722
if sys.version_info >= (3, 10):
722723
aliases = [
723724
ast.alias("builtins", "@py_builtins", lineno=lineno, col_offset=0),
@@ -737,6 +738,7 @@ def run(self, mod: ast.Module) -> None:
737738
ast.Import([alias], lineno=lineno, col_offset=0) for alias in aliases
738739
]
739740
mod.body[pos:pos] = imports
741+
740742
# Collect asserts.
741743
nodes: List[ast.AST] = [mod]
742744
while nodes:

0 commit comments

Comments
 (0)