Skip to content

Commit

Permalink
fix for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
mcdonc committed Feb 28, 2012
1 parent 5dd2532 commit 0062741
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
14 changes: 5 additions & 9 deletions pyramid/tests/test_paster.py
@@ -1,3 +1,4 @@
import os
import unittest

class Test_get_app(unittest.TestCase):
Expand All @@ -6,7 +7,6 @@ def _callFUT(self, config_file, section_name, loadapp):
return get_app(config_file, section_name, loadapp)

def test_it(self):
import os
app = DummyApp()
loadapp = DummyLoadWSGI(app)
result = self._callFUT('/foo/bar/myapp.ini', 'myapp', loadapp)
Expand All @@ -16,7 +16,6 @@ def test_it(self):
self.assertEqual(result, app)

def test_it_with_hash(self):
import os
app = DummyApp()
loadapp = DummyLoadWSGI(app)
result = self._callFUT('/foo/bar/myapp.ini#myapp', None, loadapp)
Expand All @@ -26,7 +25,6 @@ def test_it_with_hash(self):
self.assertEqual(result, app)

def test_it_with_hash_and_name_override(self):
import os
app = DummyApp()
loadapp = DummyLoadWSGI(app)
result = self._callFUT('/foo/bar/myapp.ini#myapp', 'yourapp', loadapp)
Expand All @@ -41,7 +39,6 @@ def _callFUT(self, config_file, section_name, appconfig):
return get_appsettings(config_file, section_name, appconfig)

def test_it(self):
import os
values = {'a':1}
appconfig = DummyLoadWSGI(values)
result = self._callFUT('/foo/bar/myapp.ini', 'myapp', appconfig)
Expand All @@ -51,7 +48,6 @@ def test_it(self):
self.assertEqual(result, values)

def test_it_with_hash(self):
import os
values = {'a':1}
appconfig = DummyLoadWSGI(values)
result = self._callFUT('/foo/bar/myapp.ini#myapp', None, appconfig)
Expand All @@ -61,7 +57,6 @@ def test_it_with_hash(self):
self.assertEqual(result, values)

def test_it_with_hash_and_name_override(self):
import os
values = {'a':1}
appconfig = DummyLoadWSGI(values)
result = self._callFUT('/foo/bar/myapp.ini#myapp', 'yourapp', appconfig)
Expand All @@ -78,9 +73,10 @@ def _callFUT(self, config_file):

def test_it(self):
config_file, dict = self._callFUT('/abc')
self.assertEqual(config_file, '/abc')
self.assertEqual(dict['__file__'], '/abc')
self.assertEqual(dict['here'], '/')
# os.path.abspath is a sop to Windows
self.assertEqual(config_file, os.path.abspath('/abc'))
self.assertEqual(dict['__file__'], os.path.abspath('/abc'))
self.assertEqual(dict['here'], os.path.abspath('/'))

def fileConfig(self, config_file, dict):
return config_file, dict
Expand Down
4 changes: 2 additions & 2 deletions pyramid/tests/test_scaffolds/test_copydir.py
Expand Up @@ -30,7 +30,7 @@ def test_copy_source_as_pkg_resource(self):
1, False,
template_renderer=dummy_template_renderer)
result = self.out.getvalue()
self.assertTrue('Creating %s/mypackage/' % self.dirname in result)
self.assertTrue('Creating' in result)
self.assertTrue(
'Copying fixture_scaffold/+package+/__init__.py_tmpl to' in result)
source = pkg_resources.resource_filename(
Expand All @@ -52,7 +52,7 @@ def test_copy_source_as_dirname(self):
1, False,
template_renderer=dummy_template_renderer)
result = self.out.getvalue()
self.assertTrue('Creating %s/mypackage/' % self.dirname in result)
self.assertTrue('Creating' in result)
self.assertTrue('Copying __init__.py_tmpl to' in result)
source = pkg_resources.resource_filename(
'pyramid.tests.test_scaffolds',
Expand Down
8 changes: 5 additions & 3 deletions pyramid/tests/test_scripts/test_common.py
@@ -1,3 +1,4 @@
import os
import unittest

class Test_logging_file_config(unittest.TestCase):
Expand All @@ -8,9 +9,10 @@ def _callFUT(self, config_file):

def test_it(self):
config_file, dict = self._callFUT('/abc')
self.assertEqual(config_file, '/abc')
self.assertEqual(dict['__file__'], '/abc')
self.assertEqual(dict['here'], '/')
# use of os.path.abspath here is a sop to Windows
self.assertEqual(config_file, os.path.abspath('/abc'))
self.assertEqual(dict['__file__'], os.path.abspath('/abc'))
self.assertEqual(dict['here'], os.path.abspath('/'))

def fileConfig(self, config_file, dict):
return config_file, dict
Expand Down

0 comments on commit 0062741

Please sign in to comment.