added another funcarg example i had lying around
--HG-- branch : trunk
This commit is contained in:
parent
22c1ad9f7b
commit
d4d0226058
|
@ -0,0 +1,7 @@
|
||||||
|
import py
|
||||||
|
|
||||||
|
def pytest_runtest_setup(item):
|
||||||
|
if isinstance(item, py.test.collect.Function):
|
||||||
|
mod = item.getparent(py.test.collect.Module).obj
|
||||||
|
if hasattr(mod, 'hello'):
|
||||||
|
py.builtin.print_("mod.hello", mod.hello)
|
|
@ -0,0 +1,5 @@
|
||||||
|
|
||||||
|
hello = "world"
|
||||||
|
|
||||||
|
def test_func():
|
||||||
|
pass
|
|
@ -0,0 +1,15 @@
|
||||||
|
# conftest.py
|
||||||
|
import py
|
||||||
|
|
||||||
|
|
||||||
|
def pytest_addoption(parser):
|
||||||
|
grp = parser.addgroup("testserver options")
|
||||||
|
grp.addoption("--url", action="store", default=None,
|
||||||
|
help="url for testserver")
|
||||||
|
|
||||||
|
def pytest_funcarg__url(request):
|
||||||
|
url = request.config.getvalue("url")
|
||||||
|
if url is None:
|
||||||
|
py.test.skip("need --url")
|
||||||
|
return url
|
||||||
|
|
Loading…
Reference in New Issue