2019-05-15 06:56:31 +08:00
|
|
|
# -*- coding: utf-8 -*-
|
2018-05-24 00:12:04 +08:00
|
|
|
import py
|
2018-05-23 22:48:46 +08:00
|
|
|
|
2018-10-25 15:01:29 +08:00
|
|
|
import pytest
|
|
|
|
|
2009-11-24 22:16:58 +08:00
|
|
|
mydir = py.path.local(__file__).dirpath()
|
2009-09-11 18:05:06 +08:00
|
|
|
|
2018-05-23 22:48:46 +08:00
|
|
|
|
2009-09-11 18:05:06 +08:00
|
|
|
def pytest_runtest_setup(item):
|
2010-11-13 16:05:11 +08:00
|
|
|
if isinstance(item, pytest.Function):
|
2009-11-24 22:16:58 +08:00
|
|
|
if not item.fspath.relto(mydir):
|
|
|
|
return
|
2010-11-13 16:05:11 +08:00
|
|
|
mod = item.getparent(pytest.Module).obj
|
2018-05-23 22:48:46 +08:00
|
|
|
if hasattr(mod, "hello"):
|
2018-08-23 09:30:42 +08:00
|
|
|
print("mod.hello {!r}".format(mod.hello))
|