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

Check isort in CI #1078

Merged
merged 5 commits into from
Nov 12, 2021
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: Install
run: source .venv/bin/activate && make requirements && python setup.py install
- name: Lint
run: source .venv/bin/activate && make flake black-check
run: source .venv/bin/activate && make flake black-check isort-check
- name: Test
run: source .venv/bin/activate && make tests
- name: Upload Coverage
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ black-check:
@echo "If this fails, simply run: make black"

isort:
isort --recursive .
isort . --profile=black

isort-check:
isort --check . --profile=black

flake:
flake8 zappa --count --select=E9,F63,F7,F82 --show-source --statistics
Expand Down
1 change: 1 addition & 0 deletions example/app.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logging

from flask import Flask

app = Flask(__name__)
Expand Down
4 changes: 2 additions & 2 deletions example/authmodule.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
http://aws.amazon.com/apache2.0/
or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
"""
import json
import pprint
import re
import time
import pprint
import json


def lambda_handler(event, context):
Expand Down
4 changes: 3 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import os
from setuptools import setup
from io import open

from setuptools import setup

from zappa import __version__

with open("README.md", encoding="utf-8") as readme_file:
Expand Down
4 changes: 3 additions & 1 deletion tests/test_handler.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from mock import Mock
import sys
import unittest

from mock import Mock

from zappa.handler import LambdaHandler
from zappa.utilities import merge_headers

Expand Down
44 changes: 21 additions & 23 deletions tests/tests.py
Original file line number Diff line number Diff line change
@@ -1,58 +1,56 @@
# -*- coding: utf8 -*-
import collections
import json

from io import BytesIO
import botocore
import botocore.stub
import flask
import mock
import os
import random
import string
import zipfile
import unittest
import shutil
import string
import sys
import tempfile
import unittest
import uuid
import zipfile
from io import BytesIO

from click.globals import resolve_color_default
import botocore
import botocore.stub
import flask
import mock
from click.exceptions import ClickException
from click.globals import resolve_color_default

from zappa.cli import ZappaCLI, shamelessly_promote, disable_click_colors
from zappa.core import ALB_LAMBDA_ALIAS
from zappa.cli import ZappaCLI, disable_click_colors, shamelessly_promote
from zappa.core import ALB_LAMBDA_ALIAS, ASSUME_POLICY, ATTACH_POLICY, Zappa
from zappa.ext.django_zappa import get_django_wsgi
from zappa.letsencrypt import (
get_cert_and_update_domain,
create_domain_key,
create_domain_csr,
create_chained_certificate,
cleanup,
create_chained_certificate,
create_domain_csr,
create_domain_key,
encode_certificate,
get_cert_and_update_domain,
gettempdir,
parse_account_key,
parse_csr,
sign_certificate,
encode_certificate,
register_account,
sign_certificate,
verify_challenge,
gettempdir,
)
from zappa.utilities import (
InvalidAwsLambdaName,
conflicts_with_a_neighbouring_module,
contains_python_files_or_subdirs,
detect_django_settings,
detect_flask_apps,
get_venv_from_python_version,
human_size,
InvalidAwsLambdaName,
is_valid_bucket_name,
parse_s3_url,
string_to_timestamp,
titlecase_keys,
is_valid_bucket_name,
validate_name,
)
from zappa.wsgi import create_wsgi_request, common_log
from zappa.core import Zappa, ASSUME_POLICY, ATTACH_POLICY
from zappa.wsgi import common_log, create_wsgi_request


def random_string(length):
Expand Down
14 changes: 10 additions & 4 deletions tests/tests_async.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
# -*- coding: utf8 -*-
import boto3
import mock
import os
import unittest

import boto3
import mock

try:
from mock import patch
except ImportError:
from unittest.mock import patch

from zappa.asynchronous import AsyncException, LambdaAsyncResponse, SnsAsyncResponse
from zappa.asynchronous import import_and_get_task, get_func_task_path
from zappa.asynchronous import (
AsyncException,
LambdaAsyncResponse,
SnsAsyncResponse,
get_func_task_path,
import_and_get_task,
)


class TestZappa(unittest.TestCase):
Expand Down
5 changes: 3 additions & 2 deletions tests/tests_async_old.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# -*- coding: utf8 -*-
import boto3
import mock
import os
import unittest

import boto3
import mock

try:
from mock import patch
except ImportError:
Expand Down
5 changes: 2 additions & 3 deletions tests/tests_docs.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import unittest
import re
from os import path, environ
import unittest
from copy import copy

from os import environ, path

DIR = path.realpath(path.dirname(__file__))

Expand Down
2 changes: 1 addition & 1 deletion tests/tests_middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import sys
import unittest

from zappa.wsgi import create_wsgi_request
from zappa.middleware import ZappaWSGIMiddleware, all_casings
from zappa.wsgi import create_wsgi_request


class TestWSGIMockMiddleWare(unittest.TestCase):
Expand Down
7 changes: 4 additions & 3 deletions tests/tests_placebo.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
# -*- coding: utf8 -*-
import mock
import os
import random
import string
import unittest

from .utils import placebo_session
import mock

from zappa.cli import ZappaCLI
from zappa.core import Zappa
from zappa.handler import LambdaHandler
from zappa.utilities import add_event_source, remove_event_source
from zappa.core import Zappa

from .utils import placebo_session


def random_string(length):
Expand Down
9 changes: 5 additions & 4 deletions tests/utils.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import placebo
import boto3
import os
import functools
import os
from contextlib import contextmanager
from mock import patch, MagicMock

import boto3
import placebo
from mock import MagicMock, patch

try:
file
Expand Down