diff options
Diffstat (limited to 'paste/tests')
| -rw-r--r-- | paste/tests/pyconfig_data/context.py | 8 | ||||
| -rw-r--r-- | paste/tests/pyconfig_data/deriv.conf | 3 | ||||
| -rw-r--r-- | paste/tests/pyconfig_data/loader.conf | 5 | ||||
| -rw-r--r-- | paste/tests/pyconfig_data/loader_included.conf | 2 | ||||
| -rw-r--r-- | paste/tests/pyconfig_data/loader_loaded.conf | 2 | ||||
| -rw-r--r-- | paste/tests/pyconfig_data/nest1.conf | 3 | ||||
| -rw-r--r-- | paste/tests/pyconfig_data/nest2.conf | 2 | ||||
| -rw-r--r-- | paste/tests/pyconfig_data/one.py | 2 | ||||
| -rw-r--r-- | paste/tests/test_pyconfig.py | 58 |
9 files changed, 0 insertions, 85 deletions
diff --git a/paste/tests/pyconfig_data/context.py b/paste/tests/pyconfig_data/context.py deleted file mode 100644 index 73fa626..0000000 --- a/paste/tests/pyconfig_data/context.py +++ /dev/null @@ -1,8 +0,0 @@ -def simplehook(): - return 'calc' -simplehook.config_hook = True - -def complexhook(context): - return context -complexhook.config_hook = True - diff --git a/paste/tests/pyconfig_data/deriv.conf b/paste/tests/pyconfig_data/deriv.conf deleted file mode 100644 index c7cdf3c..0000000 --- a/paste/tests/pyconfig_data/deriv.conf +++ /dev/null @@ -1,3 +0,0 @@ -import os - -test1 = test1 + '+another' diff --git a/paste/tests/pyconfig_data/loader.conf b/paste/tests/pyconfig_data/loader.conf deleted file mode 100644 index a8b0e55..0000000 --- a/paste/tests/pyconfig_data/loader.conf +++ /dev/null @@ -1,5 +0,0 @@ -value1 = 'value' -lst = ['a'] -loaded = load('loader_loaded.conf') - -include('loader_included.conf') diff --git a/paste/tests/pyconfig_data/loader_included.conf b/paste/tests/pyconfig_data/loader_included.conf deleted file mode 100644 index 230a3e1..0000000 --- a/paste/tests/pyconfig_data/loader_included.conf +++ /dev/null @@ -1,2 +0,0 @@ -new_value = 10 -value1 += 'more' diff --git a/paste/tests/pyconfig_data/loader_loaded.conf b/paste/tests/pyconfig_data/loader_loaded.conf deleted file mode 100644 index fcf44e7..0000000 --- a/paste/tests/pyconfig_data/loader_loaded.conf +++ /dev/null @@ -1,2 +0,0 @@ -value1 = value1 + ' a test' -lst.append('b') diff --git a/paste/tests/pyconfig_data/nest1.conf b/paste/tests/pyconfig_data/nest1.conf deleted file mode 100644 index 4eb06c6..0000000 --- a/paste/tests/pyconfig_data/nest1.conf +++ /dev/null @@ -1,3 +0,0 @@ -a = 1 -b = 'shadow' - diff --git a/paste/tests/pyconfig_data/nest2.conf b/paste/tests/pyconfig_data/nest2.conf deleted file mode 100644 index c70b217..0000000 --- a/paste/tests/pyconfig_data/nest2.conf +++ /dev/null @@ -1,2 +0,0 @@ -b = 2 -c = 3 diff --git a/paste/tests/pyconfig_data/one.py b/paste/tests/pyconfig_data/one.py deleted file mode 100644 index e03cf8b..0000000 --- a/paste/tests/pyconfig_data/one.py +++ /dev/null @@ -1,2 +0,0 @@ -name1 = 'n1' -name2 = 'n2' diff --git a/paste/tests/test_pyconfig.py b/paste/tests/test_pyconfig.py deleted file mode 100644 index 9c1af73..0000000 --- a/paste/tests/test_pyconfig.py +++ /dev/null @@ -1,58 +0,0 @@ -import os -from paste import pyconfig -from py.test import raises -from paste import reloader - -def path(name): - return os.path.join(os.path.dirname(os.path.abspath(__file__)), - 'pyconfig_data', name) - -def test_load(): - conf = pyconfig.load(path('one.py')) - assert conf['name1'] == 'n1' - assert conf['name2'] == "n2" - raises(KeyError, "conf['name3']") - -def test_nest(): - conf = pyconfig.load(path('nest1.conf')) - conf.load(path('nest2.conf')) - assert conf['a'] == 1 - assert conf['b'] == 2 - assert conf['c'] == 3 - -def test_derivative(): - conf = pyconfig.Config() - conf.load_dict({'test1': 'a'}) - assert conf['test1'] == 'a' - conf.load(path('deriv.conf')) - assert conf['test1'] == 'a+another' - conf = pyconfig.Config() - conf.load_dict({'test1': 'b'}) - conf.load(path('deriv.conf')) - assert conf['test1'] == 'b+another' - assert not conf.has_key('os') - -def test_command(): - conf = pyconfig.load(path('one.py')) - extra = conf.load_commandline( - ['-h', '--host', 'localhost', '--port=8080', 'arg1', '-f', 'arg2'], - bool_options=['help', 'verbose'], - aliases={'f': 'config_file', 'h': 'help', 'v': 'verbose'}) - assert extra == ['arg1'] - assert conf['name1'] == 'n1' - assert conf['host'] == 'localhost' - assert conf['port'] == 8080 - assert conf['config_file'] == 'arg2' - raises(KeyError, "conf['h']") - raises(KeyError, "conf['f']") - -def test_load(): - conf = pyconfig.load(path('loader.conf')) - print conf - assert conf['value1'] == 'valuemore' - assert conf['new_value'] == 10 - assert conf['lst'] == ['a', 'b'] - assert conf['loaded']['value1'] == 'value a test' - extra = reloader.Monitor.global_extra_files - for fn in 'loader.conf', 'loader_loaded.conf', 'loader_included.conf': - assert path(fn) in extra |
