From 27b5435a40384a7e5b2ba85a9916774d171c4d66 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Fri, 10 Aug 2018 18:18:07 -0300 Subject: [PATCH] Fix docs formatting and improve test a bit --- testing/test_collection.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/testing/test_collection.py b/testing/test_collection.py index 3b9c5df6cc4..5b494ba31af 100644 --- a/testing/test_collection.py +++ b/testing/test_collection.py @@ -639,9 +639,9 @@ def test_global_file(self, testdir, tmpdir): def test_pkgfile(self, testdir): """Verify nesting when a module is within a package. - The parent chain should match: Module -> Package -> Session. - Session's parent should always be None. - """ + The parent chain should match: Module -> Package -> Session. + Session's parent should always be None. + """ tmpdir = testdir.tmpdir subdir = tmpdir.join("subdir") x = subdir.ensure("x.py") @@ -649,8 +649,11 @@ def test_pkgfile(self, testdir): with subdir.as_cwd(): config = testdir.parseconfigure(x) col = testdir.getnode(config, x) - assert isinstance(col, pytest.Module) assert col.name == "x.py" + assert isinstance(col, pytest.Module) + assert isinstance(col.parent, pytest.Package) + assert isinstance(col.parent.parent, pytest.Session) + # session is batman (has no parents) assert col.parent.parent.parent is None for col in col.listchain(): assert col.config is config