Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix tests
  • Loading branch information
dwhswenson committed May 14, 2020
commit dd48f887c3d39f5c1f309b127324068098e4638c
11 changes: 10 additions & 1 deletion paths_cli/tests/null_command.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import logging
import click

from paths_cli.plugin_management import FilePluginLoader, OPSPlugin

@click.command(
'null-command',
short_help="Do nothing (testing)"
Expand All @@ -14,7 +17,13 @@ def null_command():
class NullCommandContext(object):
"""Context that registers/deregisters the null command (for tests)"""
def __init__(self, cli):
self.plugin = cli._load_plugin_files([__file__])[0]
self.plugin = OPSPlugin(name="null-command",
location=__file__,
func=CLI,
section=SECTION,
plugin_type="file")

cli._register_plugin(self.plugin)
self.cli = cli

def __enter__(self):
Expand Down
4 changes: 3 additions & 1 deletion paths_cli/tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ def make_mock(name, helpless=False):
}
self.plugins = list(self.plugin_dict.values())
self.cli = OpenPathSamplingCLI()
for plugin in self.cli.plugins:
# need to copy the plugins since we're changing the list
for plugin in self.cli.plugins[:]:
self.cli._deregister_plugin(plugin)

for plugin in self.plugins:
self.cli._register_plugin(plugin)

Expand Down