B
    ܇\M                 @   s  d Z ddlmZ ddlmZ edZedddd Zeddd	d
 Zedddd Zedddd Z	edddd Z
dd Zedddd Zdd Zedddd Zdd Zdd Zedddd Zeddd d! Zd"d# Zd$d% Zd&d' Zd(d) Zd*d+ Zeddd,d- Zeddd.d/ Zeddd0d1 Zeddd2d3 Zd4d5 Zeddd6d7 Zeddd8d9 Zd:d; Zeddd<d= Z d>d? Z!d@dA Z"dBdC Z#dDdE Z$dFdG Z%edddHdI Z&dJdK Z'edddLdM Z(dNdO Z)dPdQ Z*dRdS Z+dTdU Z,dVdW Z-dXdY Z.dZd[ Z/eddd\d] Z0d^d_ Z1eded`dadb Z2edddcdd Z3edddedf Z4dgdh Z5didj Z6dkdl Z7dmdn Z8dodp Z9dqS )rzT hook specifications for pytest plugins, invoked from main.py and builtin plugins.      )HookspecMarker)PYTEST_LOGWARNINGZpytestT)historicc             C   s   dS )a.  called at plugin registration time to allow adding new hooks via a call to
    ``pluginmanager.add_hookspecs(module_or_class, prefix)``.


    :param _pytest.config.PytestPluginManager pluginmanager: pytest plugin manager

    .. note::
        This hook is incompatible with ``hookwrapper=True``.
    N )pluginmanagerr   r   /lib/python3.7/site-packages/_pytest/hookspec.pypytest_addhooks   s    
r   c             C   s   dS )z a new pytest plugin got registered.

    :param plugin: the plugin module or instance
    :param _pytest.config.PytestPluginManager manager: pytest plugin manager

    .. note::
        This hook is incompatible with ``hookwrapper=True``.
    Nr   )ZpluginZmanagerr   r   r   pytest_plugin_registered   s    	r	   c             C   s   dS )a  register argparse-style options and ini-style config values,
    called once at the beginning of a test run.

    .. note::

        This function should be implemented only in plugins or ``conftest.py``
        files situated at the tests root directory due to how pytest
        :ref:`discovers plugins during startup <pluginorder>`.

    :arg _pytest.config.Parser parser: To add command line options, call
        :py:func:`parser.addoption(...) <_pytest.config.Parser.addoption>`.
        To add ini-file values call :py:func:`parser.addini(...)
        <_pytest.config.Parser.addini>`.

    Options can later be accessed through the
    :py:class:`config <_pytest.config.Config>` object, respectively:

    - :py:func:`config.getoption(name) <_pytest.config.Config.getoption>` to
      retrieve the value of a command line option.

    - :py:func:`config.getini(name) <_pytest.config.Config.getini>` to retrieve
      a value read from an ini-style file.

    The config object is passed around on many internal objects via the ``.config``
    attribute or can be retrieved as the ``pytestconfig`` fixture.

    .. note::
        This hook is incompatible with ``hookwrapper=True``.
    Nr   )parserr   r   r   pytest_addoption&   s    r   c             C   s   dS )a  
    Allows plugins and conftest files to perform initial configuration.

    This hook is called for every plugin and initial conftest file
    after command line options have been parsed.

    After that, the hook is called for other conftest files as they are
    imported.

    .. note::
        This hook is incompatible with ``hookwrapper=True``.

    :arg _pytest.config.Config config: pytest config object
    Nr   )configr   r   r   pytest_configureG   s    r   )Zfirstresultc             C   s   dS )a  return initialized config object, parsing the specified args.

    Stops at first non-None result, see :ref:`firstresult`

    .. note::
        This hook will not be called for ``conftest.py`` files, only for setuptools plugins.

    :param _pytest.config.PytestPluginManager pluginmanager: pytest plugin manager
    :param list[str] args: list of arguments passed on the command line
    Nr   )r   argsr   r   r   pytest_cmdline_parse_   s    r   c             C   s   dS )a  (**Deprecated**) modify command line arguments before option parsing.

    This hook is considered deprecated and will be removed in a future pytest version. Consider
    using :func:`pytest_load_initial_conftests` instead.

    .. note::
        This hook will not be called for ``conftest.py`` files, only for setuptools plugins.

    :param _pytest.config.Config config: pytest config object
    :param list[str] args: list of arguments passed on the command line
    Nr   )r   r   r   r   r   pytest_cmdline_preparsem   s    r   c             C   s   dS )au   called for performing the main command line action. The default
    implementation will invoke the configure hooks and runtest_mainloop.

    .. note::
        This hook will not be called for ``conftest.py`` files, only for setuptools plugins.

    Stops at first non-None result, see :ref:`firstresult`

    :param _pytest.config.Config config: pytest config object
    Nr   )r   r   r   r   pytest_cmdline_main{   s    r   c             C   s   dS )a   implements the loading of initial conftest files ahead
    of command line option parsing.

    .. note::
        This hook will not be called for ``conftest.py`` files, only for setuptools plugins.

    :param _pytest.config.Config early_config: pytest config object
    :param list[str] args: list of arguments passed on the command line
    :param _pytest.config.Parser parser: to add command line options
    Nr   )Zearly_configr
   r   r   r   r   pytest_load_initial_conftests   s    
