From ea98e5eafc0a7594770d7b9f54f5ac943a82d795 Mon Sep 17 00:00:00 2001 From: Kurt McKee Date: Sat, 30 Apr 2022 20:46:09 -0500 Subject: [PATCH] Add isort as a tox environment, and run it --- dotbot/cli.py | 21 ++++++++++----------- dotbot/config.py | 4 +++- dotbot/dispatcher.py | 5 +++-- dotbot/messenger/__init__.py | 2 +- dotbot/messenger/messenger.py | 2 +- dotbot/plugin.py | 2 +- dotbot/plugins/link.py | 4 ++-- dotbot/util/common.py | 2 +- tests/conftest.py | 2 +- tests/dotbot_plugin_directory.py | 3 ++- tests/dotbot_plugin_file.py | 3 ++- tests/test_clean.py | 1 - tests/test_link.py | 1 - tox.ini | 11 +++++++++++ 14 files changed, 38 insertions(+), 25 deletions(-) diff --git a/dotbot/cli.py b/dotbot/cli.py index b230b6d..d119902 100644 --- a/dotbot/cli.py +++ b/dotbot/cli.py @@ -1,17 +1,16 @@ import glob -import sys - -from argparse import ArgumentParser, RawTextHelpFormatter -from .config import ConfigReader, ReadingError -from .dispatcher import Dispatcher, DispatchError -from .messenger import Messenger -from .messenger import Level -from .plugins import Clean, Create, Link, Shell -from .util import module - -import dotbot import os import subprocess +import sys +from argparse import ArgumentParser, RawTextHelpFormatter + +import dotbot + +from .config import ConfigReader, ReadingError +from .dispatcher import Dispatcher, DispatchError +from .messenger import Level, Messenger +from .plugins import Clean, Create, Link, Shell +from .util import module def add_options(parser): diff --git a/dotbot/config.py b/dotbot/config.py index 9012f17..b076fd6 100644 --- a/dotbot/config.py +++ b/dotbot/config.py @@ -1,6 +1,8 @@ -import yaml import json import os.path + +import yaml + from .util import string diff --git a/dotbot/dispatcher.py b/dotbot/dispatcher.py index ad82bd9..76994c3 100644 --- a/dotbot/dispatcher.py +++ b/dotbot/dispatcher.py @@ -1,8 +1,9 @@ import os from argparse import Namespace -from .plugin import Plugin -from .messenger import Messenger + from .context import Context +from .messenger import Messenger +from .plugin import Plugin class Dispatcher(object): diff --git a/dotbot/messenger/__init__.py b/dotbot/messenger/__init__.py index 38fc6bc..394ebb3 100644 --- a/dotbot/messenger/__init__.py +++ b/dotbot/messenger/__init__.py @@ -1,2 +1,2 @@ -from .messenger import Messenger from .level import Level +from .messenger import Messenger diff --git a/dotbot/messenger/messenger.py b/dotbot/messenger/messenger.py index 2d2eead..ddd8e39 100644 --- a/dotbot/messenger/messenger.py +++ b/dotbot/messenger/messenger.py @@ -1,5 +1,5 @@ -from ..util.singleton import Singleton from ..util.compat import with_metaclass +from ..util.singleton import Singleton from .color import Color from .level import Level diff --git a/dotbot/plugin.py b/dotbot/plugin.py index ef835ab..fd1fe3d 100644 --- a/dotbot/plugin.py +++ b/dotbot/plugin.py @@ -1,5 +1,5 @@ -from .messenger import Messenger from .context import Context +from .messenger import Messenger class Plugin(object): diff --git a/dotbot/plugins/link.py b/dotbot/plugins/link.py index 3e8c91e..d0f8634 100644 --- a/dotbot/plugins/link.py +++ b/dotbot/plugins/link.py @@ -1,7 +1,7 @@ -import os -import sys import glob +import os import shutil +import sys from ..plugin import Plugin from ..util import shell_command diff --git a/dotbot/util/common.py b/dotbot/util/common.py index 62614a1..10dbb48 100644 --- a/dotbot/util/common.py +++ b/dotbot/util/common.py @@ -1,6 +1,6 @@ import os -import subprocess import platform +import subprocess def shell_command(command, cwd=None, enable_stdin=False, enable_stdout=False, enable_stderr=False): diff --git a/tests/conftest.py b/tests/conftest.py index 3d9da2e..94862de 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -2,8 +2,8 @@ import json import os import shutil import sys -from shutil import rmtree import tempfile +from shutil import rmtree import pytest import yaml diff --git a/tests/dotbot_plugin_directory.py b/tests/dotbot_plugin_directory.py index 517b5c8..fe60d7d 100644 --- a/tests/dotbot_plugin_directory.py +++ b/tests/dotbot_plugin_directory.py @@ -4,9 +4,10 @@ This file is copied to a location with the name "directory.py", and is then loaded from within the `test_cli.py` code. """ -import dotbot import os.path +import dotbot + class Directory(dotbot.Plugin): def can_handle(self, directive): diff --git a/tests/dotbot_plugin_file.py b/tests/dotbot_plugin_file.py index 832d585..1dde95d 100644 --- a/tests/dotbot_plugin_file.py +++ b/tests/dotbot_plugin_file.py @@ -4,9 +4,10 @@ This file is copied to a location with the name "file.py", and is then loaded from within the `test_cli.py` code. """ -import dotbot import os.path +import dotbot + class File(dotbot.Plugin): def can_handle(self, directive): diff --git a/tests/test_clean.py b/tests/test_clean.py index 63bcd75..8c6f901 100644 --- a/tests/test_clean.py +++ b/tests/test_clean.py @@ -3,7 +3,6 @@ import sys import pytest - # Python 2.7 on Windows does not have an `os.symlink()` function. # PyPy on Windows raises NotImplementedError when `os.symlink()` is called. # Older Python 3 versions on Windows require admin rights to create symlinks. diff --git a/tests/test_link.py b/tests/test_link.py index 37ddded..47d1051 100644 --- a/tests/test_link.py +++ b/tests/test_link.py @@ -3,7 +3,6 @@ import sys import pytest - # Python 2.7 on Windows does not have an `os.symlink()` function. # PyPy on Windows raises NotImplementedError when `os.symlink()` is called. # Older Python 3 versions on Windows require admin rights to create symlinks. diff --git a/tox.ini b/tox.ini index 3ccd81a..f401e3e 100644 --- a/tox.ini +++ b/tox.ini @@ -3,6 +3,7 @@ envlist = py{27, 35, 36, 37, 38, 39, 310} pypy{2, 3} py310-black + py310-isort skip_missing_interpreters = true @@ -25,3 +26,13 @@ deps = commands = black --check dotbot/ tests/ + + +[testenv:py310-isort] +skip_install = true +skip_build = true +deps = + isort + +commands = + isort --check dotbot/ tests/