diff options
author | Eric Lin <anselor@gmail.com> | 2021-01-05 11:29:39 -0500 |
---|---|---|
committer | anselor <anselor@gmail.com> | 2021-01-22 10:40:50 -0500 |
commit | a3b1b6ddf81cdc0b253f15feeb167ff348afd14f (patch) | |
tree | 2556f4aa57d02e12526949c08cf032c3e1a67d11 /tests | |
parent | c1859045c8d439932fac9ceb5203a400db609533 (diff) | |
download | cmd2-git-a3b1b6ddf81cdc0b253f15feeb167ff348afd14f.tar.gz |
Changed isort to force wrapping of imports to reduce merge conflicts from minor import changes.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/conftest.py | 25 | ||||
-rw-r--r-- | tests/test_argparse.py | 9 | ||||
-rw-r--r-- | tests/test_argparse_completer.py | 22 | ||||
-rw-r--r-- | tests/test_argparse_custom.py | 15 | ||||
-rwxr-xr-x | tests/test_cmd2.py | 14 | ||||
-rwxr-xr-x | tests/test_completion.py | 16 | ||||
-rwxr-xr-x | tests/test_history.py | 12 | ||||
-rwxr-xr-x | tests/test_parsing.py | 11 | ||||
-rw-r--r-- | tests/test_plugin.py | 7 | ||||
-rw-r--r-- | tests/test_run_pyscript.py | 12 | ||||
-rw-r--r-- | tests/test_table_creator.py | 4 | ||||
-rw-r--r-- | tests/test_transcript.py | 20 | ||||
-rw-r--r-- | tests/test_utils.py | 7 |
13 files changed, 134 insertions, 40 deletions
diff --git a/tests/conftest.py b/tests/conftest.py index 73080b5c..c0b9e385 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -3,14 +3,27 @@ Cmd2 unit/functional testing """ import sys -from contextlib import redirect_stderr, redirect_stdout -from typing import List, Optional, Union -from unittest import mock - -from pytest import fixture +from contextlib import ( + redirect_stderr, + redirect_stdout, +) +from typing import ( + List, + Optional, + Union, +) +from unittest import ( + mock, +) + +from pytest import ( + fixture, +) import cmd2 -from cmd2.utils import StdSim +from cmd2.utils import ( + StdSim, +) # Prefer statically linked gnureadline if available (for macOS compatibility due to issues with libedit) try: diff --git a/tests/test_argparse.py b/tests/test_argparse.py index 7059e9d3..e7806056 100644 --- a/tests/test_argparse.py +++ b/tests/test_argparse.py @@ -4,13 +4,17 @@ Cmd2 testing for argument parsing """ import argparse -from typing import Optional +from typing import ( + Optional, +) import pytest import cmd2 -from .conftest import run_cmd +from .conftest import ( + run_cmd, +) # Prefer statically linked gnureadline if available (for macOS compatibility due to issues with libedit) try: @@ -457,4 +461,3 @@ def test_pytest_mock_invalid(mocker): def test_pytest_mock_valid(mocker, spec_param): mocker.patch.object(ArgparseApp, 'namespace_provider', **spec_param) app = ArgparseApp() - diff --git a/tests/test_argparse_completer.py b/tests/test_argparse_completer.py index dd86163b..6c3c63fb 100644 --- a/tests/test_argparse_completer.py +++ b/tests/test_argparse_completer.py @@ -5,14 +5,28 @@ Unit/functional testing for argparse completer in cmd2 """ import argparse import numbers -from typing import List +from typing import ( + List, +) import pytest import cmd2 -from cmd2 import Cmd2ArgumentParser, CompletionItem, with_argparser -from cmd2.utils import CompletionError, StdSim, basic_complete -from .conftest import complete_tester, run_cmd +from cmd2 import ( + Cmd2ArgumentParser, + CompletionItem, + with_argparser, +) +from cmd2.utils import ( + CompletionError, + StdSim, + basic_complete, +) + +from .conftest import ( + complete_tester, + run_cmd, +) # Lists used in our tests (there is a mix of sorted and unsorted on purpose) non_negative_int_choices = [1, 2, 3, 0, 22] diff --git a/tests/test_argparse_custom.py b/tests/test_argparse_custom.py index e2b3bb97..4bd41264 100644 --- a/tests/test_argparse_custom.py +++ b/tests/test_argparse_custom.py @@ -7,10 +7,17 @@ import argparse import pytest import cmd2 -from cmd2 import Cmd2ArgumentParser, constants -from cmd2.argparse_custom import generate_range_error - -from .conftest import run_cmd +from cmd2 import ( + Cmd2ArgumentParser, + constants, +) +from cmd2.argparse_custom import ( + generate_range_error, +) + +from .conftest import ( + run_cmd, +) class ApCustomTestApp(cmd2.Cmd): diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py index 5874bcb2..a2299abe 100755 --- a/tests/test_cmd2.py +++ b/tests/test_cmd2.py @@ -9,12 +9,22 @@ import io import os import sys import tempfile -from code import InteractiveConsole +from code import ( + InteractiveConsole, +) import pytest import cmd2 -from cmd2 import COMMAND_NAME, ansi, clipboard, constants, exceptions, plugin, utils +from cmd2 import ( + COMMAND_NAME, + ansi, + clipboard, + constants, + exceptions, + plugin, + utils, +) from .conftest import ( HELP_HISTORY, diff --git a/tests/test_completion.py b/tests/test_completion.py index db243f48..0d8f6eb1 100755 --- a/tests/test_completion.py +++ b/tests/test_completion.py @@ -20,10 +20,18 @@ import sys import pytest import cmd2 -from cmd2 import utils -from examples.subcommands import SubcommandsExample - -from .conftest import complete_tester, normalize, run_cmd +from cmd2 import ( + utils, +) +from examples.subcommands import ( + SubcommandsExample, +) + +from .conftest import ( + complete_tester, + normalize, + run_cmd, +) # List of strings used with completion functions food_item_strs = ['Pizza', 'Ham', 'Ham Sandwich', 'Potato', 'Cheese "Pizza"'] diff --git a/tests/test_history.py b/tests/test_history.py index 6fa16ad8..ac8c6cb6 100755 --- a/tests/test_history.py +++ b/tests/test_history.py @@ -11,9 +11,15 @@ import pytest import cmd2 # Python 3.5 had some regressions in the unitest.mock module, so use # 3rd party mock if available -from cmd2.parsing import StatementParser - -from .conftest import HELP_HISTORY, normalize, run_cmd +from cmd2.parsing import ( + StatementParser, +) + +from .conftest import ( + HELP_HISTORY, + normalize, + run_cmd, +) try: import mock diff --git a/tests/test_parsing.py b/tests/test_parsing.py index 2eccec7c..abf8b9fd 100755 --- a/tests/test_parsing.py +++ b/tests/test_parsing.py @@ -7,8 +7,15 @@ import attr import pytest import cmd2 -from cmd2 import constants, exceptions, utils -from cmd2.parsing import StatementParser, shlex_split +from cmd2 import ( + constants, + exceptions, + utils, +) +from cmd2.parsing import ( + StatementParser, + shlex_split, +) @pytest.fixture diff --git a/tests/test_plugin.py b/tests/test_plugin.py index 279f2f79..4a019b15 100644 --- a/tests/test_plugin.py +++ b/tests/test_plugin.py @@ -9,7 +9,12 @@ import sys import pytest import cmd2 -from cmd2 import Cmd2ArgumentParser, exceptions, plugin, with_argparser +from cmd2 import ( + Cmd2ArgumentParser, + exceptions, + plugin, + with_argparser, +) # Python 3.5 had some regressions in the unitest.mock module, so use 3rd party mock if available try: diff --git a/tests/test_run_pyscript.py b/tests/test_run_pyscript.py index 8cfd8578..a46a3ca3 100644 --- a/tests/test_run_pyscript.py +++ b/tests/test_run_pyscript.py @@ -8,9 +8,15 @@ import os import pytest -from cmd2 import plugin, utils - -from .conftest import odd_file_names, run_cmd +from cmd2 import ( + plugin, + utils, +) + +from .conftest import ( + odd_file_names, + run_cmd, +) # Python 3.5 had some regressions in the unitest.mock module, so use 3rd party mock if available try: diff --git a/tests/test_table_creator.py b/tests/test_table_creator.py index 0d2edfb2..58dd6fdf 100644 --- a/tests/test_table_creator.py +++ b/tests/test_table_creator.py @@ -5,7 +5,9 @@ Unit testing for cmd2/table_creator.py module """ import pytest -from cmd2 import ansi +from cmd2 import ( + ansi, +) from cmd2.table_creator import ( AlternatingTable, BorderedTable, diff --git a/tests/test_transcript.py b/tests/test_transcript.py index 55d60e18..1b9c71fe 100644 --- a/tests/test_transcript.py +++ b/tests/test_transcript.py @@ -9,15 +9,25 @@ import random import re import sys import tempfile -from unittest import mock +from unittest import ( + mock, +) import pytest import cmd2 -from cmd2 import transcript -from cmd2.utils import Settable, StdSim - -from .conftest import run_cmd, verify_help_text +from cmd2 import ( + transcript, +) +from cmd2.utils import ( + Settable, + StdSim, +) + +from .conftest import ( + run_cmd, + verify_help_text, +) class CmdLineApp(cmd2.Cmd): diff --git a/tests/test_utils.py b/tests/test_utils.py index 5336ccfd..e6853570 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -10,13 +10,16 @@ import time import pytest +import cmd2.utils as cu +from cmd2.constants import ( + HORIZONTAL_ELLIPSIS, +) + try: import mock except ImportError: from unittest import mock -import cmd2.utils as cu -from cmd2.constants import HORIZONTAL_ELLIPSIS HELLO_WORLD = 'Hello, world!' |