From f921bb85b13bdba074a898d4a5dc1e6dbe7e4102 Mon Sep 17 00:00:00 2001 From: sandzwerg <272385+sandzwerg@users.noreply.github.com> Date: Wed, 11 Jan 2023 18:43:24 +0100 Subject: [PATCH] Add basic doc for file.contains (#673) --- testinfra/modules/file.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/testinfra/modules/file.py b/testinfra/modules/file.py index 8f8e9d2b..9fe0f8ab 100644 --- a/testinfra/modules/file.py +++ b/testinfra/modules/file.py @@ -116,6 +116,10 @@ def mode(self): raise NotImplementedError def contains(self, pattern): + """Checks content of file for pattern + + This uses grep and thus follows the grep regex syntax. + """ return self.run_test("grep -qs -- %s %s", pattern, self.path).rc == 0 @property