summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--HACKING.txt29
-rw-r--r--hacking-tox.ini25
-rw-r--r--pyramid/tests/test_config/test_init.py11
-rw-r--r--pyramid/tests/test_integration.py10
-rw-r--r--pyramid/tests/test_scripts/test_pdistreport.py1
-rw-r--r--pyramid/tests/test_url.py2
6 files changed, 59 insertions, 19 deletions
diff --git a/HACKING.txt b/HACKING.txt
index 5b5dcc458..5d33aa0ab 100644
--- a/HACKING.txt
+++ b/HACKING.txt
@@ -16,13 +16,31 @@ checkout.
- Check out a read-only copy of the Pyramid source::
- $ git clone git://github.com/Pylons/pyramid.git
+ $ git clone git://github.com/Pylons/pyramid.git .
(alternately, create a writeable fork on GitHub and check that out).
+Since pyramid is a framework and not an application, it can be
+convenient to work against a sample application, preferably in its
+own virtualenv. A quick way to achieve this is to (ab-)use ``tox``
+with a custom configuration file that's part of the checkout::
+
+ tox -c hacking-tox.ini
+
+This will create a python-2.7 based virtualenv named ``env27`` (pyramid's
+``.gitconfig` ignores all top-level folders that start with ``env`` specifically
+for this use case) and inside that a simple pyramid application named
+``hacking`` that you can then fire up like so::
+
+ cd env27/hacking
+ ../bin/pserve development.ini
+
+Alternatively, if you don't want to install ``tox`` at this point,
+you an achieve the same manually by following these steps:
+
- Create a virtualenv in which to install Pyramid::
- $ virtualenv2.6 --no-site-packages env
+ $ virtualenv env
- Install ``setuptools-git`` into the virtualenv (for good measure, as we're
using git to do version control)::
@@ -110,6 +128,13 @@ Running Tests
$ cd ~/hack-on-pyramid/pyramid
$ /usr/bin/tox
+- The tests can also be run usign ``pytest`` (http://pytest.org/). This is
+ intended as a convenience for people who are more used or fond of ``pytest``.
+ Run the tests like so::
+
+ $ $VENV/bin/easy_install pytest
+ $ py.test --strict pyramid/
+
Test Coverage
-------------
diff --git a/hacking-tox.ini b/hacking-tox.ini
new file mode 100644
index 000000000..9520b7aef
--- /dev/null
+++ b/hacking-tox.ini
@@ -0,0 +1,25 @@
+[tox]
+envlist =
+ env27,ttw27-create,ttw27-install
+
+[testenv:env27]
+envdir = env27
+basepython = python2.7
+usedevelop = True
+deps = setuptools-git
+commands =
+ python setup.py dev
+
+[testenv:ttw27-create]
+envdir = env27
+usedevelop = True
+changedir = env27
+commands =
+ pcreate -s starter hacking
+
+[testenv:ttw27-install]
+envdir = env27
+usedevelop = True
+changedir = env27/hacking
+commands =
+ python setup.py develop
diff --git a/pyramid/tests/test_config/test_init.py b/pyramid/tests/test_config/test_init.py
index 7c2880a18..b8cbbd676 100644
--- a/pyramid/tests/test_config/test_init.py
+++ b/pyramid/tests/test_config/test_init.py
@@ -1955,12 +1955,6 @@ class DummyRequest:
self.params = {}
self.cookies = {}
-class DummyResponse:
- status = '200 OK'
- headerlist = ()
- app_iter = ()
- body = ''
-
class DummyThreadLocalManager(object):
pushed = None
popped = False
@@ -1992,11 +1986,6 @@ class DummyRegistry(object):
def queryUtility(self, *arg, **kw):
return self.util
-from pyramid.interfaces import IResponse
-@implementer(IResponse)
-class DummyResponse(object):
- pass
-
from zope.interface import Interface
class IOther(Interface):
pass
diff --git a/pyramid/tests/test_integration.py b/pyramid/tests/test_integration.py
index 66205e618..eda4ae9f3 100644
--- a/pyramid/tests/test_integration.py
+++ b/pyramid/tests/test_integration.py
@@ -72,7 +72,7 @@ class IntegrationBase(object):
here = os.path.dirname(__file__)
-class TestStaticAppBase(IntegrationBase):
+class StaticAppBase(IntegrationBase):
def test_basic(self):
res = self.testapp.get('/minimal.pt', status=200)
_assertBody(res.body, os.path.join(here, 'fixtures/minimal.pt'))
@@ -198,10 +198,10 @@ class TestEventOnlySubscribers(IntegrationBase, unittest.TestCase):
self.assertEqual(sorted(res.body.split()),
[b'foobar', b'foobar2', b'foobaryup', b'foobaryup2'])
-class TestStaticAppUsingAbsPath(TestStaticAppBase, unittest.TestCase):
+class TestStaticAppUsingAbsPath(StaticAppBase, unittest.TestCase):
package = 'pyramid.tests.pkgs.static_abspath'
-class TestStaticAppUsingAssetSpec(TestStaticAppBase, unittest.TestCase):
+class TestStaticAppUsingAssetSpec(StaticAppBase, unittest.TestCase):
package = 'pyramid.tests.pkgs.static_assetspec'
class TestStaticAppNoSubpath(unittest.TestCase):
@@ -649,6 +649,10 @@ class AcceptContentTypeTest(unittest.TestCase):
from webtest import TestApp
self.testapp = TestApp(app)
+ def tearDown(self):
+ import pyramid.config
+ pyramid.config.global_registries.empty()
+
def test_ordering(self):
res = self.testapp.get('/hello', headers={'Accept': 'application/json; q=1.0, text/plain; q=0.9'}, status=200)
self.assertEqual(res.content_type, 'application/json')
diff --git a/pyramid/tests/test_scripts/test_pdistreport.py b/pyramid/tests/test_scripts/test_pdistreport.py
index a8316c0e5..e229667c5 100644
--- a/pyramid/tests/test_scripts/test_pdistreport.py
+++ b/pyramid/tests/test_scripts/test_pdistreport.py
@@ -1,5 +1,4 @@
import unittest
-from pyramid.tests.test_scripts import dummy
class TestPDistReportCommand(unittest.TestCase):
def _callFUT(self, **kw):
diff --git a/pyramid/tests/test_url.py b/pyramid/tests/test_url.py
index 9841c143e..bf1c514c5 100644
--- a/pyramid/tests/test_url.py
+++ b/pyramid/tests/test_url.py
@@ -611,7 +611,6 @@ class TestURLMethodsMixin(unittest.TestCase):
('pyramid.tests:static/foo.css', request, {}) )
def test_static_url_abspath_integration_with_staticurlinfo(self):
- import os
from pyramid.interfaces import IStaticURLInfo
from pyramid.config.views import StaticURLInfo
info = StaticURLInfo()
@@ -626,7 +625,6 @@ class TestURLMethodsMixin(unittest.TestCase):
'http://example.com:5432/absstatic/test_url.py')
def test_static_url_noscheme_uses_scheme_from_request(self):
- import os
from pyramid.interfaces import IStaticURLInfo
from pyramid.config.views import StaticURLInfo
info = StaticURLInfo()