def pytest_make_collect_report(collector):
    # noop if in non-IPython environment
    if not IPython.get_ipython():
        return None
    m = IPythonNamespaceCollector.from_parent(parent=collector,
                                              fspath=collector.fspath)
    return runner.pytest_make_collect_report(m)
Example #2
0
 def test_skip_at_module_scope(self, testdir):
     col = testdir.getmodulecol("""
         import pytest
         pytest.skip("hello")
         def test_func():
             pass
     """)
     rep = runner.pytest_make_collect_report(col)
     assert not rep.failed
     assert not rep.passed
     assert rep.skipped
Example #3
0
 def test_skip_at_module_scope(self, testdir):
     col = testdir.getmodulecol("""
         import pytest
         pytest.skip("hello")
         def test_func():
             pass
     """)
     rep = runner.pytest_make_collect_report(col)
     assert not rep.failed
     assert not rep.passed
     assert rep.skipped
Example #4
0
 def test_collect_result(self, testdir):
     col = testdir.getmodulecol("""
         def test_func1():
             pass
         class TestClass:
             pass
     """)
     rep = runner.pytest_make_collect_report(col)
     assert not rep.failed
     assert not rep.skipped
     assert rep.passed
     locinfo = rep.location
     assert locinfo[0] == col.fspath.basename
     assert not locinfo[1]
     assert locinfo[2] == col.fspath.basename
     res = rep.result
     assert len(res) == 2
     assert res[0].name == "test_func1"
     assert res[1].name == "TestClass"
Example #5
0
 def test_collect_result(self, testdir):
     col = testdir.getmodulecol("""
         def test_func1():
             pass
         class TestClass:
             pass
     """)
     rep = runner.pytest_make_collect_report(col)
     assert not rep.failed
     assert not rep.skipped
     assert rep.passed
     locinfo = rep.location
     assert locinfo[0] == col.fspath.basename
     assert not locinfo[1]
     assert locinfo[2] == col.fspath.basename
     res = rep.result
     assert len(res) == 2
     assert res[0].name == "test_func1"
     assert res[1].name == "TestClass"