Skip to content

Commit 03bf7e2

Browse files
committed
Adding in test plugins. Got these plugins to programmitcally install with python for testing purposes. Started rudimentary config testing. Started working on the cli.load_plugins test.
1 parent a912b1a commit 03bf7e2

File tree

13 files changed

+175
-29
lines changed

13 files changed

+175
-29
lines changed

requirements/test.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ pytest-rerunfailures<9
33
pytest-cov
44
coverage
55
codecov
6+
wheel
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import subprocess
2+
import sys
3+
4+
5+
plugin_paths = [
6+
"plugins/tmuxp_plugin_one",
7+
"plugins/tmuxp_plugin_two"
8+
]
9+
10+
11+
def install(package):
12+
subprocess.check_call([sys.executable, "-m", "pip", "install", package])
13+
14+
15+
def install_plugins():
16+
for plugin in plugin_paths:
17+
install(plugin)
18+
19+
20+
if __name__ == "__main__":
21+
install_plugins()
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from setuptools import setup
2+
3+
setup(
4+
name='tmuxp-plugin-one',
5+
version='0.0.1',
6+
author='Joseph Flinn',
7+
author_email='joseph.s.flinn@gmail.com',
8+
packages=setuptools.find_packages(),
9+
description='A tmuxp plugin to test the plugin system',
10+
)

tests/fixtures/pluginsystem/plugins/tmuxp_plugin_one/tmuxp_plugin_one/__init__.py

Whitespace-only changes.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
class TestPluginOne:
2+
def __init__(self):
3+
self.message = f'[+] This is the Tmuxp Test Plugin'
4+
5+
def before_workspace_builder(self, session):
6+
pass
7+
8+
def before_script(self, session):
9+
pass
10+
11+
def reattach(self, session):
12+
pass
13+
14+
def on_window_create(self, window):
15+
if window.name == 'editor':
16+
pass
17+
18+
def after_window_finished(self, window):
19+
pass
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from setuptools import setup
2+
3+
setup(
4+
name='tmuxp-plugin-two',
5+
version='0.0.1',
6+
author='Joseph Flinn',
7+
author_email='joseph.s.flinn@gmail.com',
8+
packages=setuptools.find_packages(),
9+
description='A tmuxp plugin to test the plugin system',
10+
)

tests/fixtures/pluginsystem/plugins/tmuxp_plugin_two/tmuxp_plugin_two/__init__.py

Whitespace-only changes.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
class TestPluginTwo:
2+
def __init__(self):
3+
self.message = f'[+] This is the Tmuxp Test Plugin'
4+
5+
def before_workspace_builder(self, session):
6+
pass
7+
8+
def before_script(self, session):
9+
pass
10+
11+
def reattach(self, session):
12+
pass
13+
14+
def on_window_create(self, window):
15+
if window.name == 'editor':
16+
pass
17+
18+
def after_window_finished(self, window):
19+
pass
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
session_name: plugin-test
2+
plugins:
3+
- 'tmuxp_plugin_one.plugin.TestPluginOne'
4+
windows:
5+
- window_name: editor
6+
layout: tiled
7+
shell_command_before:
8+
- cd ~/
9+
panes:
10+
- shell_command:
11+
- cd /var/log
12+
- ls -al | grep \.log
13+
- echo hello
14+
- echo hello
15+
- echo hello
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
session_name: plugin-test
2+
plugins:
3+
- 'tmuxp_plugin_one.plugin.TestPluginOne'
4+
- 'tmuxp_plugin_two.plugin.TestPluginTwo'
5+
windows:
6+
- window_name: editor
7+
layout: tiled
8+
shell_command_before:
9+
- cd ~/
10+
panes:
11+
- shell_command:
12+
- cd /var/log
13+
- ls -al | grep \.log
14+
- echo hello
15+
- echo hello
16+
- echo hello

0 commit comments

Comments
 (0)