From 27bb2eceb43f9c2c3747cf3c0a2e999292d382fc Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Thu, 26 Oct 2017 20:15:05 -0200 Subject: [PATCH] Add comment about why we remove docstrings on test_assertrewrite As explained in pytest-dev/pytest#2870 --- testing/test_assertrewrite.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/testing/test_assertrewrite.py b/testing/test_assertrewrite.py index 45c0c7b16..02270e157 100644 --- a/testing/test_assertrewrite.py +++ b/testing/test_assertrewrite.py @@ -65,6 +65,9 @@ class TestAssertionRewrite(object): def test_place_initial_imports(self): s = """'Doc string'\nother = stuff""" m = rewrite(s) + # Module docstrings in 3.7 are part of Module node, it's not in the body + # so we remove it so the following body items have the same indexes on + # all Python versions if sys.version_info < (3, 7): assert isinstance(m.body[0], ast.Expr) assert isinstance(m.body[0].value, ast.Str)