r   c             C   s   dS )zPerform the collection protocol for the given session.

    Stops at first non-None result, see :ref:`firstresult`.

    :param _pytest.main.Session session: the pytest session object
    Nr   )sessionr   r   r   pytest_collection   s    r   c             C   s   dS )a"   called after collection has been performed, may filter or re-order
    the items in-place.

    :param _pytest.main.Session session: the pytest session object
    :param _pytest.config.Config config: pytest config object
    :param List[_pytest.nodes.Item] items: list of item objects
    Nr   )r   r   itemsr   r   r   pytest_collection_modifyitems   s    r   c             C   s   dS )z called after collection has been performed and modified.

    :param _pytest.main.Session session: the pytest session object
    Nr   )r   r   r   r   pytest_collection_finish   s    r   c             C   s   dS )aI   return True to prevent considering this path for collection.
    This hook is consulted for all files and directories prior to calling
    more specific hooks.

    Stops at first non-None result, see :ref:`firstresult`

    :param str path: the path to analyze
    :param _pytest.config.Config config: pytest config object
    Nr   )pathr   r   r   r   pytest_ignore_collect   s    
r   c             C   s   dS )z called before traversing a directory for collection files.

    Stops at first non-None result, see :ref:`firstresult`

    :param str path: the path to analyze
    Nr   )r   parentr   r   r   pytest_collect_directory   s    r   c             C   s   dS )z return collection Node or None for the given path. Any new node
    needs to have the specified ``parent`` as a parent.

    :param str path: the path to collect
    Nr   )r   r   r   r   r   pytest_collect_file   s    r   c             C   s   dS )z collector starts collecting. Nr   )	collectorr   r   r   pytest_collectstart   s    r   c             C   s   dS )z  we just collected a test item. Nr   )itemr   r   r   pytest_itemcollected   s    r    c             C   s   dS )z  collector finished collecting. Nr   )reportr   r   r   pytest_collectreport   s    r"   c             C   s   dS )z. called for test items deselected by keyword. Nr   )r   r   r   r   pytest_deselected   s    r#   c             C   s   dS )zy perform ``collector.collect()`` and return a CollectReport.

    Stops at first non-None result, see :ref:`firstresult` Nr   )r   r   r   r   pytest_make_collect_report   s    r$   c             C   s   dS )a;   return a Module collector or None for the given path.
    This hook will be called for each matching test module path.
    The pytest_collect_file hook needs to be used if you want to
    create test modules for files that do not match as a test module.

    Stops at first non-None result, see :ref:`firstresult` Nr   )r   r   r   r   r   pytest_pycollect_makemodule   s    r%   c             C   s   dS )z return custom item/collector for a python object in a module, or None.

    Stops at first non-None result, see :ref:`firstresult` Nr   )r   nameobjr   r   r   pytest_pycollect_makeitem   s    r(   c             C   s   dS )z\ call underlying test function.

    Stops at first non-None result, see :ref:`firstresult` Nr   )Z
