Skip to content

Commit

Permalink
Add example script and failure for pytest-dev#3742
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoddemus committed Jul 31, 2018
1 parent 2534193 commit e1ad1a1
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
10 changes: 10 additions & 0 deletions testing/example_scripts/fixtures/custom_item/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import pytest


class CustomItem(pytest.Item, pytest.File):
def runtest(self):
pass


def pytest_collect_file(path, parent):
return CustomItem(path, parent)
Empty file.
2 changes: 2 additions & 0 deletions testing/example_scripts/fixtures/custom_item/foo/test_foo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def test():
pass
5 changes: 5 additions & 0 deletions testing/python/fixture.py
Original file line number Diff line number Diff line change
Expand Up @@ -1619,6 +1619,11 @@ def test_package(one):
reprec = testdir.inline_run()
reprec.assertoutcome(passed=2)

def test_collect_custom_items(self, testdir):
testdir.copy_example("fixtures/custom_item")
result = testdir.runpytest("foo")
result.stdout.fnmatch_lines("*passed*")


class TestAutouseDiscovery(object):
@pytest.fixture
Expand Down

0 comments on commit e1ad1a1

Please sign in to comment.