Skip to content

Commit

Permalink
Bump pep8-naming from 0.11.1 to 0.12.1 (#9899)
Browse files Browse the repository at this point in the history
* Bump pep8-naming from 0.11.1 to 0.12.1

Bumps [pep8-naming](https://github.com/PyCQA/pep8-naming) from 0.11.1 to 0.12.1.
- [Release notes](https://github.com/PyCQA/pep8-naming/releases)
- [Changelog](https://github.com/PyCQA/pep8-naming/blob/master/CHANGELOG.rst)
- [Commits](PyCQA/pep8-naming@0.11.1...0.12.1)

---
updated-dependencies:
- dependency-name: pep8-naming
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Refactor for pep8-naming==0.12.1

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Dustin Ingram <di@users.noreply.github.com>
  • Loading branch information
dependabot[bot] and di committed Oct 12, 2021
1 parent 6e95220 commit 844499d
Show file tree
Hide file tree
Showing 44 changed files with 173 additions and 166 deletions.
7 changes: 4 additions & 3 deletions requirements/lint.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ flake8==4.0.1 \
# via
# -r requirements/lint.in
# flake8-polyfill
# pep8-naming
flake8-polyfill==1.0.2 \
--hash=sha256:12be6a34ee3ab795b19ca73505e7b55826d5f6ad7230d31b18e106400169b9e9 \
--hash=sha256:e44b087597f6da52ec6393a709e7108b2905317d0c0b744cdca6208e670d8eda
Expand Down Expand Up @@ -72,9 +73,9 @@ pbr==5.6.0 \
--hash=sha256:42df03e7797b796625b1029c0400279c7c34fd7df24a7d7818a1abb5b38710dd \
--hash=sha256:c68c661ac5cc81058ac94247278eeda6d2e6aecb3e227b0387c30d277e7ef8d4
# via stevedore
pep8-naming==0.11.1 \
--hash=sha256:a1dd47dd243adfe8a83616e27cf03164960b507530f155db94e10b36a6cd6724 \
--hash=sha256:f43bfe3eea7e0d73e8b5d07d6407ab47f2476ccaeff6937c84275cd30b016738
pep8-naming==0.12.1 \
--hash=sha256:4a8daeaeb33cfcde779309fc0c9c0a68a3bbe2ad8a8308b763c5068f86eb9f37 \
--hash=sha256:bb2455947757d162aa4cad55dba4ce029005cd1692f2899a21d51d8630ca7841
# via -r requirements/lint.in
pycodestyle==2.8.0 \
--hash=sha256:720f8b39dde8b293825e7ff02c475f3077124006db4f440dcbc9a20b76548a20 \
Expand Down
4 changes: 2 additions & 2 deletions tests/common/checks/hooked.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# limitations under the License.

from warehouse.malware.checks.base import MalwareCheckBase
from warehouse.malware.errors import FatalCheckException
from warehouse.malware.errors import FatalCheckError
from warehouse.malware.models import VerdictClassification, VerdictConfidence


Expand All @@ -30,7 +30,7 @@ def __init__(self, db):
def scan(self, **kwargs):
file_id = kwargs.get("obj_id")
if file_id is None:
raise FatalCheckException("Missing required kwarg `obj_id`")
raise FatalCheckError("Missing required kwarg `obj_id`")

self.add_verdict(
file_id=file_id,
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/accounts/test_forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from warehouse.accounts import forms
from warehouse.accounts.interfaces import TooManyFailedLogins
from warehouse.accounts.models import DisableReason
from warehouse.utils.webauthn import AuthenticationRejectedException
from warehouse.utils.webauthn import AuthenticationRejectedError


class TestLoginForm:
Expand Down Expand Up @@ -708,7 +708,7 @@ def test_credential_invalid(self):
user_service = pretend.stub(
record_event=pretend.call_recorder(lambda *a, **kw: None),
verify_webauthn_assertion=pretend.raiser(
AuthenticationRejectedException("foo")
AuthenticationRejectedError("foo")
),
)
form = forms.WebAuthnAuthenticationForm(
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/accounts/test_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ def test_verify_webauthn_credential_already_in_use(self, user_service, monkeypat
webauthn, "verify_registration_response", verify_registration_response
)

with pytest.raises(webauthn.RegistrationRejectedException):
with pytest.raises(webauthn.RegistrationRejectedError):
user_service.verify_webauthn_credential(
pretend.stub(),
challenge=pretend.stub(),
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/cache/origin/test_fastly.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def test_purges_successfully(self, monkeypatch):
requests.ConnectionError,
requests.HTTPError,
requests.Timeout,
fastly.UnsuccessfulPurge,
fastly.UnsuccessfulPurgeError,
],
)
def test_purges_fails(self, monkeypatch, exception_type):
Expand Down Expand Up @@ -204,7 +204,7 @@ def test_purge_key_unsuccessful(self, monkeypatch, result):
requests_post = pretend.call_recorder(lambda *a, **kw: response)
monkeypatch.setattr(requests, "post", requests_post)

with pytest.raises(fastly.UnsuccessfulPurge):
with pytest.raises(fastly.UnsuccessfulPurgeError):
cacher.purge_key("one")

assert requests_post.calls == [
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/email/ses/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def __init__(topics, session):
@staticmethod
@pretend.call_recorder
def verify(message):
raise views.sns.InvalidMessage("This is an Invalid Message")
raise views.sns.InvalidMessageError("This is an Invalid Message")

monkeypatch.setattr(views.sns, "MessageVerifier", FakeMessageVerifier)

Expand Down
20 changes: 10 additions & 10 deletions tests/unit/integration/github/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def test_plain_text_token_leak_matcher_extract():


def test_invalid_token_leak_request():
exc = utils.InvalidTokenLeakRequest("a", "b")
exc = utils.InvalidTokenLeakRequestError("a", "b")

assert str(exc) == "a"
assert exc.reason == "b"
Expand Down Expand Up @@ -62,9 +62,9 @@ class MyFailingMatcher(utils.TokenLeakMatcher):
name = "failer"

def extract(self, text):
raise utils.ExtractionFailed()
raise utils.ExtractionFailedError()

with pytest.raises(utils.InvalidTokenLeakRequest) as exc:
with pytest.raises(utils.InvalidTokenLeakRequestError) as exc:
utils.TokenLeakDisclosureRequest.from_api_record(
record, matchers={"failer": MyFailingMatcher(), **utils.TOKEN_LEAK_MATCHERS}
)
Expand Down Expand Up @@ -209,7 +209,7 @@ def test_verify_error(self):
public_keys_cache=cache,
)
github_verifier.retrieve_public_key_payload = pretend.raiser(
integrations.InvalidPayloadSignature("Bla", "bla")
integrations.InvalidPayloadSignatureError("Bla", "bla")
)

assert github_verifier.verify(payload={}, key_id="a", signature="a") is False
Expand Down Expand Up @@ -302,7 +302,7 @@ def test_get_cached_public_key_cache_miss_no_cache(self):
public_keys_cache=cache,
)

with pytest.raises(integrations.CacheMiss):
with pytest.raises(integrations.CacheMissError):
github_verifier._get_cached_public_keys()

def test_retrieve_public_key_payload_http_error(self):
Expand Down Expand Up @@ -455,7 +455,7 @@ def test_check_public_key_error(self):
public_keys_cache=pretend.stub(),
)

with pytest.raises(integrations.InvalidPayloadSignature) as exc:
with pytest.raises(integrations.InvalidPayloadSignatureError) as exc:
github_verifier._check_public_key(public_keys=[], key_id="c")

assert str(exc.value) == "Key c not found in public keys"
Expand Down Expand Up @@ -515,7 +515,7 @@ def test_check_signature_invalid_signature(self):
b'f43808034d7f5","url":" https://github.com/github/faketestrepo/blob/'
b'b0dd59c0b500650cacd4551ca5989a6194001b10/production.env"}]'
)
with pytest.raises(integrations.InvalidPayloadSignature) as exc:
with pytest.raises(integrations.InvalidPayloadSignatureError) as exc:
github_verifier._check_signature(
payload=payload, public_key=public_key, signature=signature
)
Expand All @@ -535,7 +535,7 @@ def test_check_signature_invalid_crypto(self):

payload = "yeah, nope, that won't pass"

with pytest.raises(integrations.InvalidPayloadSignature) as exc:
with pytest.raises(integrations.InvalidPayloadSignatureError) as exc:
github_verifier._check_signature(
payload=payload, public_key=public_key, signature=signature
)
Expand Down Expand Up @@ -639,7 +639,7 @@ def test_analyze_disclosure_invalid_macaroon():
def metrics_increment(key):
metrics.update([key])

find = pretend.raiser(utils.InvalidMacaroon("Bla", "bla"))
find = pretend.raiser(utils.InvalidMacaroonError("Bla", "bla"))
svc = {
utils.IMetricsService: pretend.stub(increment=metrics_increment),
utils.IMacaroonService: pretend.stub(find_from_raw=find),
Expand Down Expand Up @@ -694,7 +694,7 @@ def metrics_increment(key):

metrics_service = pretend.stub(increment=metrics_increment)

with pytest.raises(utils.InvalidTokenLeakRequest) as exc:
with pytest.raises(utils.InvalidTokenLeakRequestError) as exc:
utils.analyze_disclosures(
request=pretend.stub(),
disclosure_records={},
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/integration/test_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ def test_set(self):
def test_get_no_cache(self):
cache = integrations.PublicKeysCache(cache_time=10)

with pytest.raises(integrations.CacheMiss):
with pytest.raises(integrations.CacheMissError):
cache.get(now=1)

def test_get_old_cache(self):
cache = integrations.PublicKeysCache(cache_time=10)
cache.set(now=5, value="foo")

with pytest.raises(integrations.CacheMiss):
with pytest.raises(integrations.CacheMissError):
cache.get(now=20)

def test_get_valid(self):
Expand Down
10 changes: 5 additions & 5 deletions tests/unit/integration/vulnerabilities/osv/test_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def test_verify_error(self):
public_keys_cache=cache,
)
vuln_report_verifier.retrieve_public_key_payload = pretend.raiser(
integrations.InvalidPayloadSignature("Bla", "bla")
integrations.InvalidPayloadSignatureError("Bla", "bla")
)

assert (
Expand Down Expand Up @@ -220,7 +220,7 @@ def test_get_cached_public_key_cache_miss_no_cache(self):
public_keys_cache=cache,
)

with pytest.raises(integrations.CacheMiss):
with pytest.raises(integrations.CacheMissError):
vuln_report_verifier._get_cached_public_keys()

def test_retrieve_public_key_payload_http_error(self):
Expand Down Expand Up @@ -376,7 +376,7 @@ def test_check_public_key_error(self):
public_keys_cache=pretend.stub(),
)

with pytest.raises(integrations.InvalidPayloadSignature) as exc:
with pytest.raises(integrations.InvalidPayloadSignatureError) as exc:
vuln_report_verifier._check_public_key(public_keys=[], key_id="c")

assert str(exc.value) == "Key c not found in public keys"
Expand Down Expand Up @@ -437,7 +437,7 @@ def test_check_signature_invalid_signature(self):
b'"link":"vulns.com/vuln_id",'
b'"aliases":["vuln_alias"]}]'
)
with pytest.raises(integrations.InvalidPayloadSignature) as exc:
with pytest.raises(integrations.InvalidPayloadSignatureError) as exc:
vuln_report_verifier._check_signature(
payload=payload, public_key=public_key, signature=signature
)
Expand All @@ -457,7 +457,7 @@ def test_check_signature_invalid_crypto(self):

payload = "yeah, nope, that won't pass"

with pytest.raises(integrations.InvalidPayloadSignature) as exc:
with pytest.raises(integrations.InvalidPayloadSignatureError) as exc:
vuln_report_verifier._check_signature(
payload=payload, public_key=public_key, signature=signature
)
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/integration/vulnerabilities/test_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import pytest

from warehouse.integrations.vulnerabilities import (
InvalidVulnerabilityReportRequest,
InvalidVulnerabilityReportError,
VulnerabilityReportRequest,
)

Expand All @@ -31,7 +31,7 @@
)
def test_vulnerability_report_request_from_api_request_error(record, error, reason):

