Skip to content

Commit

Permalink
Add basic doc for file.contains (#673)
Browse files Browse the repository at this point in the history
  • Loading branch information
sandzwerg committed Jan 11, 2023
1 parent 5d558f0 commit f921bb8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions testinfra/modules/file.py
Expand Up @@ -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
Expand Down

0 comments on commit f921bb8

Please sign in to comment.