Imported from SVN by Bitbucket
This commit is contained in:
25
PasteScript-1.7.4.2-py2.6.egg/tests/test_plugin_adder.py
Executable file
25
PasteScript-1.7.4.2-py2.6.egg/tests/test_plugin_adder.py
Executable file
@@ -0,0 +1,25 @@
|
||||
import os
|
||||
from paste.script import pluginlib
|
||||
|
||||
egg_dir = os.path.join(os.path.dirname(__file__),
|
||||
'fake_packages', 'FakePlugin.egg')
|
||||
|
||||
plugin_file = os.path.join(egg_dir, 'paster_plugins.txt')
|
||||
|
||||
def plugin_lines():
|
||||
if not os.path.exists(plugin_file):
|
||||
return []
|
||||
f = open(plugin_file)
|
||||
lines = f.readlines()
|
||||
f.close()
|
||||
return [l.strip() for l in lines if l.strip()]
|
||||
|
||||
def test_add_remove():
|
||||
prev = plugin_lines()
|
||||
pluginlib.add_plugin(egg_dir, 'Test')
|
||||
assert 'Test' in plugin_lines()
|
||||
pluginlib.remove_plugin(egg_dir, 'Test')
|
||||
assert 'Test' not in plugin_lines()
|
||||
assert prev == plugin_lines()
|
||||
if not prev and os.path.exists(plugin_file):
|
||||
os.unlink(plugin_file)
|
||||
Reference in New Issue
Block a user