File tree 1 file changed +23
-1
lines changed
1 file changed +23
-1
lines changed Original file line number Diff line number Diff line change
1
+ import pytest
1
2
from pyflowlauncher .plugin import Plugin
2
3
3
4
@@ -28,4 +29,25 @@ def test_add_methods():
28
29
def test_settings ():
29
30
plugin = Plugin ()
30
31
plugin ._client .recieve = lambda : {'method' : 'settings' , 'parameters' : [], 'settings' : {'test' : 'test' }}
31
- assert plugin .settings == {'test' : 'test' }
32
+ assert plugin .settings == {'test' : 'test' }
33
+
34
+
35
+ def test_run_dir (tmp_path , monkeypatch ):
36
+ monkeypatch .setattr ('sys.argv' , [tmp_path / 'plugin.py' ])
37
+ plugin = Plugin ()
38
+ assert plugin .plugin_run_dir () == tmp_path
39
+
40
+
41
+ def test_root_dir (tmp_path , monkeypatch ):
42
+ monkeypatch .setattr ('sys.argv' , [tmp_path / 'plugin.py' ])
43
+ monkeypatch .setattr ('pyflowlauncher.plugin.Path.exists' , lambda _ : True )
44
+ plugin = Plugin ()
45
+ assert plugin .plugin_root_dir () == tmp_path
46
+
47
+
48
+ def test_root_dir_not_found (tmp_path , monkeypatch ):
49
+ monkeypatch .setattr ('sys.argv' , [tmp_path / 'plugin.py' ])
50
+ monkeypatch .setattr ('pyflowlauncher.plugin.Path.exists' , lambda _ : False )
51
+ plugin = Plugin ()
52
+ with pytest .raises (FileNotFoundError ):
53
+ assert plugin .plugin_root_dir () == tmp_path
You can’t perform that action at this time.
0 commit comments