pyfuncitemr   r   r   pytest_pyfunc_call  s    r)   c             C   s   dS )z; generate (multiple) parametrized calls to a test function.Nr   )Zmetafuncr   r   r   pytest_generate_tests  s    r*   c             C   s   dS )a  Return a user-friendly string representation of the given ``val`` that will be used
    by @pytest.mark.parametrize calls. Return None if the hook doesn't know about ``val``.
    The parameter name is available as ``argname``, if required.

    Stops at first non-None result, see :ref:`firstresult`

    :param _pytest.config.Config config: pytest config object
    :param val: the parametrized value
    :param str argname: the automatic parameter name produced by pytest
    Nr   )r   valargnamer   r   r   pytest_make_parametrize_id  s    r-   c             C   s   dS )z called for performing the main runtest loop
    (after collection finished).

    Stops at first non-None result, see :ref:`firstresult`

    :param _pytest.main.Session session: the pytest session object
    Nr   )r   r   r   r   pytest_runtestloop#  s    r.   c             C   s   dS )z.(**Deprecated**) use pytest_runtest_logstart. Nr   )r   noder   r   r   pytest_itemstart.  s    r0   c             C   s   dS )a/   implements the runtest_setup/call/teardown protocol for
    the given test item, including capturing exceptions and calling
    reporting hooks.

    :arg item: test item for which the runtest protocol is performed.

    :arg nextitem: the scheduled-to-be-next test item (or None if this
                   is the end my friend).  This argument is passed on to
                   :py:func:`pytest_runtest_teardown`.

    :return boolean: True if no further hook implementations should be invoked.


    Stops at first non-None result, see :ref:`firstresult` Nr   )r   nextitemr   r   r   pytest_runtest_protocol2  s    r2   c             C   s   dS )a6   signal the start of running a single test item.

    This hook will be called **before** :func:`pytest_runtest_setup`, :func:`pytest_runtest_call` and
    :func:`pytest_runtest_teardown` hooks.

    :param str nodeid: full id of the item
    :param location: a triple of ``(filename, linenum, testname)``
    Nr   )nodeidlocationr   r   r   pytest_runtest_logstartD  s    r5   c             C   s   dS )a?   signal the complete finish of running a single test item.

    This hook will be called **after** :func:`pytest_runtest_setup`, :func:`pytest_runtest_call` and
    :func:`pytest_runtest_teardown` hooks.

    :param str nodeid: full id of the item
    :param location: a triple of ``(filename, linenum, testname)``
    Nr   )r3   r4   r   r   r   pytest_runtest_logfinishO  s    r6   c             C   s   dS )z. called before ``pytest_runtest_call(item)``. Nr   )r   r   r   r   pytest_runtest_setupZ  s    r7   c             C   s   dS )z& called to execute the test ``item``. Nr   )r   r   r   r   pytest_runtest_call^  s    r8   c             C   s   dS )aX   called after ``pytest_runtest_call``.

    :arg nextitem: the scheduled-to-be-next test item (None if no further
                   test item is scheduled).  This argument can be used to
                   perform exact teardowns, i.e. calling just enough finalizers
                   so that nextitem only needs to call setup-functions.
    Nr   )r   r1   r   r   r   pytest_runtest_teardownb  s    r9   c             C   s   dS )z return a :py:class:`_pytest.runner.TestReport` object
    for the given :py:class:`pytest.Item <_pytest.main.Item>` and
    :py:class:`_pytest.runner.CallInfo`.

    Stops at first non-None result, see :ref:`firstresult` Nr   )r   callr   r   r   pytest_runtest_makereportl  s    r;   c             C   s   dS )ze process a test setup/call/teardown report relating to
    the respective phase of executing a test. Nr   )r!   r   r   r   pytest_runtest_logreportu  s    r<   c             C   s   dS )aw   performs fixture setup execution.

    :return: The return value of the call to the fixture function

    Stops at first non-None result, see :ref:`firstresult`

    .. note::
        If the fixture function returns None, other implementations of
        this hook function will continue to be called, according to the
        behavior of the :ref:`firstresult` option.
    Nr   )
fixturedefrequestr   r   r   pytest_fixture_setup  s    r?   c             C   s   dS )z called after fixture teardown, but before the cache is cleared so
    the fixture result cache ``fixturedef.cached_result`` can
    still be accessed.Nr   )r=   r>   r   r   r   pytest_fixture_post_finalizer  s    r@   c             C   s   dS )z called after the ``Session`` object has been created and before performing collection
    and entering the run test loop.

    :param _pytest.main.Session session: the pytest session object
    Nr   )r   r   r   r   pytest_sessionstart  s    rA   c             C   s   dS )z called after whole test run finished, right before returning the exit status to the system.

    :param _pytest.main.Session session: the pytest session object
    :param int exitstatus: the status which pytest will return to the system
    Nr   )r   
exitstatusr   r   r   pytest_sessionfinish  s    rC   c             C   s   dS )zj called before test process is exited.

    :param _pytest.config.Config config: pytest config object
    Nr   )r   r   r   r   pytest_unconfigure  s    rD   c             C   s   dS )a  return explanation for comparisons in failing assert expressions.

    Return None for no custom explanation, otherwise return a list
    of strings.  The strings will be joined by newlines but any newlines
    *in* a string will be escaped.  Note that all but the first line will
    be indented slightly, the intention is for the first line to be a summary.

    :param _pytest.config.Config config: pytest config object
    Nr   )r   opleftrightr   r   r   pytest_assertrepr_compare  s    	rH   c             C   s   dS )a   return a string or list of strings to be displayed as header info for terminal reporting.

    :param _pytest.config.Config config: pytest config object
    :param startdir: py.path object with the starting dir

    .. note::

        This function should be implemented only in plugins or ``conftest.py``
        files situated at the tests root directory due to how pytest
        :ref:`discovers plugins during startup <pluginorder>`.
    Nr   )r   startdirr   r   r   pytest_report_header  s    rJ   c             C   s   dS )a  
    .. versionadded:: 3.2

    return a string or list of strings to be displayed after collection has finished successfully.

    This strings will be displayed after the standard "collected X items" message.

    :param _pytest.config.Config config: pytest config object
    :param startdir: py.path object with the starting dir
    :param items: list of pytest items that are going to be executed; this list should not be modified.
    Nr   )r   rI   r   r   r   r   pytest_report_collectionfinish  s    rK   c             C   s   dS )z return result-category, shortletter and verbose word for reporting.

    :param _pytest.config.Config config: pytest config object

    Stops at first non-None result, see :ref:`firstresult` Nr   )r!   r   r   r   r   pytest_report_teststatus  s    rL   c             C   s   dS )ab  Add a section to terminal summary reporting.

    :param _pytest.terminal.TerminalReporter terminalreporter: the internal terminal reporter object
    :param int exitstatus: the exit status that will be reported back to the OS
    :param _pytest.config.Config config: pytest config object

    .. versionadded:: 4.2
        The ``config`` parameter.
    Nr   )ZterminalreporterrB   r   r   r   r   pytest_terminal_summary  s    	rM   )r   Zwarn_on_implc             C   s   dS )ao  
    .. deprecated:: 3.8

        This hook is will stop working in a future release.

        pytest no longer triggers this hook, but the
        terminal writer still implements it to display warnings issued by
        :meth:`_pytest.config.Config.warn` and :meth:`_pytest.nodes.Node.warn`. Calling those functions will be
        an error in future releases.

    process a warning specified by a message, a code string,
    a nodeid and fslocation (both of which may be None
    if the warning is not tied to a particular node/location).

    .. note::
        This hook is incompatible with ``hookwrapper=True``.
    Nr   )messagecoder3   Z
fslocationr   r   r   pytest_logwarning  s    rP   c             C   s   dS )aL  
    Process a warning captured by the internal pytest warnings plugin.

    :param warnings.WarningMessage warning_message:
        The captured warning. This is the same object produced by :py:func:`warnings.catch_warnings`, and contains
        the same attributes as the parameters of :py:func:`warnings.showwarning`.

    :param str when:
        Indicates when the warning was captured. Possible values:

        * ``"config"``: during pytest configuration/initialization stage.
        * ``"collect"``: during test collection.
        * ``"runtest"``: during test execution.

    :param pytest.Item|None item:
        **DEPRECATED**: This parameter is incompatible with ``pytest-xdist``, and will always receive ``None``
        in a future release.

        The item being executed if ``when`` is ``"runtest"``, otherwise ``None``.
    Nr   )Zwarning_messageZwhenr   r   r   r   pytest_warning_captured  s    rQ   c             C   s   dS )zj return processed content for a given doctest

    Stops at first non-None result, see :ref:`firstresult` Nr   )Zcontentr   r   r   pytest_doctest_prepare_content)  s    rR   c             C   s   dS )z called for internal errors. Nr   )Zexcreprexcinfor   r   r   pytest_internalerror5  s    rT   c             C   s   dS )z  called for keyboard interrupt. Nr   )rS   r   r   r   pytest_keyboard_interrupt9  s    rU   c             C   s   dS )zcalled when an exception was raised which can potentially be
    interactively handled.

    This hook is only called if an exception was raised
    that is not an internal exception like ``skip.Exception``.
    Nr   )r/   r:   r!   r   r   r   pytest_exception_interact=  s    rV   c             C   s   dS )z called upon pdb.set_trace(), can be used by plugins to take special
    action just before the python debugger enters in interactive mode.

    :param _pytest.config.Config config: pytest config object
    :param pdb.Pdb pdb: Pdb instance
    Nr   )r   pdbr   r   r   pytest_enter_pdbF  s    rX   c             C   s   dS )a   called when leaving pdb (e.g. with continue after pdb.set_trace()).

    Can be used by plugins to take special action just after the python
    debugger leaves interactive mode.

    :param _pytest.config.Config config: pytest config object
    :param pdb.Pdb pdb: Pdb instance
    Nr   )r   rW   r   r   r   pytest_leave_pdbO  s    rY   N):__doc__Zpluggyr   Z_pytest.deprecatedr   Zhookspecr   r	   r   r   r   r   r   r   r   r   r   r   r   r   r   r    r"   r#   r$   r%   r(   r)   r*   r-   r.   r0   r2   r5   r6   r7   r8   r9   r;   r<   r?   r@   rA   rC   rD   rH   rJ   rK   rL   rM   rP   rQ   rR   rT   rU   rV   rX   rY   r   r   r   r   <module>   sn   !




	
			