### Install pytest-line-profiler Source: https://github.com/mgaitan/pytest-line-profiler/blob/main/README.md Install the pytest-line-profiler package using pip. This command fetches and installs the latest version from PyPI, making the plugin available for use with pytest. ```bash pip install pytest-line-profiler ``` -------------------------------- ### Profile functions from command line Source: https://github.com/mgaitan/pytest-line-profiler/blob/main/README.md This command shows how to invoke pytest with the line-profiler plugin enabled. It specifies the functions to be profiled directly on the command line using the `--line-profile` option, followed by the path to the functions. ```bash pytest --line-profile path.to.function_to_be_profiled [...] ``` -------------------------------- ### Profile functions using pytest mark Source: https://github.com/mgaitan/pytest-line-profiler/blob/main/README.md This Python code demonstrates how to use the pytest-line-profiler plugin by marking a test function with `@pytest.mark.line_profile.with_args()`. The arguments to `with_args` are the functions that should be profiled. When the test runs, line-profiler will generate reports for these specified functions. ```python import pytest def f(i): return i * 10 def g(n=10): return sum(f(i) for i in range(10)) @pytest.mark.line_profile.with_args(f, g) def test_as_mark(): assert g() == 450 ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.