with pytest.raises(InvalidVulnerabilityReportRequest) as exc:
with pytest.raises(InvalidVulnerabilityReportError) as exc:
VulnerabilityReportRequest.from_api_request(record)

assert str(exc.value) == error
Expand All @@ -57,7 +57,7 @@ def test_vulnerability_report_request_from_api_request():


def test_invalid_vulnerability_report():
exc = InvalidVulnerabilityReportRequest("error string", "reason")
exc = InvalidVulnerabilityReportError("error string", "reason")

assert str(exc) == "error string"
assert exc.reason == "reason"
2 changes: 1 addition & 1 deletion tests/unit/integration/vulnerabilities/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ def metrics_increment(key, tags):

metrics = pretend.stub(increment=metrics_increment, timed=metrics.timed)

with pytest.raises(vulnerabilities.InvalidVulnerabilityReportRequest) as exc:
with pytest.raises(vulnerabilities.InvalidVulnerabilityReportError) as exc:
utils.analyze_vulnerability(
request=db_request,
vulnerability_report={
Expand Down
8 changes: 5 additions & 3 deletions tests/unit/macaroons/test_auth_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

from warehouse.macaroons import auth_policy
from warehouse.macaroons.interfaces import IMacaroonService
from warehouse.macaroons.services import InvalidMacaroon
from warehouse.macaroons.services import InvalidMacaroonError


@pytest.mark.parametrize(
Expand Down Expand Up @@ -194,7 +194,9 @@ def test_permits_no_macaroon(self, monkeypatch):
assert result == permits

def test_permits_invalid_macaroon(self, monkeypatch):
macaroon_service = pretend.stub(verify=pretend.raiser(InvalidMacaroon("foo")))
macaroon_service = pretend.stub(
verify=pretend.raiser(InvalidMacaroonError("foo"))
)
request = pretend.stub(
find_service=pretend.call_recorder(lambda interface, **kw: macaroon_service)
)
Expand All @@ -214,7 +216,7 @@ def test_permits_invalid_macaroon(self, monkeypatch):
result = policy.permits(pretend.stub(), pretend.stub(), pretend.stub())

assert result == Denied("")
assert result.s == "Invalid API Token: InvalidMacaroon('foo')"
assert result.s == "Invalid API Token: InvalidMacaroonError('foo')"

def test_permits_valid_macaroon(self, monkeypatch):
macaroon_service = pretend.stub(
Expand Down
16 changes: 8 additions & 8 deletions tests/unit/macaroons/test_caveats.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

from pymacaroons.exceptions import MacaroonInvalidSignatureException

from warehouse.macaroons.caveats import Caveat, InvalidMacaroon, V1Caveat, Verifier
from warehouse.macaroons.caveats import Caveat, InvalidMacaroonError, V1Caveat, Verifier

from ...common.db.packaging import ProjectFactory

Expand All @@ -28,9 +28,9 @@ def test_creation(self):
caveat = Caveat(verifier)

assert caveat.verifier is verifier
with pytest.raises(InvalidMacaroon):
with pytest.raises(InvalidMacaroonError):
caveat.verify(pretend.stub())
with pytest.raises(InvalidMacaroon):
with pytest.raises(InvalidMacaroonError):
caveat(pretend.stub())


Expand All @@ -47,7 +47,7 @@ def test_verify_invalid_predicates(self, predicate, result):
verifier = pretend.stub()
caveat = V1Caveat(verifier)

with pytest.raises(InvalidMacaroon):
with pytest.raises(InvalidMacaroonError):
caveat(predicate)

def test_verify_valid_predicate(self):
Expand All @@ -62,7 +62,7 @@ def test_verify_project_invalid_context(self):
caveat = V1Caveat(verifier)

predicate = {"version": 1, "permissions": {"projects": ["notfoobar"]}}
with pytest.raises(InvalidMacaroon):
with pytest.raises(InvalidMacaroonError):
caveat(json.dumps(predicate))

def test_verify_project_invalid_project_name(self, db_request):
Expand All @@ -71,7 +71,7 @@ def test_verify_project_invalid_project_name(self, db_request):
caveat = V1Caveat(verifier)

predicate = {"version": 1, "permissions": {"projects": ["notfoobar"]}}
with pytest.raises(InvalidMacaroon):
with pytest.raises(InvalidMacaroonError):
caveat(json.dumps(predicate))

def test_verify_project_no_projects_object(self, db_request):
Expand All @@ -83,7 +83,7 @@ def test_verify_project_no_projects_object(self, db_request):
"version": 1,
"permissions": {"somethingthatisntprojects": ["blah"]},
}
with pytest.raises(InvalidMacaroon):
with pytest.raises(InvalidMacaroonError):
caveat(json.dumps(predicate))

def test_verify_project(self, db_request):
Expand Down Expand Up @@ -120,6 +120,6 @@ def test_verify(self, monkeypatch):
verifier = Verifier(macaroon, context, principals, permission)

monkeypatch.setattr(verifier.verifier, "verify", verify)
with pytest.raises(InvalidMacaroon):
with pytest.raises(InvalidMacaroonError):
verifier.verify(key)
assert verify.calls == [pretend.call(macaroon, key)]
Loading

0 comments on commit 844499d

Please sign in to comment.