Skip to content

Commit

Permalink
Merge pull request #27 from rohanpm/pytest5-compat
Browse files Browse the repository at this point in the history
Fix test failures with pytest 5
  • Loading branch information
rohanpm committed Jul 3, 2019
2 parents 3b0285c + b991a31 commit fd5cc42
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 7 deletions.
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

0 comments on commit fd5cc42

Please sign in to comment.