rename `get_fixture` to `getfixture` to better match the current API style
--HG-- branch : doctest-fixtures
This commit is contained in:
parent
da3b42ce46
commit
dfcb0e322c
|
@ -78,7 +78,7 @@ class DoctestTextfile(DoctestItem, pytest.File):
|
||||||
failed, tot = doctest.testfile(
|
failed, tot = doctest.testfile(
|
||||||
str(self.fspath), module_relative=False,
|
str(self.fspath), module_relative=False,
|
||||||
optionflags=doctest.ELLIPSIS,
|
optionflags=doctest.ELLIPSIS,
|
||||||
extraglobs=dict(get_fixture=fixture_request.getfuncargvalue),
|
extraglobs=dict(getfixture=fixture_request.getfuncargvalue),
|
||||||
raise_on_error=True, verbose=0)
|
raise_on_error=True, verbose=0)
|
||||||
|
|
||||||
class DoctestModule(DoctestItem, pytest.File):
|
class DoctestModule(DoctestItem, pytest.File):
|
||||||
|
@ -94,5 +94,5 @@ class DoctestModule(DoctestItem, pytest.File):
|
||||||
fixture_request = FixtureRequest(self)
|
fixture_request = FixtureRequest(self)
|
||||||
failed, tot = doctest.testmod(
|
failed, tot = doctest.testmod(
|
||||||
module, raise_on_error=True, verbose=0,
|
module, raise_on_error=True, verbose=0,
|
||||||
extraglobs=dict(get_fixture=fixture_request.getfuncargvalue),
|
extraglobs=dict(getfixture=fixture_request.getfuncargvalue),
|
||||||
optionflags=doctest.ELLIPSIS)
|
optionflags=doctest.ELLIPSIS)
|
||||||
|
|
|
@ -51,8 +51,8 @@ then you can just invoke ``py.test`` without command line options::
|
||||||
|
|
||||||
========================= 1 passed in 0.02 seconds =========================
|
========================= 1 passed in 0.02 seconds =========================
|
||||||
|
|
||||||
It is possible to use fixtures using the ``get_fixture`` helper::
|
It is possible to use fixtures using the ``getfixture`` helper::
|
||||||
|
|
||||||
# content of example.rst
|
# content of example.rst
|
||||||
>>> tmp = get_fixture('tmpdir')
|
>>> tmp = getfixture('tmpdir')
|
||||||
>>> ...
|
>>> ...
|
||||||
|
|
|
@ -74,10 +74,10 @@ Python モジュール (通常 python テストモジュールを含む) の doc
|
||||||
========================= 1 passed in 0.02 seconds =========================
|
========================= 1 passed in 0.02 seconds =========================
|
||||||
|
|
||||||
..
|
..
|
||||||
It is possible to use fixtures using the ``get_fixture`` helper::
|
It is possible to use fixtures using the ``getfixture`` helper::
|
||||||
|
|
||||||
それは ``get_fixture`` ヘルパーを使ってフィクスチャを使用することが可能である::
|
それは ``getfixture`` ヘルパーを使ってフィクスチャを使用することが可能である::
|
||||||
|
|
||||||
# content of example.rst
|
# content of example.rst
|
||||||
>>> tmp = get_fixture('tmpdir')
|
>>> tmp = getfixture('tmpdir')
|
||||||
>>> ...
|
>>> ...
|
||||||
|
|
|
@ -127,7 +127,7 @@ class TestDoctests:
|
||||||
|
|
||||||
def test_txtfile_with_fixtures(self, testdir):
|
def test_txtfile_with_fixtures(self, testdir):
|
||||||
p = testdir.maketxtfile("""
|
p = testdir.maketxtfile("""
|
||||||
>>> dir = get_fixture('tmpdir')
|
>>> dir = getfixture('tmpdir')
|
||||||
>>> type(dir).__name__
|
>>> type(dir).__name__
|
||||||
'LocalPath'
|
'LocalPath'
|
||||||
""")
|
""")
|
||||||
|
@ -137,7 +137,7 @@ class TestDoctests:
|
||||||
def test_doctestmodule_with_fixtures(self, testdir):
|
def test_doctestmodule_with_fixtures(self, testdir):
|
||||||
p = testdir.makepyfile("""
|
p = testdir.makepyfile("""
|
||||||
'''
|
'''
|
||||||
>>> dir = get_fixture('tmpdir')
|
>>> dir = getfixture('tmpdir')
|
||||||
>>> type(dir).__name__
|
>>> type(dir).__name__
|
||||||
'LocalPath'
|
'LocalPath'
|
||||||
'''
|
'''
|
||||||
|
|
Loading…
Reference in New Issue