summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorianb <ianb@localhost>2006-08-23 19:21:33 +0000
committerianb <ianb@localhost>2006-08-23 19:21:33 +0000
commitfa347993dc4531f8972037a8a678095f2df85cf5 (patch)
tree17101041630112d69ff054bc6954887810f37078
parente7902749ba0b577e1138ab5fd8372104b1fdd9c3 (diff)
downloadpastedeploy-git-fa347993dc4531f8972037a8a678095f2df85cf5.tar.gz
Fixed problems with tests; FakeApp wasn't loading properly, and the __file__ changes made previously didn't update the tests (so they've been broken for a while)
-rw-r--r--tests/fixture.py7
-rw-r--r--tests/test_config.py20
2 files changed, 20 insertions, 7 deletions
diff --git a/tests/fixture.py b/tests/fixture.py
index b2cc75f..6c3e99f 100644
--- a/tests/fixture.py
+++ b/tests/fixture.py
@@ -1,6 +1,6 @@
import os
+import sys
import shutil
-from pkg_resources import *
test_dir = os.path.dirname(__file__)
egg_info_dir = os.path.join(test_dir, 'fake_packages', 'FakeApp.egg',
@@ -13,4 +13,9 @@ if not os.path.exists(egg_info_dir):
except:
shutil.copytree(info_dir, egg_info_dir)
+sys.path.append(os.path.dirname(egg_info_dir))
+
+from pkg_resources import *
+working_set.add_entry(os.path.dirname(egg_info_dir))
require('FakeApp')
+
diff --git a/tests/test_config.py b/tests/test_config.py
index 1761f17..7626b25 100644
--- a/tests/test_config.py
+++ b/tests/test_config.py
@@ -6,6 +6,7 @@ import fakeapp.configapps as fc
ini_file = 'config:sample_configs/test_config.ini'
here = os.path.dirname(__file__)
config_path = os.path.join(here, 'sample_configs')
+config_filename = os.path.join(config_path, 'test_config.ini')
def test_config_egg():
app = loadapp('egg:FakeApp#configed')
@@ -17,7 +18,8 @@ def test_config1():
'setting1': 'foo', 'setting2': 'bar'}
assert app.global_conf == {
'def1': 'a', 'def2': 'b',
- 'here': config_path}
+ 'here': config_path,
+ '__file__': config_filename}
def test_config2():
app = loadapp(ini_file, relative_to=here, name='test2')
@@ -27,7 +29,8 @@ def test_config2():
'def1': 'test2',
'def2': 'b',
'another': 'TEST',
- 'here': config_path}
+ 'here': config_path,
+ '__file__': config_filename}
# Run this to make sure the global-conf-modified test2
# didn't mess up the general global conf
test_config1()
@@ -42,7 +45,8 @@ def test_config3():
'def1': 'test3',
'def2': 'b',
'another': 'TEST',
- 'here': config_path}
+ 'here': config_path,
+ '__file__': config_filename}
test_config2()
def test_foreign_config():
@@ -56,7 +60,8 @@ def test_foreign_config():
'def2': 'from include',
'def3': 'c',
'glob': 'override',
- 'here': config_path}
+ 'here': config_path,
+ '__file__': os.path.join(config_path, 'test_config_included.ini')}
def test_config_get():
app = loadapp(ini_file, relative_to=here, name='test_get')
@@ -67,7 +72,8 @@ def test_config_get():
assert app.global_conf == {
'def1': 'a',
'def2': 'TEST',
- 'here': config_path}
+ 'here': config_path,
+ '__file__': config_filename}
def test_appconfig():
conf = appconfig(ini_file, relative_to=here, name='test_get')
@@ -75,6 +81,7 @@ def test_appconfig():
'def1': 'a',
'def2': 'TEST',
'here': config_path,
+ '__file__': config_filename,
'foo': 'TEST'}
assert conf.local_conf == {
'def1': 'a',
@@ -82,4 +89,5 @@ def test_appconfig():
assert conf.global_conf == {
'def1': 'a',
'def2': 'TEST',
- 'here': config_path}
+ 'here': config_path,
+ '__file__': config_filename,}