Skip to content

Commit

Permalink
Fix docs formatting and improve test a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoddemus committed Aug 10, 2018
1 parent 50db718 commit 27b5435
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions testing/test_collection.py
Expand Up @@ -639,18 +639,21 @@ 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<x.py> -> Package<subdir> -> Session.
Session's parent should always be None.
"""
The parent chain should match: Module<x.py> -> Package<subdir> -> Session.
Session's parent should always be None.
"""
tmpdir = testdir.tmpdir
subdir = tmpdir.join("subdir")
x = subdir.ensure("x.py")
subdir.ensure("__init__.py")
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
Expand Down

0 comments on commit 27b5435

Please sign in to comment.