Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add helpers to TestPipResult #8303

Merged
merged 1 commit into from
May 23, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 21 additions & 0 deletions tests/lib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,27 @@ def assert_installed(self, pkg_name, editable=True, with_files=[],
.format(**locals())
)

def did_create(self, path, message=None):
assert str(path) in self.files_created, _one_or_both(message, self)

def did_not_create(self, path, message=None):
assert str(path) not in self.files_created, _one_or_both(message, self)

def did_update(self, path, message=None):
assert str(path) in self.files_updated, _one_or_both(message, self)

def did_not_update(self, path, message=None):
assert str(path) not in self.files_updated, _one_or_both(message, self)


def _one_or_both(a, b):
"""Returns f"{a}\n{b}" if a is truthy, else returns str(b).
"""
if not a:
return str(b)

return "{a}\n{b}".format(a=a, b=b)


def make_check_stderr_message(stderr, line, reason):
"""
Expand Down