diff options
| author | Igor Stroh <rennpferd@gmail.com> | 2015-06-10 23:11:42 +0200 |
|---|---|---|
| committer | Igor Stroh <rennpferd@gmail.com> | 2015-06-10 23:11:42 +0200 |
| commit | 7dc81f082adba97effc3ce3726e453ec71e841b7 (patch) | |
| tree | f1af179627760f8064a9491586d0bf0c03a65799 | |
| parent | e7a731c1dc6d6e56acf978c44ad9e4f095695b8d (diff) | |
| download | pyramid-7dc81f082adba97effc3ce3726e453ec71e841b7.tar.gz pyramid-7dc81f082adba97effc3ce3726e453ec71e841b7.tar.bz2 pyramid-7dc81f082adba97effc3ce3726e453ec71e841b7.zip | |
added py2.6 compatibility, removed test for 'site'
- Made sure str.format() calls are py2.6 compatible
- Removed test_scaffolds/test_init.py#test_pre_site
since the check is handled in pcreate script
| -rw-r--r-- | pyramid/scripts/pcreate.py | 13 | ||||
| -rw-r--r-- | pyramid/tests/test_scaffolds/test_init.py | 5 |
2 files changed, 8 insertions, 10 deletions
diff --git a/pyramid/scripts/pcreate.py b/pyramid/scripts/pcreate.py index 2c05d87b2..881aacac3 100644 --- a/pyramid/scripts/pcreate.py +++ b/pyramid/scripts/pcreate.py @@ -9,7 +9,10 @@ import pkg_resources import re import sys -user_input = input if sys.version_info[0] == 3 else raw_input +if sys.version_info[0] == 3: + user_input = input # pragma: no cover +else: + user_input = raw_input # NOQA _bad_chars_re = re.compile('[^a-zA-Z0-9_]') @@ -187,7 +190,7 @@ class PCreateCommand(object): self.out('The package name "site" has a special meaning in ' 'Python. Are you sure you want to use it as your ' 'project\'s name?') - return self.confirm_bad_name('Really use "{}"?: '.format(pkg_name)) + return self.confirm_bad_name('Really use "{0}"?: '.format(pkg_name)) # check if pkg_name can be imported (i.e. already exists in current # $PYTHON_PATH, if so - let the user confirm @@ -201,12 +204,12 @@ class PCreateCommand(object): if self.options.force_bad_name: return True - self.out('Package "{}" already exists, are you sure you want ' + self.out('Package "{0}" already exists, are you sure you want ' 'to use it as your project\'s name?'.format(pkg_name)) - return self.confirm_bad_name('Really use "{}"?: '.format(pkg_name)) + return self.confirm_bad_name('Really use "{0}"?: '.format(pkg_name)) def confirm_bad_name(self, prompt): # pragma: no cover - answer = user_input('{} [y|N]: '.format(prompt)) + answer = user_input('{0} [y|N]: '.format(prompt)) return answer.strip().lower() == 'y' if __name__ == '__main__': # pragma: no cover diff --git a/pyramid/tests/test_scaffolds/test_init.py b/pyramid/tests/test_scaffolds/test_init.py index 4988e66ff..f4d1b287a 100644 --- a/pyramid/tests/test_scaffolds/test_init.py +++ b/pyramid/tests/test_scaffolds/test_init.py @@ -12,11 +12,6 @@ class TestPyramidTemplate(unittest.TestCase): self.assertTrue(vars['random_string']) self.assertEqual(vars['package_logger'], 'one') - def test_pre_site(self): - inst = self._makeOne() - vars = {'package':'site'} - self.assertRaises(ValueError, inst.pre, 'command', 'output dir', vars) - def test_pre_root(self): inst = self._makeOne() vars = {'package':'root'} |
