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

Align dev dependencies and linting with upstream #1049

Merged
merged 10 commits into from
Oct 24, 2023
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ jobs:
python -m pip install -U setuptools pip codecov wheel pip-tools
time pip-compile requirements-dev.in
time pip-sync requirements-dev.txt
- name: Run flake
- name: Run pre-commit hooks
if: matrix.python-version == '3.11'
run: |
make flake
make pre-commit
- name: Run unittests
env:
COLOR: 'yes'
Expand Down
24 changes: 12 additions & 12 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
repos:
- repo: 'https://github.com/pre-commit/pre-commit-hooks'
rev: v4.3.0
rev: v4.4.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: 'https://github.com/asottile/pyupgrade'
rev: v2.37.3
hooks:
- id: pyupgrade
args:
- '--py38-plus'
- repo: 'https://github.com/psf/black'
rev: 22.8.0
hooks:
- id: black
- repo: 'https://github.com/PyCQA/isort'
rev: 5.12.0
hooks:
- id: isort
- repo: 'https://github.com/pycqa/flake8'
rev: 5.0.4
rev: 6.0.0
hooks:
- id: flake8
- repo: 'https://github.com/asottile/pyupgrade'
rev: v3.3.2
hooks:
- id: pyupgrade
args:
- '--py36-plus'
- repo: 'https://github.com/psf/black'
rev: 23.3.0
hooks:
- id: black
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

FLAGS=

flake: checkrst
python -m flake8
pre-commit flake: checkrst
pre-commit run --all

test: flake
test: pre-commit
python -Wd -m pytest -s -vv $(FLAGS) ./tests/

vtest:
Expand All @@ -14,7 +14,7 @@ vtest:
checkrst:
python setup.py check -rms

cov cover coverage: flake
cov cover coverage: pre-commit
python -Wd -m pytest -s -vv --cov-report term --cov-report html --cov aiobotocore ./tests
@echo "open file://`pwd`/htmlcov/index.html"

Expand Down Expand Up @@ -48,4 +48,4 @@ doc:
make -C docs html
@echo "open file://`pwd`/docs/_build/html/index.html"

.PHONY: all flake test vtest cov clean doc
.PHONY: all pre-commit test vtest cov clean doc
2 changes: 0 additions & 2 deletions aiobotocore/credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,6 @@ async def _create_client(self):
)


# black: # fmt: skip (ing) this line triggers internal black error
class AioAssumeRoleWithWebIdentityCredentialFetcher(
AioBaseAssumeRoleCredentialFetcher
):
Expand All @@ -451,7 +450,6 @@ def __init__(
cache=None,
expiry_window_seconds=None,
):

self._web_identity_token_loader = web_identity_token_loader

