Skip to content

pathlib.Path are not shown #98

Open
@buhtz

Description

@buhtz

Because pytest don't support subtests I have to use this addon here. I'm not sure if I do something wrong?

In short: Using a pathlib.Path object as argument in unittest.subTest() the string representation of that object isn't used. I just see (<subtest>) in the output for each subtest.

This is a snippet of an unittest of mine:

expect_folder = pathlib.Path.cwd() / 'Beverly'
expect = [
    expect_folder / '_Elke.pickle',
    expect_folder / '_Foo.pickle',
    expect_folder / 'Bar.pickle',
    expect_folder / 'Wurst.pickle',
]
for fp in expect:
    with self.subTest(fp):
        self.assertTrue(fp.exists())

That is the output for each subtest FolderModeFS.test_build_container (<subtest>) .

When I wrap fp in str() like this

with self.subTest(str(fp)):

The output looks like this

FolderModeFS.test_build_container [/Beverly/Wurst.pickle]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions