Package tlib :: Package base :: Module TLibHelper |
[hide private]
[frames] | no frames]

# Source Code for Module tlib.base.TLibHelper

     1  import warnings
     2  import pytest
     3
     4 -def deprecated(func):
     5       '''Functioa that can be used to mark functions as deprecated. It will result in a warning being emitted
     6       when the function is used.\n
     7       To use it mark function with @deprecated decorator'''
     8       def new_func(*args, **kwargs):
     9           warnings.warn("Call to deprecated function {}.".format(func.__name__),
    10                         category=DeprecationWarning)
    11           return func(*args, **kwargs)
    12       new_func.__name__ = func.__name__
    13       new_func.__doc__ = func.__doc__
    14       new_func.__dict__.update(func.__dict__)
    15       return new_func
    16
    17
    18 -def get_base_url(request, tlib_logger):
    19      """
    20      Returns value of --base_url command line parameter
    21      """
    22      if request.config.getoption("base_url") is None:
    23          #noinspection PyUnresolvedReferences
    24          tlib_logger.warn("parameter --base_url was not specified")
    25          pytest.fail("parameter --base_url was not specified")
    26          return None
    27      else:
    28          return request.config.getoption("base_url")
    29