---
source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs
---
PT008 Use `return_value=` instead of patching with `lambda`
  --> PT008.py:35:1
   |
33 | # Error
34 |
35 | mocker.patch("module.name", lambda: None)
   | ^^^^^^^^^^^^
36 | module_mocker.patch("module.name", lambda: None)
37 | mocker.patch.object(obj, "attr", lambda: None)
   |

PT008 Use `return_value=` instead of patching with `lambda`
  --> PT008.py:36:1
   |
35 | mocker.patch("module.name", lambda: None)
36 | module_mocker.patch("module.name", lambda: None)
   | ^^^^^^^^^^^^^^^^^^^
37 | mocker.patch.object(obj, "attr", lambda: None)
38 | module_mocker.patch.object(obj, "attr", lambda: None)
   |

PT008 Use `return_value=` instead of patching with `lambda`
  --> PT008.py:37:1
   |
35 | mocker.patch("module.name", lambda: None)
36 | module_mocker.patch("module.name", lambda: None)
37 | mocker.patch.object(obj, "attr", lambda: None)
   | ^^^^^^^^^^^^^^^^^^^
38 | module_mocker.patch.object(obj, "attr", lambda: None)
   |

PT008 Use `return_value=` instead of patching with `lambda`
  --> PT008.py:38:1
   |
36 | module_mocker.patch("module.name", lambda: None)
37 | mocker.patch.object(obj, "attr", lambda: None)
38 | module_mocker.patch.object(obj, "attr", lambda: None)
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^
39 |
40 | mocker.patch("module.name", lambda x, y: None)
   |

PT008 Use `return_value=` instead of patching with `lambda`
  --> PT008.py:40:1
   |
38 | module_mocker.patch.object(obj, "attr", lambda: None)
39 |
40 | mocker.patch("module.name", lambda x, y: None)
   | ^^^^^^^^^^^^
41 | module_mocker.patch("module.name", lambda x, y: None)
42 | mocker.patch.object(obj, "attr", lambda x, y: None)
   |

PT008 Use `return_value=` instead of patching with `lambda`
  --> PT008.py:41:1
   |
40 | mocker.patch("module.name", lambda x, y: None)
41 | module_mocker.patch("module.name", lambda x, y: None)
   | ^^^^^^^^^^^^^^^^^^^
42 | mocker.patch.object(obj, "attr", lambda x, y: None)
43 | module_mocker.patch.object(obj, "attr", lambda x, y: None)
   |

PT008 Use `return_value=` instead of patching with `lambda`
  --> PT008.py:42:1
   |
40 | mocker.patch("module.name", lambda x, y: None)
41 | module_mocker.patch("module.name", lambda x, y: None)
42 | mocker.patch.object(obj, "attr", lambda x, y: None)
   | ^^^^^^^^^^^^^^^^^^^
43 | module_mocker.patch.object(obj, "attr", lambda x, y: None)
   |

PT008 Use `return_value=` instead of patching with `lambda`
  --> PT008.py:43:1
   |
41 | module_mocker.patch("module.name", lambda x, y: None)
42 | mocker.patch.object(obj, "attr", lambda x, y: None)
43 | module_mocker.patch.object(obj, "attr", lambda x, y: None)
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^
44 |
45 | mocker.patch("module.name", lambda *args, **kwargs: None)
   |

PT008 Use `return_value=` instead of patching with `lambda`
  --> PT008.py:45:1
   |
43 | module_mocker.patch.object(obj, "attr", lambda x, y: None)
44 |
45 | mocker.patch("module.name", lambda *args, **kwargs: None)
   | ^^^^^^^^^^^^
46 | module_mocker.patch("module.name", lambda *args, **kwargs: None)
47 | mocker.patch.object(obj, "attr", lambda *args, **kwargs: None)
   |

PT008 Use `return_value=` instead of patching with `lambda`
  --> PT008.py:46:1
   |
45 | mocker.patch("module.name", lambda *args, **kwargs: None)
46 | module_mocker.patch("module.name", lambda *args, **kwargs: None)
   | ^^^^^^^^^^^^^^^^^^^
47 | mocker.patch.object(obj, "attr", lambda *args, **kwargs: None)
48 | module_mocker.patch.object(obj, "attr", lambda *args, **kwargs: None)
   |

PT008 Use `return_value=` instead of patching with `lambda`
  --> PT008.py:47:1
   |
45 | mocker.patch("module.name", lambda *args, **kwargs: None)
46 | module_mocker.patch("module.name", lambda *args, **kwargs: None)
47 | mocker.patch.object(obj, "attr", lambda *args, **kwargs: None)
   | ^^^^^^^^^^^^^^^^^^^
48 | module_mocker.patch.object(obj, "attr", lambda *args, **kwargs: None)
   |

PT008 Use `return_value=` instead of patching with `lambda`
  --> PT008.py:48:1
   |
46 | module_mocker.patch("module.name", lambda *args, **kwargs: None)
47 | mocker.patch.object(obj, "attr", lambda *args, **kwargs: None)
48 | module_mocker.patch.object(obj, "attr", lambda *args, **kwargs: None)
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