super().__init__(
Expand Down
10 changes: 3 additions & 7 deletions aiobotocore/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ async def __aexit__(self, exc_type, exc_val, exc_tb):


class AioSession(Session):

# noinspection PyMissingConstructor
def __init__(
self,
Expand Down Expand Up @@ -80,11 +79,9 @@ def set_credentials(self, access_key, secret_key, token=None):

async def get_credentials(self):
if self._credentials is None:
self._credentials = await (
self._components.get_component(
'credential_provider'
).load_credentials()
)
self._credentials = await self._components.get_component(
'credential_provider'
).load_credentials()
return self._credentials

async def get_service_model(self, service_name, api_version=None):
Expand Down Expand Up @@ -126,7 +123,6 @@ async def _create_client(
aws_session_token=None,
config=None,
):

default_client_config = self.get_default_client_config()
# If a config is provided and a default config is set, then
# use the config resulting from merging the two.
Expand Down
1 change: 0 additions & 1 deletion examples/simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@


async def go():

bucket = 'dataintake'
filename = 'dummy.bin'
folder = 'aiobotocore'
Expand Down
1 change: 0 additions & 1 deletion examples/sqs_queue_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
async def go():
session = get_session()
async with session.create_client('sqs', region_name='us-west-2') as client:

print('Creating test_queue1')
response = await client.create_queue(QueueName='test_queue1')
queue_url = response['QueueUrl']
Expand Down
9 changes: 9 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
[tool.pytest.ini_options]
asyncio_mode = "auto"
cache_dir = "/tmp/pytest_aiobotocore_cache"
markers = [
"moto",
"config_kwargs",
"patch_attributes",
]

[tool.isort]
profile = "black"
line_length = 79
Expand Down
6 changes: 0 additions & 6 deletions pytest.ini

This file was deleted.

17 changes: 7 additions & 10 deletions requirements-dev.in
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
codecov~=2.1.13
coverage~=7.2.7
flake8~=3.9.0
flake8-black~=0.3.3
flake8-isort~= 4.1.1
black~=22.6.0
isort~= 5.10.1
coverage==7.2.7
docker~=6.1.3
moto[server,s3,sqs,lambda,dynamodb,cloudformation,sns,batch,ec2,rds]~=4.0.0
pytest~=6.2.4
pytest-cov~=4.1.0
pytest-asyncio~=0.14.0
pytest-xdist~=2.2.1
pre-commit~=3.5.0
pytest==7.4.0
pytest-cov==4.1.0
pytest-asyncio~=0.21.1
pytest-xdist==3.3.1
setuptools==67.8.0;python_version>="3.12"

# this is needed for test_patches
dill~=0.3.3
Expand Down
File renamed without changes.
2 changes: 0 additions & 2 deletions tests/boto_tests/test_credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,6 @@ async def test_assumerolecredprovider_assume_role_no_cache(
async def test_assumerolecredprovider_mfa(
credential_provider, assumerolecredprovider_config_loader
):

fake_config = {
'profiles': {
'development': {
Expand Down Expand Up @@ -525,7 +524,6 @@ async def test_assumerolecredprovider_mfa(
async def test_assumerolecredprovider_mfa_cannot_refresh_credentials(
credential_provider, assumerolecredprovider_config_loader
):

fake_config = {
'profiles': {
'development': {
Expand Down
2 changes: 0 additions & 2 deletions tests/python3.8/boto_tests/test_signers.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ async def test_signers_generate_presigned_urls():
aws_secret_access_key='lalala',
aws_session_token='lalala',
) as client:

# Uses HEAD as it covers more lines :)
await client.generate_presigned_url(
'get_object',
Expand Down Expand Up @@ -123,7 +122,6 @@ async def test_signers_generate_presigned_post():
aws_secret_access_key='lalala',
aws_session_token='lalala',
) as client:

await client.generate_presigned_post(
'somebucket', 'someprefix/key'
)
Expand Down
1 change: 0 additions & 1 deletion tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ async def test_connector_timeout2():
aws_secret_access_key='xxx',
aws_access_key_id='xxx',
) as s3_client:

with pytest.raises(ReadTimeoutError):
resp = await s3_client.get_object(Bucket='foo', Key='bar')
await resp["Body"].read()
Expand Down
1 change: 0 additions & 1 deletion tests/test_patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,6 @@ def test_patches():

success = True
for obj, digests in _API_DIGESTS.items():

try:
source = getsource(obj)
except TypeError:
Expand Down
1 change: 0 additions & 1 deletion tests/test_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ async def test_retry(
aws_access_key_id="xxx",
endpoint_url='http://localhost:7878',
) as client:

# this needs the new style exceptions to work
with pytest.raises(httpsession.EndpointConnectionError):
await client.get_object(Bucket='foo', Key='bar')
Expand Down
4 changes: 3 additions & 1 deletion tests/test_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ def _get_boto_module_versions(
continue

# NOTE: don't support complex versioning yet as requirements are unknown
gte = lt = eq = None # type: Optional[version.Version]
gte: Optional[version.Version] = None
lt: Optional[version.Version] = None
eq: Optional[version.Version] = None
for spec in ver.req.specifier:
if spec.operator == '>=':
assert gte is None
Expand Down
Loading