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

Fix test failures with pytest 5 #27

Merged
merged 1 commit into from Jul 3, 2019
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion tests/client/test_client.py
Expand Up @@ -164,4 +164,4 @@ def test_get_missing(client, requests_mocker):
repo_f.result()

# It should explain the problem
assert "repo1 was not found" in str(error)
assert "repo1 was not found" in str(error.value)
2 changes: 1 addition & 1 deletion tests/client/test_poller.py
Expand Up @@ -182,4 +182,4 @@ def test_retries_exhausted(requests_mocker):
poller(descriptors)

# It should pass through whatever was the underlying error
assert "400 Client Error" in str(exc_info)
assert "400 Client Error" in str(exc_info.value)
2 changes: 1 addition & 1 deletion tests/client/test_search.py
Expand Up @@ -68,4 +68,4 @@ def test_non_matcher():
with pytest.raises(TypeError) as exc_info:
field_match("oops not a matcher")

assert "Not a matcher" in str(exc_info)
assert "Not a matcher" in str(exc_info.value)
2 changes: 1 addition & 1 deletion tests/criteria/test_criteria.py
Expand Up @@ -12,4 +12,4 @@ def test_field_in_str_invalid():
"""
with pytest.raises(ValueError) as exc_info:
Criteria.with_field_in("x", "someval")
assert "Must be an iterable: 'someval'" in str(exc_info)
assert "Must be an iterable: 'someval'" in str(exc_info.value)
2 changes: 1 addition & 1 deletion tests/fake/test_fake.py
Expand Up @@ -33,7 +33,7 @@ def test_get_missing_raises():
with pytest.raises(PulpException) as raised:
repo_f.result()

assert "some-repo not found" in str(raised)
assert "some-repo not found" in str(raised.value)


def test_get_wrong_type_raises():
Expand Down
2 changes: 1 addition & 1 deletion tests/repository/test_publish.py
Expand Up @@ -171,7 +171,7 @@ def test_publish_fail(fast_poller, requests_mocker, client):

# The exception should have a reference to the task which failed
assert error.value.task.id == "task1"
assert "Task task1 failed" in str(error)
assert "Task task1 failed" in str(error.value)


def test_publish_broken_response(fast_poller, requests_mocker, client):
Expand Down
2 changes: 1 addition & 1 deletion tests/util/test_lookup.py
Expand Up @@ -17,7 +17,7 @@ def test_lookup_nested_absent_raise():
with pytest.raises(KeyError) as error:
lookup(data, "a.b.d")

assert "a.b.d" in str(error)
assert "a.b.d" in str(error.value)


def test_lookup_nested_absent_default():
Expand Down