test_ok1/doc/en/example/assertion/global_testmodule_config/conftest.py

16 lines
364 B
Python
Raw Normal View History

# -*- coding: utf-8 -*-
import py
2018-05-23 22:48:46 +08:00
import pytest
mydir = py.path.local(__file__).dirpath()
2018-05-23 22:48:46 +08:00
def pytest_runtest_setup(item):
if isinstance(item, pytest.Function):
if not item.fspath.relto(mydir):
return
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))