From 2067da68bbb08c678c5f96469c7a1cf8a46b0d36 Mon Sep 17 00:00:00 2001 From: pcmxgti <16561338+pcmxgti@users.noreply.github.com> Date: Fri, 6 Oct 2023 10:00:10 -0400 Subject: [PATCH] Make isort, flake8, and black play well together --- setup.py | 4 ++-- tests/functional_test.py | 1 - tests/unit_test.py | 15 ++++++++------- tox.ini | 7 ++++++- 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/setup.py b/setup.py index 2de0da67..9ddce484 100755 --- a/setup.py +++ b/setup.py @@ -8,8 +8,8 @@ import os import sys -from setuptools import find_packages, setup - +from setuptools import find_packages +from setuptools import setup here = os.path.abspath(os.path.dirname(__file__)) diff --git a/tests/functional_test.py b/tests/functional_test.py index 1b2ea7c7..26d838cb 100644 --- a/tests/functional_test.py +++ b/tests/functional_test.py @@ -227,7 +227,6 @@ def test_generate_config(custom_args, config_file): def test_generate_credentials(custom_args, config_file): """Run the tool and generate credentials.""" import pyotp - from tokendito import config from tokendito import user diff --git a/tests/unit_test.py b/tests/unit_test.py index 7e2d1d62..3ca91390 100644 --- a/tests/unit_test.py +++ b/tests/unit_test.py @@ -59,7 +59,9 @@ def test_tty_assertion(): """Test the availability of stdin.""" import os import sys + from tokendito.user import tty_assertion + from io import UnsupportedOperation # Save for reuse @@ -313,7 +315,6 @@ def test_update_ini(tmpdir): def test_assert_credentials(): """Test whether getting credentials works as expeted.""" from moto import mock_sts - from tokendito import aws with pytest.raises(SystemExit) as err: @@ -637,8 +638,8 @@ def test_mfa_provider_type( sample_headers, ): """Test whether function return key on specific MFA provider.""" - from tokendito.okta import mfa_provider_type from tokendito import Config + from tokendito.okta import mfa_provider_type payload = {"x": "y", "t": "z"} callback_url = "https://www.acme.org" @@ -673,8 +674,8 @@ def test_mfa_provider_type( def test_bad_mfa_provider_type(mocker, sample_headers): """Test whether function return key on specific MFA provider.""" - from tokendito.okta import mfa_provider_type from tokendito import Config + from tokendito.okta import mfa_provider_type pytest_config = Config() payload = {"x": "y", "t": "z"} @@ -1089,7 +1090,6 @@ def test_get_duo_sid(mocker): def test_authenticate_to_roles(status_code, monkeypatch): """Test if function return correct response.""" import requests - from tokendito.aws import authenticate_to_roles mock_get = {"status_code": status_code, "text": "response"} @@ -1112,6 +1112,7 @@ def test_config_object(): """Test proper initialization of the Config object.""" import json import sys + from tokendito import Config # Test for invalid assignments to the object @@ -1680,8 +1681,8 @@ def test_send_saml_response(mocker): def test_authenticate(mocker): """Test authentication.""" - from tokendito import okta from tokendito import Config + from tokendito import okta pytest_config = Config( okta={ @@ -1712,8 +1713,8 @@ def test_authenticate(mocker): def test_local_auth(mocker): """Test local auth method.""" - from tokendito import okta from tokendito import Config + from tokendito import okta pytest_config = Config( okta={ @@ -1731,8 +1732,8 @@ def test_local_auth(mocker): def test_saml2_auth(mocker): """Test saml2 authentication.""" - from tokendito import okta from tokendito import Config + from tokendito import okta auth_properties = {"id": "id", "metadata": "metadata"} diff --git a/tox.ini b/tox.ini index d9bcfc4f..dc49f46f 100755 --- a/tox.ini +++ b/tox.ini @@ -42,9 +42,14 @@ max-complexity = 8 exclude = .git, __pycache__, .tox, build/, .venv/, venv/ extend-ignore = E203, W503 import-order-style = google -application-import-names = flake8 +application-import-names = google format = %(cyan)s%(path)s%(reset)s:%(bold)s%(yellow)s%(row)d%(reset)s:%(bold)s%(green)s%(col)d%(reset)s: %(bold)s%(red)s%(code)s%(reset)s %(text)s +[isort] +profile = google +known_first_party = io +known_third_party = tokendito + [pytest] env = PIP_DISABLE_PIP_VERSION_CHECK=1