diff options
| -rw-r--r-- | CONTRIBUTORS.txt | 8 | ||||
| -rw-r--r-- | HACKING.txt | 42 | ||||
| -rw-r--r-- | docs/tutorials/wiki2/basiclayout.rst | 6 | ||||
| -rw-r--r-- | docs/tutorials/wiki2/installation.rst | 42 | ||||
| -rw-r--r-- | docs/tutorials/wiki2/tests.rst | 2 | ||||
| -rw-r--r-- | docs/whatsnew-1.0.rst | 2 | ||||
| -rw-r--r-- | pyramid/httpexceptions.py | 2 | ||||
| -rw-r--r-- | pyramid/scripts/pcreate.py | 5 | ||||
| -rw-r--r-- | pyramid/scripts/pserve.py | 4 | ||||
| -rw-r--r-- | pyramid/tests/test_httpexceptions.py | 6 | ||||
| -rw-r--r-- | pyramid/tests/test_scripts/test_pcreate.py | 16 | ||||
| -rw-r--r-- | rtd.txt (renamed from rtd_requirements.txt) | 0 |
12 files changed, 92 insertions, 43 deletions
diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index 28a2b5ed4..2654801c3 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -1,4 +1,4 @@ -Pylons Project Contributor Agreement + Pylons Project Contributor Agreement ==================================== The submitter agrees by adding his or her name within the section below named @@ -149,4 +149,10 @@ Contributors - Manuel Hermann, 2011/07/11 +- Richard Barrell, 2011/11/07 + +- Chris Shenton, 2011/11/07 + - Ken Manheimer, 2011/11/07 + +- Reed O'Brien, 2011/11/07 diff --git a/HACKING.txt b/HACKING.txt index 0194e9bab..d122a7a25 100644 --- a/HACKING.txt +++ b/HACKING.txt @@ -29,11 +29,6 @@ checkout. $ env/bin/easy_install setuptools-git -- Install ``nose`` and ``coverage`` into the virtualenv (for running nose - tests with coverage via ``setup.py nosetests --with-coverage``):: - - $ env/bin/easy_install nose coverage - - Install Pyramid from the checkout into the virtualenv using ``setup.py develop`` (running ``setup.py develop`` *must* be done while the current working directory is the ``pyramid`` checkout directory):: @@ -42,10 +37,10 @@ checkout. $ ../env/bin/python setup.py develop - At that point, you should be able to create new Pyramid projects by using - ``paster create``:: + ``pcreate``:: $ cd ../env - $ bin/paster create -t pyramid_starter starter + $ bin/pcreate -s starter starter - And install those projects (also using ``setup.py develop``) into the virtualenv:: @@ -61,8 +56,10 @@ In order to add a feature to Pyramid: - The feature must be documented in both the API and narrative documentation (in ``docs/``). -- The feature must work fully on the following CPython versions: 2.4, - 2.5, 2.6, and 2.7 on both UNIX and Windows. +- The feature must work fully on the following CPython versions: 2.6, + 2.7, and 3.2 on both UNIX and Windows. + +- The feature must work on the latest version of PyPy. - The feature must not cause installation or runtime failure on Jython or App Engine. If it doesn't cause installation or runtime failure, @@ -88,12 +85,33 @@ Coding Style 2 newlines between classes. But 80-column lines, in particular, are mandatory. +Running Tests +-------------- + +- To run tests for Pyramid on a single Python version, run ``python setup.py + test`` against the using the Python interpreter from virtualenv into which + you've ``setup.py develop``-ed Pyramid. + +- To run the full set of Pyramid tests on all platforms, install ``tox`` + (http://codespeak.net/~hpk/tox/) into a system Python. The ``tox`` console + script will be installed into the scripts location for that Python. While + ``cd``'ed to the Pyramid checkout root directory (it contains ``tox.ini``), + invoke the ``tox`` console script. This will read the ``tox.ini`` file and + execute the tests on multiple Python versions and platforms; while it runs, + it creates a virtualenv for each version/platform combination. For + example:: + + $ /usr/bin/easy_install tox + $ cd ~/hack-on-pyramid/pyramid + $ /usr/bin/tox + Test Coverage ------------- -- The codebase *must* have 100% test statement coverage after each - commit. You can test coverage via ``python setup.py nosetests - --with-coverage`` (requires the ``nose`` and ``coverage`` packages). +- The codebase *must* have 100% test statement coverage after each commit. + You can test coverage via ``tox -e coverage``, or alternately by installing + ``nose`` and ``coverage`` into your virtualenv, and running ``setup.py + nosetests --with-coverage``. Documentation Coverage ---------------------- diff --git a/docs/tutorials/wiki2/basiclayout.rst b/docs/tutorials/wiki2/basiclayout.rst index 8dc886373..acd2f04f3 100644 --- a/docs/tutorials/wiki2/basiclayout.rst +++ b/docs/tutorials/wiki2/basiclayout.rst @@ -2,7 +2,7 @@ Basic Layout ============ -The starter files generated by the ``pyramid_routesalchemy`` scaffold are +The starter files generated by the ``routesalchemy`` scaffold are basic, but they provide a good orientation for the high-level patterns common to most :term:`url dispatch` -based :app:`Pyramid` projects. @@ -98,7 +98,7 @@ register views for the routes, mapping your patterns to code: The first positional ``add_view`` argument ``tutorial.views.my_view`` is the dotted name to a *function* we write (generated by the -``pyramid_routesalchemy`` scaffold) that is given a ``request`` object and +``routesalchemy`` scaffold) that is given a ``request`` object and which returns a response or a dictionary. This view also names a ``renderer``, which is a template which lives in the ``templates`` subdirectory of the package. When the ``tutorial.views.my_view`` view @@ -124,7 +124,7 @@ Content Models with ``models.py`` In a SQLAlchemy-based application, a *model* object is an object composed by querying the SQL database which backs an application. SQLAlchemy is an "object relational mapper" (an ORM). The -``models.py`` file is where the ``pyramid_routesalchemy`` scaffold +``models.py`` file is where the ``routesalchemy`` scaffold put the classes that implement our models. Let's take a look. First, we need some imports to support later code. diff --git a/docs/tutorials/wiki2/installation.rst b/docs/tutorials/wiki2/installation.rst index f9f5c4fba..ded36f6e2 100644 --- a/docs/tutorials/wiki2/installation.rst +++ b/docs/tutorials/wiki2/installation.rst @@ -84,7 +84,7 @@ Making a Project Your next step is to create a project. :app:`Pyramid` supplies a variety of scaffolds to generate sample projects. We will use the -``pyramid_routesalchemy`` scaffold, which generates an application +``routesalchemy`` scaffold, which generates an application that uses :term:`SQLAlchemy` and :term:`URL dispatch`. The below instructions assume your current working directory is the @@ -102,7 +102,7 @@ On Windows: c:\pyramidtut> Scripts\pcreate -s routesalchemy tutorial -.. note:: If you are using Windows, the ``pyramid_routesalchemy`` +.. note:: If you are using Windows, the ``routesalchemy`` scaffold may not deal gracefully with installation into a location that contains spaces in the path. If you experience startup problems, try putting both the virtualenv and the project @@ -151,23 +151,6 @@ On Windows: c:\pyramidtut\tutorial> ..\Scripts\python setup.py test -q -Starting the Application -======================== - -Start the application. - -On UNIX: - -.. code-block:: text - - $ ../bin/pserve development.ini --reload - -On Windows: - -.. code-block:: text - - c:\pyramidtut\tutorial> ..\Scripts\pserve development.ini --reload - Exposing Test Coverage Information ================================== @@ -211,6 +194,23 @@ On Windows: Looks like our package's ``models`` module doesn't quite have 100% test coverage. +Starting the Application +======================== + +Start the application. + +On UNIX: + +.. code-block:: text + + $ ../bin/pserve development.ini --reload + +On Windows: + +.. code-block:: text + + c:\pyramidtut\tutorial> ..\Scripts\pserve development.ini --reload + Visit the Application in a Browser ================================== @@ -222,10 +222,10 @@ page. You can read more about the purpose of the icon at :ref:`debug_toolbar`. It allows you to get information about your application while you develop. -Decisions the ``pyramid_routesalchemy`` Scaffold Has Made For You +Decisions the ``routesalchemy`` Scaffold Has Made For You ================================================================= -Creating a project using the ``pyramid_routesalchemy`` scaffold makes +Creating a project using the ``routesalchemy`` scaffold makes the following assumptions: - you are willing to use :term:`SQLAlchemy` as a database access tool diff --git a/docs/tutorials/wiki2/tests.rst b/docs/tutorials/wiki2/tests.rst index c120b1c61..d0027d2f8 100644 --- a/docs/tutorials/wiki2/tests.rst +++ b/docs/tutorials/wiki2/tests.rst @@ -13,7 +13,7 @@ We write a test class for the model class ``Page`` and another test class for the ``initialize_sql`` function. To do so, we'll retain the ``tutorial.tests.ViewTests`` class provided as a -result of the ``pyramid_routesalchemy`` project generator. We'll add two +result of the ``routesalchemy`` project generator. We'll add two test classes: one for the ``Page`` model named ``PageModelTests``, one for the ``initialize_sql`` function named ``InitializeSqlTests``. diff --git a/docs/whatsnew-1.0.rst b/docs/whatsnew-1.0.rst index 61d74a899..66cb9be3a 100644 --- a/docs/whatsnew-1.0.rst +++ b/docs/whatsnew-1.0.rst @@ -110,7 +110,7 @@ Scaffold Improvements (``starter``, ``routesalchemy``, ``alchemy``, ``zodb``) instead of ZCML configuration. -- The ``pyramid_zodb``, ``pyramid_routesalchemy`` and ``pyramid_alchemy`` +- The ``pyramid_zodb``, ``routesalchemy`` and ``pyramid_alchemy`` scaffolds now use a default "commit veto" hook when configuring the ``repoze.tm2`` transaction manager in ``development.ini``. This prevents a transaction from being committed when the response status code is within diff --git a/pyramid/httpexceptions.py b/pyramid/httpexceptions.py index 4dbca7021..bd745df87 100644 --- a/pyramid/httpexceptions.py +++ b/pyramid/httpexceptions.py @@ -434,6 +434,8 @@ ${html_comment}''') def __init__(self, location='', detail=None, headers=None, comment=None, body_template=None, **kw): + if location is None: + raise ValueError("HTTP redirects need a location to redirect to.") super(_HTTPMove, self).__init__( detail=detail, headers=headers, comment=comment, body_template=body_template, location=location, **kw) diff --git a/pyramid/scripts/pcreate.py b/pyramid/scripts/pcreate.py index 47a709af4..f559e4f17 100644 --- a/pyramid/scripts/pcreate.py +++ b/pyramid/scripts/pcreate.py @@ -4,6 +4,7 @@ import optparse import os +import os.path import pkg_resources import re import sys @@ -64,8 +65,8 @@ class PCreateCommand(object): def render_scaffolds(self): options = self.options args = self.args - project_name = args[0].lstrip(os.path.sep) - output_dir = os.path.normpath(os.path.join(os.getcwd(), project_name)) + project_name = os.path.basename(args[0]) + output_dir = os.path.abspath(os.path.normpath(args[0])) pkg_name = _bad_chars_re.sub('', project_name.lower()) safe_name = pkg_resources.safe_name(project_name) egg_name = pkg_resources.to_filename(safe_name) diff --git a/pyramid/scripts/pserve.py b/pyramid/scripts/pserve.py index a2eded80a..c6e8f0374 100644 --- a/pyramid/scripts/pserve.py +++ b/pyramid/scripts/pserve.py @@ -173,8 +173,8 @@ class PServeCommand(object): if self.verbose > 1: self.out('Running reloading file monitor') install_reloader(int(self.options.reload_interval)) - if self.requires_config_file: - watch_file(self.args[0]) + # if self.requires_config_file: + # watch_file(self.args[0]) else: return self.restart_with_reloader() diff --git a/pyramid/tests/test_httpexceptions.py b/pyramid/tests/test_httpexceptions.py index 927d27733..84485fadc 100644 --- a/pyramid/tests/test_httpexceptions.py +++ b/pyramid/tests/test_httpexceptions.py @@ -294,6 +294,12 @@ class Test_HTTPMove(unittest.TestCase): from pyramid.httpexceptions import _HTTPMove return _HTTPMove(*arg, **kw) + def test_it_location_none_valueerrors(self): + # Constructing a HTTPMove instance with location=None should + # throw a ValueError from __init__ so that a more-confusing + # exception won't be thrown later from .prepare(environ) + self.assertRaises(ValueError, self._makeOne, location=None) + def test_it_location_not_passed(self): exc = self._makeOne() self.assertEqual(exc.location, '') diff --git a/pyramid/tests/test_scripts/test_pcreate.py b/pyramid/tests/test_scripts/test_pcreate.py index cdd0daf2e..363808a1e 100644 --- a/pyramid/tests/test_scripts/test_pcreate.py +++ b/pyramid/tests/test_scripts/test_pcreate.py @@ -71,6 +71,22 @@ class TestPCreateCommand(unittest.TestCase): scaffold.vars, {'project': 'Distro', 'egg': 'Distro', 'package': 'distro'}) + def test_known_scaffold_absolute_path(self): + import os + path = os.path.abspath('Distro') + cmd = self._makeOne('-s', 'dummy', path) + scaffold = DummyScaffold('dummy') + cmd.scaffolds = [scaffold] + result = cmd.run() + self.assertEqual(result, True) + self.assertEqual( + scaffold.output_dir, + os.path.normpath(os.path.join(os.getcwd(), 'Distro')) + ) + self.assertEqual( + scaffold.vars, + {'project': 'Distro', 'egg': 'Distro', 'package': 'distro'}) + def test_known_scaffold_multiple_rendered(self): import os cmd = self._makeOne('-s', 'dummy1', '-s', 'dummy2', 'Distro') diff --git a/rtd_requirements.txt b/rtd.txt index 9de7ff3bb..9de7ff3bb 100644 --- a/rtd_requirements.txt +++ b/rtd.txt |
