Merge lp:~jml/libdep-service/remove-django-fixture into lp:libdep-service

Proposed by Jonathan Lange
Status: Merged
Approved by: James Westby
Approved revision: 70
Merged at revision: 70
Proposed branch: lp:~jml/libdep-service/remove-django-fixture
Merge into: lp:libdep-service
Diff against target: 171 lines (+7/-93)
6 files modified
.bzrignore (+1/-0)
buildout.cfg (+1/-0)
distribute_setup.py (+1/-3)
djlibdep/tests/_djangofixture.py (+0/-86)
djlibdep/tests/test_interface.py (+1/-1)
versions.cfg (+3/-3)
To merge this branch: bzr merge lp:~jml/libdep-service/remove-django-fixture
Reviewer Review Type Date Requested Status
James Westby (community) Approve
Review via email: mp+131417@code.launchpad.net

Commit message

Use djangofixture as a dependency

Description of the change

Nothing much to say, really.

To post a comment you must log in.
Revision history for this message
James Westby (james-w) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.bzrignore'
2--- .bzrignore 2012-10-11 14:38:01 +0000
3+++ .bzrignore 2012-10-25 14:02:39 +0000
4@@ -13,3 +13,4 @@
5 ./parts
6 ./bin/*
7 dist
8+download-cache
9
10=== modified file 'buildout.cfg'
11--- buildout.cfg 2012-10-04 15:09:21 +0000
12+++ buildout.cfg 2012-10-25 14:02:39 +0000
13@@ -30,6 +30,7 @@
14 recipe = z3c.recipe.scripts
15 # Test dependencies get added here
16 eggs = libdep-service[testing]
17+ djangofixture
18 pep8
19 pkgme-devportal[testing]
20 pyflakes
21
22=== modified file 'distribute_setup.py'
23--- distribute_setup.py 2012-08-24 19:34:45 +0000
24+++ distribute_setup.py 2012-10-25 14:02:39 +0000
25@@ -46,9 +46,7 @@
26 args = [quote(arg) for arg in args]
27 return os.spawnl(os.P_WAIT, sys.executable, *args) == 0
28
29-# jml's fork of distribute. Code lives at
30-# https://bitbucket.org/mumak/distribute.
31-DEFAULT_VERSION = "0.6.29DEV"
32+DEFAULT_VERSION = "0.6.30"
33 DEFAULT_URL = "http://pypi.python.org/packages/source/d/distribute/"
34 SETUPTOOLS_FAKED_VERSION = "0.6c11"
35
36
37=== removed file 'djlibdep/tests/_djangofixture.py'
38--- djlibdep/tests/_djangofixture.py 2012-09-28 11:56:44 +0000
39+++ djlibdep/tests/_djangofixture.py 1970-01-01 00:00:00 +0000
40@@ -1,86 +0,0 @@
41-import errno
42-import subprocess
43-import sys
44-import time
45-from urllib2 import (
46- URLError,
47- urlopen,
48- )
49-
50-from fixtures import Fixture
51-from testtools.content import (
52- Content,
53- UTF8_TEXT,
54- )
55-from twisted.internet.error import TimeoutError
56-
57-
58-def poll(poll_interval, max_tries, predicate, *args, **kwargs):
59- for i in range(max_tries):
60- if predicate(*args, **kwargs):
61- return
62- time.sleep(poll_interval)
63- raise TimeoutError("Timed out waiting for %r" % (predicate,))
64-
65-
66-def _is_server_up(url):
67- try:
68- response = urlopen(url)
69- except URLError, e:
70- error_no = getattr(e.reason, 'errno', None)
71- if error_no in (errno.ECONNREFUSED, errno.ECONNRESET):
72- return False
73- raise
74- except IOError, e:
75- if e.errno in (errno.ECONNREFUSED, errno.ECONNRESET):
76- return False
77- raise
78- return response.code == 200
79-
80-
81-def poll_until_running(url, poll_interval=0.05, max_tries=100):
82- try:
83- poll(poll_interval, max_tries, _is_server_up, url)
84- except TimeoutError:
85- raise TimeoutError("Timed out waiting for %s to come up" % (url,))
86-
87-
88-def get_manage_location():
89- return 'django_project/manage.py'
90-
91-
92-# XXX: Copied from lp:pkgme-service. Extract to separate library.
93-class DjangoFixture(Fixture):
94- """A simple Django service, with database.
95-
96- Essentially does 'runserver'.
97- """
98-
99- def __init__(self, all_clear_path, port=8001):
100- super(DjangoFixture, self).__init__()
101- self._all_clear_path = all_clear_path
102- # XXX: parallelism: Hard-code the port to run on for now. Don't know
103- # how to figure out what port it's actually listening on.
104- self._port = port
105-
106- def setUp(self):
107- super(DjangoFixture, self).setUp()
108- process = subprocess.Popen(
109- [sys.executable, get_manage_location(),
110- 'runserver', '--noreload', str(self._port)],
111- stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
112- self.addCleanup(process.terminate)
113- self.addCleanup(
114- self.addDetail,
115- 'runserver-log',
116- Content(
117- UTF8_TEXT,
118- process.stdout.readlines))
119- self.base_url = 'http://localhost:%s' % (self._port,)
120- all_clear_url = '%s/%s' % (self.base_url, self._all_clear_path)
121- try:
122- poll_until_running(all_clear_url)
123- except:
124- # fixtures don't get cleaned up automatically if setUp fails.
125- self.cleanUp()
126- raise
127
128=== modified file 'djlibdep/tests/test_interface.py'
129--- djlibdep/tests/test_interface.py 2012-10-16 14:09:51 +0000
130+++ djlibdep/tests/test_interface.py 2012-10-25 14:02:39 +0000
131@@ -11,6 +11,7 @@
132 DatabaseConfig,
133 PostgresDatabaseFixture,
134 )
135+from djangofixture import DjangoFixture
136 from fixtures import Fixture
137 from testresources import (
138 FixtureResource,
139@@ -23,7 +24,6 @@
140 from .test_test_double import (
141 test_double_fixture,
142 )
143-from ._djangofixture import DjangoFixture
144
145
146 class RealServerFixture(Fixture):
147
148=== modified file 'versions.cfg'
149--- versions.cfg 2012-10-23 21:25:16 +0000
150+++ versions.cfg 2012-10-25 14:02:39 +0000
151@@ -16,9 +16,9 @@
152 celery = 2.5.0
153 Cheetah = 2.4.4
154 configglue = 1.0.1
155-# jml's fork. Code lives at https://bitbucket.org/mumak/distribute.
156-distribute = 0.6.29DEV
157+distribute = 0.6.30
158 django = 1.3.1
159+djangofixture = 0.1
160 django-configglue = 0.6.1
161 django-openid-auth = 0.4
162 django-picklefield = 0.2.1
163@@ -58,7 +58,7 @@
164 storm = 0.19
165 testresources = 0.2.5
166 testscenarios = 0.3
167-testtools = 0.9.16
168+testtools = 0.9.20
169 treeshape = 0.2.1
170 Twisted = 12.1.0
171 # A pre-release of txstatsd as there hasn't been a real release yet.

Subscribers

People subscribed via source and target branches