diff options
| author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2021-01-31 22:29:57 -0500 |
|---|---|---|
| committer | Todd Leonhardt <todd.leonhardt@gmail.com> | 2021-01-31 22:29:57 -0500 |
| commit | f456b802754c3d1095b488d670bebba21018d823 (patch) | |
| tree | bf7011f585a8a35ab4cc7ff98aaeebed4de87f84 /plugins/ext_test | |
| parent | 918200c02d392c17862fff81bbf58820ed15c725 (diff) | |
| download | cmd2-git-f456b802754c3d1095b488d670bebba21018d823.tar.gz | |
Add black for automatic code format
Diffstat (limited to 'plugins/ext_test')
| -rw-r--r-- | plugins/ext_test/cmd2_ext_test/__init__.py | 8 | ||||
| -rw-r--r-- | plugins/ext_test/examples/example.py | 1 | ||||
| -rw-r--r-- | plugins/ext_test/setup.py | 20 | ||||
| -rw-r--r-- | plugins/ext_test/tasks.py | 14 | ||||
| -rw-r--r-- | plugins/ext_test/tests/test_ext_test.py | 4 |
5 files changed, 19 insertions, 28 deletions
diff --git a/plugins/ext_test/cmd2_ext_test/__init__.py b/plugins/ext_test/cmd2_ext_test/__init__.py index ded8612c..2cc38807 100644 --- a/plugins/ext_test/cmd2_ext_test/__init__.py +++ b/plugins/ext_test/cmd2_ext_test/__init__.py @@ -17,10 +17,6 @@ except importlib_metadata.PackageNotFoundError: # pragma: no cover # package is not installed __version__ = 'unknown' -from .cmd2_ext_test import ( - ExternalTestMixin, -) +from .cmd2_ext_test import ExternalTestMixin -__all__ = [ - 'ExternalTestMixin' -] +__all__ = ['ExternalTestMixin'] diff --git a/plugins/ext_test/examples/example.py b/plugins/ext_test/examples/example.py index d7f0c762..3bfdf7e7 100644 --- a/plugins/ext_test/examples/example.py +++ b/plugins/ext_test/examples/example.py @@ -8,6 +8,7 @@ import cmd2_ext_test class Example(cmd2.Cmd): """An class to show how to use a plugin""" + def __init__(self, *args, **kwargs): # gotta have this or neither the plugin or cmd2 will initialize super().__init__(*args, **kwargs) diff --git a/plugins/ext_test/setup.py b/plugins/ext_test/setup.py index c78a8612..7dc55f6a 100644 --- a/plugins/ext_test/setup.py +++ b/plugins/ext_test/setup.py @@ -23,26 +23,19 @@ PACKAGE_DATA = { setuptools.setup( name='cmd2-ext-test', version=scm_version, - description='External test plugin for cmd2. Allows for external invocation of commands as if from a cmd2 pyscript', long_description=long_description, long_description_content_type='text/markdown', keywords='cmd2 test plugin', - author='Eric Lin', author_email='anselor@gmail.com', url='https://github.com/python-cmd2/cmd2/tree/master/plugins/ext_test', license='MIT', - package_data=PACKAGE_DATA, packages=['cmd2_ext_test'], - python_requires='>=3.5', install_requires=['cmd2 >= 0.9.4, <=2'], - setup_requires=[ - 'setuptools >= 42', - 'setuptools_scm >= 3.4'], - + setup_requires=['setuptools >= 42', 'setuptools_scm >= 3.4'], classifiers=[ 'Development Status :: 5 - Production/Stable', 'Environment :: Console', @@ -57,17 +50,10 @@ setuptools.setup( 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', ], - # dependencies for development and testing # $ pip install -e .[dev] extras_require={ - 'test': [ - 'codecov', - 'coverage', - 'pytest', - 'pytest-cov', - ], - 'dev': ['setuptools_scm', 'pytest', 'codecov', 'pytest-cov', - 'pylint', 'invoke', 'wheel', 'twine'] + 'test': ['codecov', 'coverage', 'pytest', 'pytest-cov'], + 'dev': ['setuptools_scm', 'pytest', 'codecov', 'pytest-cov', 'pylint', 'invoke', 'wheel', 'twine'], }, ) diff --git a/plugins/ext_test/tasks.py b/plugins/ext_test/tasks.py index f23faa69..757dfe79 100644 --- a/plugins/ext_test/tasks.py +++ b/plugins/ext_test/tasks.py @@ -57,7 +57,7 @@ def pytest(context, junit=False, pty=True, append_cov=False): command_str += ' --cov-append' if junit: command_str += ' --junitxml=junit/test-results.xml' - command_str += ' ' + str((TASK_ROOT/'tests').relative_to(ROOT_PATH)) + command_str += ' ' + str((TASK_ROOT / 'tests').relative_to(ROOT_PATH)) context.run(command_str, pty=pty) @@ -71,8 +71,8 @@ def pytest_clean(context): with context.cd(TASK_ROOT_STR): dirs = ['.pytest_cache', '.cache', 'htmlcov', '.coverage'] rmrf(dirs) - - + + namespace_clean.add_task(pytest_clean, 'pytest') @@ -140,6 +140,8 @@ namespace_clean.add_task(dist_clean, 'dist') # # make a dummy clean task which runs all the tasks in the clean namespace clean_tasks = list(namespace_clean.tasks.values()) + + @invoke.task(pre=list(namespace_clean.tasks.values()), default=True) def clean_all(context): """Run all clean tasks""" @@ -195,8 +197,10 @@ namespace.add_task(pypi_test) def flake8(context): """Run flake8 linter and tool for style guide enforcement""" with context.cd(TASK_ROOT_STR): - context.run("flake8 --ignore=E252,W503 --max-complexity=26 --max-line-length=127 --show-source --statistics " - "--exclude=.git,__pycache__,.tox,.nox,.eggs,*.egg,.venv,.idea,.pytest_cache,.vscode,build,dist,htmlcov") + context.run( + "flake8 --ignore=E252,W503 --max-complexity=26 --max-line-length=127 --show-source --statistics " + "--exclude=.git,__pycache__,.tox,.nox,.eggs,*.egg,.venv,.idea,.pytest_cache,.vscode,build,dist,htmlcov" + ) namespace.add_task(flake8) diff --git a/plugins/ext_test/tests/test_ext_test.py b/plugins/ext_test/tests/test_ext_test.py index d55911c3..39783158 100644 --- a/plugins/ext_test/tests/test_ext_test.py +++ b/plugins/ext_test/tests/test_ext_test.py @@ -20,6 +20,7 @@ OUT_MSG = 'this is the something command' class ExampleApp(cmd2.Cmd): """An class to show how to use a plugin""" + def __init__(self, *args, **kwargs): # gotta have this or neither the plugin or cmd2 will initialize super().__init__(*args, **kwargs) @@ -31,11 +32,13 @@ class ExampleApp(cmd2.Cmd): # Define a tester class that brings in the external test mixin + class ExampleTester(cmd2_ext_test.ExternalTestMixin, ExampleApp): def __init__(self, *args, **kwargs): # gotta have this or neither the plugin or cmd2 will initialize super().__init__(*args, **kwargs) + # # You can't use a fixture to instantiate your app if you want to use # to use the capsys fixture to capture the output. cmd2.Cmd sets @@ -62,6 +65,7 @@ def example_app(): # ##### + def test_something(example_app): # load our fixture # execute a command |
