1 """Test that a plugin can be loaded by directory.
3 This file is copied to a location with the name "directory.py",
4 and is then loaded from within the `test_cli.py` code.
13 class Directory(dotbot
.Plugin
):
14 def can_handle(self
, directive
: str) -> bool:
15 return directive
== "plugin_directory"
17 def handle(self
, directive
: str, _data
: Any
) -> bool:
18 if directive
!= "plugin_directory":
19 msg
= f
"Directory cannot handle directive {directive}"
21 self
._log
.debug("Attempting to get options from Context")
22 options
= self
._context
.options()
23 if len(options
.plugin_dirs
) != 1:
24 self
._log
.debug("Context.options.plugins length is %i, expected 1" % len(options
.plugins
))
27 with
open(os
.path
.abspath(os
.path
.expanduser("~/flag")), "w") as file:
28 file.write("directory plugin loading works")