rather named the new hook cmdline_preparse
This commit is contained in:
parent
9ab256c296
commit
a15983cb33
|
@ -306,7 +306,7 @@ class Config(object):
|
||||||
self._setinitialconftest(args)
|
self._setinitialconftest(args)
|
||||||
self.pluginmanager.do_addoption(self._parser)
|
self.pluginmanager.do_addoption(self._parser)
|
||||||
if addopts:
|
if addopts:
|
||||||
self.hook.pytest_cmdline_processargs(config=self, args=args)
|
self.hook.pytest_cmdline_preparse(config=self, args=args)
|
||||||
|
|
||||||
def _checkversion(self):
|
def _checkversion(self):
|
||||||
minver = self.inicfg.get('minversion', None)
|
minver = self.inicfg.get('minversion', None)
|
||||||
|
|
|
@ -19,7 +19,7 @@ def pytest_cmdline_parse(pluginmanager, args):
|
||||||
"""return initialized config object, parsing the specified args. """
|
"""return initialized config object, parsing the specified args. """
|
||||||
pytest_cmdline_parse.firstresult = True
|
pytest_cmdline_parse.firstresult = True
|
||||||
|
|
||||||
def pytest_cmdline_processargs(config, args):
|
def pytest_cmdline_preparse(config, args):
|
||||||
"""modify command line arguments before option parsing. """
|
"""modify command line arguments before option parsing. """
|
||||||
|
|
||||||
def pytest_addoption(parser):
|
def pytest_addoption(parser):
|
||||||
|
|
|
@ -154,7 +154,7 @@ the command line arguments before they get processed::
|
||||||
|
|
||||||
# content of conftest.py
|
# content of conftest.py
|
||||||
import sys
|
import sys
|
||||||
def pytest_cmdline_processargs(args):
|
def pytest_cmdline_preparse(args):
|
||||||
if 'xdist' in sys.modules: # pytest-xdist plugin
|
if 'xdist' in sys.modules: # pytest-xdist plugin
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
num = max(multiprocessing.cpu_count() / 2, 1)
|
num = max(multiprocessing.cpu_count() / 2, 1)
|
||||||
|
|
|
@ -271,7 +271,7 @@ initialisation, command line and configuration hooks
|
||||||
|
|
||||||
.. currentmodule:: _pytest.hookspec
|
.. currentmodule:: _pytest.hookspec
|
||||||
|
|
||||||
.. autofunction:: pytest_cmdline_processargs
|
.. autofunction:: pytest_cmdline_preparse
|
||||||
.. autofunction:: pytest_cmdline_parse
|
.. autofunction:: pytest_cmdline_parse
|
||||||
.. autofunction:: pytest_namespace
|
.. autofunction:: pytest_namespace
|
||||||
.. autofunction:: pytest_addoption
|
.. autofunction:: pytest_addoption
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
"""
|
"""
|
||||||
unit and functional testing with Python.
|
unit and functional testing with Python.
|
||||||
"""
|
"""
|
||||||
__version__ = '2.0.1.dev4'
|
__version__ = '2.0.1.dev5'
|
||||||
__all__ = ['main']
|
__all__ = ['main']
|
||||||
|
|
||||||
from _pytest.core import main, UsageError, _preloadplugins
|
from _pytest.core import main, UsageError, _preloadplugins
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -22,7 +22,7 @@ def main():
|
||||||
name='pytest',
|
name='pytest',
|
||||||
description='py.test: simple powerful testing with Python',
|
description='py.test: simple powerful testing with Python',
|
||||||
long_description = long_description,
|
long_description = long_description,
|
||||||
version='2.0.1.dev4',
|
version='2.0.1.dev5',
|
||||||
url='http://pytest.org',
|
url='http://pytest.org',
|
||||||
license='MIT license',
|
license='MIT license',
|
||||||
platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'],
|
platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'],
|
||||||
|
|
|
@ -261,7 +261,7 @@ def test_plugin_preparse_prevents_setuptools_loading(testdir, monkeypatch):
|
||||||
|
|
||||||
def test_cmdline_processargs_simple(testdir):
|
def test_cmdline_processargs_simple(testdir):
|
||||||
testdir.makeconftest("""
|
testdir.makeconftest("""
|
||||||
def pytest_cmdline_processargs(args):
|
def pytest_cmdline_preparse(args):
|
||||||
args.append("-h")
|
args.append("-h")
|
||||||
""")
|
""")
|
||||||
result = testdir.runpytest()
|
result = testdir.runpytest()
|
||||||
|
|
Loading…
Reference in New Issue