Merge lp:~frankban/juju-quickstart/add-tox into lp:juju-quickstart
- add-tox
- Merge into trunk
Status: | Merged |
---|---|
Merged at revision: | 116 |
Proposed branch: | lp:~frankban/juju-quickstart/add-tox |
Merge into: | lp:juju-quickstart |
Diff against target: |
765 lines (+414/-171) 9 files modified
.bzrignore (+3/-1) HACKING.rst (+85/-45) MANIFEST.in (+5/-4) Makefile (+76/-45) requirements.pip (+0/-31) setup.cfg (+20/-0) setup.py (+110/-22) test-requirements.pip (+0/-23) tox.ini (+115/-0) |
To merge this branch: | bzr merge lp:~frankban/juju-quickstart/add-tox |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Juju GUI Hackers | Pending | ||
Review via email:
|
Commit message
Description of the change
Introduce tox for testing multiple sets of deps.
Quickstart must be run on several platforms/Ubuntu series,
each one with its own versions of the packages that
Quickstart depends on. The tox utility is used for both:
- handling those kind of separate scenarios;
- creating the development virtual environments.
The latter was previously done using virtualenv directly
in the Makefile. The new infrastructure should be
more flexible.
Update the relevant parts of the Makefile, also handling
the automatic installation of system dependencies.
Implement the ability to calculate the requirements
for the PyPI package automatically by parsing the
tox.ini file. I am not really sure about the method I
used (take a look at the setup.py file), but the
alternative is to manually update those and violate DRY.
I think we could give it a try and fall back to the
manual approach if required.
Also implement a correct behavior for
"python setup.py test", which now runs all the tests.
To test and QA this branch, run `make clean` and then
follow what described in the HACKING.rst file, in the
following paragraphs:
- Creating a development environment
- Testing and debugging the application
- Requirements
- Updating application and test dependencies
Thank you!
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Francesco Banconi (frankban) wrote : | # |
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Brad Crittenden (bac) wrote : | # |
LGTM. Did not try to QA yet. Tox may be very interesting for lots of our
projects.
https:/
File HACKING.rst (right):
https:/
HACKING.rst:356: parsing ``tox.ini``, dependencies must be listed with
the following rules:
Could you try to re-word that sentence? I'm not sure what you're saying.
https:/
HACKING.rst:358: - each scenario must at least include a
"{[testenv]deps}" line in its deps:
Change the : to ; or ,
https:/
File MANIFEST.in (right):
https:/
MANIFEST.in:24: # tox.ini file, removing it from this list will break
the source distribution
Again, this could be worded better.
https:/
File setup.py (right):
https:/
setup.py:43: """Return Juju Quickstart package data by walking through
the project."""
A better explanation of what "package data" is would be nice.
https:/
setup.py:74: for requirement in deps:
Maybe add
requirement = requirement.strip()
https:/
File tox.ini (right):
https:/
tox.ini:42: basepython = python2.7
Is it required to repeat here?
- 130. By Francesco Banconi
-
Changes as per review.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Francesco Banconi (frankban) wrote : | # |
Please take a look.
https:/
File HACKING.rst (right):
https:/
HACKING.rst:356: parsing ``tox.ini``, dependencies must be listed with
the following rules:
On 2015/01/22 16:15:27, bac wrote:
> Could you try to re-word that sentence? I'm not sure what you're
saying.
Done.
https:/
HACKING.rst:358: - each scenario must at least include a
"{[testenv]deps}" line in its deps:
On 2015/01/22 16:15:27, bac wrote:
> Change the : to ; or ,
Done.
https:/
File MANIFEST.in (right):
https:/
MANIFEST.in:24: # tox.ini file, removing it from this list will break
the source distribution
On 2015/01/22 16:15:27, bac wrote:
> Again, this could be worded better.
Done.
https:/
File setup.py (right):
https:/
setup.py:43: """Return Juju Quickstart package data by walking through
the project."""
On 2015/01/22 16:15:27, bac wrote:
> A better explanation of what "package data" is would be nice.
Done.
https:/
setup.py:74: for requirement in deps:
On 2015/01/22 16:15:27, bac wrote:
> Maybe add
> requirement = requirement.strip()
Done.
https:/
File tox.ini (right):
https:/
tox.ini:42: basepython = python2.7
On 2015/01/22 16:15:27, bac wrote:
> Is it required to repeat here?
No it's not. Good catch!
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Brad Crittenden (bac) wrote : | # |
Code is LGTM with the one suggestion for the Makefile.
QA OK on trusty
On OS X, the 'make sysdeps' suggests you use brew to install python-dev
python-setuptools and python-pip. Those package names are not the same
in brew and pip is installed via 'brew install python'. I'm not sure if
the equivalent of python-dev gets installed but 'make check' ran fine.
Perhaps you can adjust the message to be less misleading.
https:/
File Makefile (right):
https:/
Makefile:44:
It is a bit odd to touch the canary on an non-Debian system when the
sysdeps were not installed.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Jeff Pihach (hatch) wrote : | # |
LGTM Thanks for all that this should help simplify testing quite a bit
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Francesco Banconi (frankban) wrote : | # |
Thanks for the reviews!
https:/
File Makefile (right):
https:/
Makefile:44:
On 2015/01/30 15:38:52, bac wrote:
> It is a bit odd to touch the canary on an non-Debian system when the
sysdeps
> were not installed.
I modified the message to be more clear. We need to touch the file so
that OSX users having all the required sysdeps installed can still
proceed without seeing the message each time.
- 131. By Francesco Banconi
-
Improve sysdeps message in Makefile.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Francesco Banconi (frankban) wrote : | # |
*** Submitted:
Introduce tox for testing multiple sets of deps.
Quickstart must be run on several platforms/Ubuntu series,
each one with its own versions of the packages that
Quickstart depends on. The tox utility is used for both:
- handling those kind of separate scenarios;
- creating the development virtual environments.
The latter was previously done using virtualenv directly
in the Makefile. The new infrastructure should be
more flexible.
Update the relevant parts of the Makefile, also handling
the automatic installation of system dependencies.
Implement the ability to calculate the requirements
for the PyPI package automatically by parsing the
tox.ini file. I am not really sure about the method I
used (take a look at the setup.py file), but the
alternative is to manually update those and violate DRY.
I think we could give it a try and fall back to the
manual approach if required.
Also implement a correct behavior for
"python setup.py test", which now runs all the tests.
To test and QA this branch, run `make clean` and then
follow what described in the HACKING.rst file, in the
following paragraphs:
- Creating a development environment
- Testing and debugging the application
- Requirements
- Updating application and test dependencies
Thank you!
R=bac, benjamin.saller, jeff.pihach
CC=
https:/
Preview Diff
1 | === modified file '.bzrignore' | |||
2 | --- .bzrignore 2013-11-06 10:16:42 +0000 | |||
3 | +++ .bzrignore 2015-01-30 16:35:06 +0000 | |||
4 | @@ -1,8 +1,10 @@ | |||
5 | 1 | .coverage | 1 | .coverage |
6 | 2 | .DS_Store | 2 | .DS_Store |
7 | 3 | .emacs* | 3 | .emacs* |
9 | 4 | .venv | 4 | .sysdeps-installed |
10 | 5 | .tox | ||
11 | 5 | build | 6 | build |
12 | 7 | devenv | ||
13 | 6 | dist | 8 | dist |
14 | 7 | juju_quickstart.egg-info | 9 | juju_quickstart.egg-info |
15 | 8 | MANIFEST | 10 | MANIFEST |
16 | 9 | 11 | ||
17 | === modified file 'HACKING.rst' | |||
18 | --- HACKING.rst 2015-01-13 12:03:15 +0000 | |||
19 | +++ HACKING.rst 2015-01-30 16:35:06 +0000 | |||
20 | @@ -11,35 +11,68 @@ | |||
21 | 11 | Creating a development environment | 11 | Creating a development environment |
22 | 12 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | 12 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
23 | 13 | 13 | ||
37 | 14 | The development environment is created in a virtualenv. The environment | 14 | The development environment is created using the |
38 | 15 | creation requires the *make*, *pip* and *virtualenv* programs to be installed. | 15 | `tox <https://tox.readthedocs.org/en/latest/>`_ utility. To create the |
39 | 16 | To do that, run the following:: | 16 | environment, just run ``make``. The first time it is run, ``make`` also |
40 | 17 | 17 | installs the required system dependencies. For this reason sudo privileges can | |
41 | 18 | $ make sysdeps | 18 | be asked in the process. When the command completes the development environment |
42 | 19 | 19 | is ready and placed in the ``devenv`` directory inside the project's root. | |
43 | 20 | At this point, from the root of this branch, run the command:: | 20 | |
44 | 21 | 21 | At this point it is possible to start contributing to the project. The steps | |
45 | 22 | $ make | 22 | for testing the application and running Juju Quickstart in development mode are |
46 | 23 | 23 | described below. Thanks for contributing! | |
34 | 24 | This command will create a ``.venv`` directory in the branch root, ignored | ||
35 | 25 | by DVCSes, containing the development virtual environment with all the | ||
36 | 26 | dependencies. | ||
47 | 27 | 24 | ||
48 | 28 | Testing and debugging the application | 25 | Testing and debugging the application |
49 | 29 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | 26 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
50 | 30 | 27 | ||
52 | 31 | Run the tests:: | 28 | With the development environment correctly set up (after running ``make``), it |
53 | 29 | is easy to run the tests with the following command:: | ||
54 | 32 | 30 | ||
55 | 33 | $ make test | 31 | $ make test |
56 | 34 | 32 | ||
58 | 35 | Run the tests and lint/pep8 checks:: | 33 | It is also possible to run a subset of the test suite by using nose directly, |
59 | 34 | as it is already installed in the development environment, e.g.:: | ||
60 | 35 | |||
61 | 36 | $ devenv/bin/nosetests quickstart/tests/test_app.py:TestWatch | ||
62 | 37 | |||
63 | 38 | To run the development version of Juju Quickstart while making changes, or | ||
64 | 39 | while reviewing a branch, use the following command:: | ||
65 | 40 | |||
66 | 41 | $ devenv/bin/juju-quickstart | ||
67 | 42 | |||
68 | 43 | The command above receives all usual Juju Quickstart arguments, so, for | ||
69 | 44 | instance, to start the interactive session:: | ||
70 | 45 | |||
71 | 46 | $ devenv/bin/juju-quickstart -i | ||
72 | 47 | |||
73 | 48 | To run the Python linter and pep8 checks, use the following command:: | ||
74 | 49 | |||
75 | 50 | $ make lint | ||
76 | 51 | |||
77 | 52 | When a feature branch is ready, before proposing it, check that the code tests | ||
78 | 53 | pass when Juju Quickstart is installed using the dependencies present in all | ||
79 | 54 | supported platforms and Ubuntu series. To do that, run the following:: | ||
80 | 36 | 55 | ||
81 | 37 | $ make check | 56 | $ make check |
82 | 38 | 57 | ||
87 | 39 | Display help about all the available make targets, including instructions on | 58 | The above leverages tox ability to create multiple virtual environments, each |
88 | 40 | setting up and running the application in the development environment:: | 59 | one with a specific set of requirements. The ``make check`` command is also |
89 | 41 | 60 | run automatically when proposing a branch with ``lbox propose``. | |
90 | 42 | $ make help | 61 | |
91 | 62 | As a final note, having the development environment ready, it is also possible | ||
92 | 63 | to use the ``tox`` command directly on the project. For instance, to run the | ||
93 | 64 | tests only on the ``vivid`` scenario, use the following:: | ||
94 | 65 | |||
95 | 66 | $ tox -e vivid | ||
96 | 67 | |||
97 | 68 | Run ``make help`` for more information about all the available make targets. | ||
98 | 69 | |||
99 | 70 | Requirements | ||
100 | 71 | ~~~~~~~~~~~~ | ||
101 | 72 | |||
102 | 73 | The Python requirements for Juju Quickstart are dynamically generated by | ||
103 | 74 | parsing the ``tox.ini`` file. To check the requirements list, run | ||
104 | 75 | ``make requirements``. | ||
105 | 43 | 76 | ||
106 | 44 | Installing the application | 77 | Installing the application |
107 | 45 | ~~~~~~~~~~~~~~~~~~~~~~~~~~ | 78 | ~~~~~~~~~~~~~~~~~~~~~~~~~~ |
108 | @@ -67,12 +100,6 @@ | |||
109 | 67 | 100 | ||
110 | 68 | $ juju quickstart -e local | 101 | $ juju quickstart -e local |
111 | 69 | 102 | ||
112 | 70 | If you have not installed the application using ``sudo make install``, as | ||
113 | 71 | described above, you can run it locally using the virtualenv's Python | ||
114 | 72 | installation:: | ||
115 | 73 | |||
116 | 74 | $ .venv/bin/python juju-quickstart --help | ||
117 | 75 | |||
118 | 76 | Project structure | 103 | Project structure |
119 | 77 | ~~~~~~~~~~~~~~~~~ | 104 | ~~~~~~~~~~~~~~~~~ |
120 | 78 | 105 | ||
121 | @@ -203,7 +230,8 @@ | |||
122 | 203 | packaging branch root. To print the version of the current Quickstart, from the | 230 | packaging branch root. To print the version of the current Quickstart, from the |
123 | 204 | juju-quickstart branch root, run the following:: | 231 | juju-quickstart branch root, run the following:: |
124 | 205 | 232 | ||
126 | 206 | $ .venv/bin/python juju-quickstart --version | 233 | $ make |
127 | 234 | $ devenv/bin/juju-quickstart --version | ||
128 | 207 | 235 | ||
129 | 208 | If the ``debian/changelog`` file is outdated, install the ``devscripts`` | 236 | If the ``debian/changelog`` file is outdated, install the ``devscripts`` |
130 | 209 | package and use ``dch`` to update the changelog, e.g.:: | 237 | package and use ``dch`` to update the changelog, e.g.:: |
131 | @@ -247,8 +275,8 @@ | |||
132 | 247 | Creating a Homebrew release | 275 | Creating a Homebrew release |
133 | 248 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ | 276 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
134 | 249 | 277 | ||
137 | 250 | The brew formula fetches its source from PyPI, so it must be done after the PyPI | 278 | The brew formula fetches its source from PyPI, so it must be done after the |
138 | 251 | release. | 279 | PyPI release. |
139 | 252 | 280 | ||
140 | 253 | 1. Start with a fresh brew:: | 281 | 1. Start with a fresh brew:: |
141 | 254 | 282 | ||
142 | @@ -303,8 +331,8 @@ | |||
143 | 303 | #. Go to https://github.com/juju/homebrew to create a pull request. | 331 | #. Go to https://github.com/juju/homebrew to create a pull request. |
144 | 304 | #. Copy the debian/changelog from the lp:juju-quickstart/packaging as the pull | 332 | #. Copy the debian/changelog from the lp:juju-quickstart/packaging as the pull |
145 | 305 | request comment. Keep the name simple, e.g. 'juju-quickstart 1.4.0'. | 333 | request comment. Keep the name simple, e.g. 'juju-quickstart 1.4.0'. |
148 | 306 | #. Watch the pull request and ensure it passes Jenkins. If changes must be made, | 334 | #. Watch the pull request and ensure it passes Jenkins. If changes must be |
149 | 307 | rebase the branch and squash commits before pushing. | 335 | made, rebase the branch and squash commits before pushing. |
150 | 308 | #. If the branch makes it through CI without errors it will be accepted and | 336 | #. If the branch makes it through CI without errors it will be accepted and |
151 | 309 | merged without human intervention. A recent branch took about two hours | 337 | merged without human intervention. A recent branch took about two hours |
152 | 310 | from the time the pull request was made. | 338 | from the time the pull request was made. |
153 | @@ -323,17 +351,19 @@ | |||
154 | 323 | Updating application and test dependencies | 351 | Updating application and test dependencies |
155 | 324 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | 352 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
156 | 325 | 353 | ||
168 | 326 | Test dependencies are listed in the ``test-requirements.pip`` file in the | 354 | Test and application dependencies are listed in the ``tox.ini`` file in the |
169 | 327 | branch root, application ones in the ``requirements.pip`` file. The former | 355 | branch root. Note that, since the source requirements are dynamically generated |
170 | 328 | includes the latter, so any updates to the application requirements will also | 356 | parsing ``tox.ini``, when updating the list of dependencies in ``tox.ini``, |
171 | 329 | update the test dependencies and therefore the testing virtual environment. | 357 | these rules must be followed: |
172 | 330 | Note that, since the source requirements are dynamically generated parsing | 358 | |
173 | 331 | ``requirements.pip``, that file must only include ``PACKAGE==VERSION`` formatted | 359 | - each scenario must at least include a "{[testenv]deps}" line in its deps, |
174 | 332 | dependencies, and not other pip specific requirement specifications. | 360 | this way tests can be run correctly inside the virtualenv; |
175 | 333 | 361 | - keep each requirement in deps in its own line; | |
176 | 334 | Also ensure, before updating the application dependencies, that those packages | 362 | - always use specific revisions for environments (i.e. always use "=="). |
177 | 335 | are available in the main Ubuntu repositories for the series we support (from | 363 | |
178 | 336 | precise to vivid), or in the `Juju Quickstart Beta PPA | 364 | Also ensure, before updating the application dependencies, that the package |
179 | 365 | versions reflect the ones available for each supported platform and in the | ||
180 | 366 | `Juju Quickstart Beta PPA | ||
181 | 337 | <https://launchpad.net/~juju-gui/+archive/quickstart-beta/+packages>`_. | 367 | <https://launchpad.net/~juju-gui/+archive/quickstart-beta/+packages>`_. |
182 | 338 | 368 | ||
183 | 339 | Please also keep up to date the possible values for the environments.yaml | 369 | Please also keep up to date the possible values for the environments.yaml |
184 | @@ -341,6 +371,16 @@ | |||
185 | 341 | set of series supported by the Juju GUI charm | 371 | set of series supported by the Juju GUI charm |
186 | 342 | (see ``quickstart.settings.JUJU_GUI_SUPPORTED_SERIES``). | 372 | (see ``quickstart.settings.JUJU_GUI_SUPPORTED_SERIES``). |
187 | 343 | 373 | ||
188 | 374 | When introducing a new supported platform, do the following: | ||
189 | 375 | |||
190 | 376 | - add a new section in the ``tox.ini`` file with a sensible name and list the | ||
191 | 377 | dependencies that we expect to be found on that platform/series; | ||
192 | 378 | - add the platform name to the envlist option (in the tox section of the file); | ||
193 | 379 | - if required, update ``quickstart.settings.JUJU_GUI_SUPPORTED_SERIES``; | ||
194 | 380 | - run ``make requirements`` and ensure that the dynamically generated list of | ||
195 | 381 | requirements make sense; | ||
196 | 382 | - run ``make check`` and ensure all the tests pass. | ||
197 | 383 | |||
198 | 344 | Debugging bundle support | 384 | Debugging bundle support |
199 | 345 | ~~~~~~~~~~~~~~~~~~~~~~~~ | 385 | ~~~~~~~~~~~~~~~~~~~~~~~~ |
200 | 346 | 386 | ||
201 | @@ -356,10 +396,10 @@ | |||
202 | 356 | information about what is going on. The GUI builtin server exposes some bundle | 396 | information about what is going on. The GUI builtin server exposes some bundle |
203 | 357 | information in two places: | 397 | information in two places: |
204 | 358 | 398 | ||
209 | 359 | - ``https://<juju-gui-url>/gui-server-info`` displays in JSON format the current | 399 | - ``https://<juju-gui-url>/gui-server-info`` displays in JSON format the |
210 | 360 | status of all scheduled/started/completed bundle deployments; | 400 | current status of all scheduled/started/completed bundle deployments; |
211 | 361 | - ``/var/log/upstart/guiserver.log`` is the builtin server log file, which includes | 401 | - ``/var/log/upstart/guiserver.log`` is the builtin server log file, which |
212 | 362 | logs output from the juju-deployer library. | 402 | includes logs output from the juju-deployer library. |
213 | 363 | 403 | ||
214 | 364 | Moreover, setting ``builtin-server-logging=debug`` gives more debugging | 404 | Moreover, setting ``builtin-server-logging=debug`` gives more debugging |
215 | 365 | information, e.g. it prints to the log the contents of the WebSocket messages | 405 | information, e.g. it prints to the log the contents of the WebSocket messages |
216 | 366 | 406 | ||
217 | === modified file 'MANIFEST.in' | |||
218 | --- MANIFEST.in 2014-03-13 11:56:58 +0000 | |||
219 | +++ MANIFEST.in 2015-01-30 16:35:06 +0000 | |||
220 | @@ -19,8 +19,9 @@ | |||
221 | 19 | include MANIFEST.in | 19 | include MANIFEST.in |
222 | 20 | include Makefile | 20 | include Makefile |
223 | 21 | include README.rst | 21 | include README.rst |
224 | 22 | include setup.cfg | ||
225 | 22 | # Note: since the source requirements are dynamically generated parsing the | 23 | # Note: since the source requirements are dynamically generated parsing the |
230 | 23 | # requirements.pip file, removing it from this list will break the source | 24 | # tox.ini file, removing the "include tox.ini" entry below from this list would |
231 | 24 | # distribution and therefore the Debian package builds. Do not do that. | 25 | # break the source distribution and therefore the Debian package builds. |
232 | 25 | include requirements.pip | 26 | # Do not do that. |
233 | 26 | include test-requirements.pip | 27 | include tox.ini |
234 | 27 | 28 | ||
235 | === modified file 'Makefile' | |||
236 | --- Makefile 2014-09-05 14:54:31 +0000 | |||
237 | +++ Makefile 2015-01-30 16:35:06 +0000 | |||
238 | @@ -15,75 +15,106 @@ | |||
239 | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
240 | 16 | 16 | ||
241 | 17 | PYTHON = python | 17 | PYTHON = python |
258 | 18 | SYSDEPS = build-essential python-dev python-pip python-virtualenv | 18 | APT_SYSDEPS = python-dev python-pip python-setuptools |
259 | 19 | 19 | # Since the python-tox package in Ubuntu uses Python 3, use pip to install tox | |
260 | 20 | VENV = .venv | 20 | # instead. This also works on OSX where tox is not present in Homebrew. |
261 | 21 | VENV_ACTIVATE = $(VENV)/bin/activate | 21 | PIP_SYSDEPS = tox |
262 | 22 | 22 | ||
263 | 23 | 23 | SYSDEPS_INSTALLED = .sysdeps-installed | |
264 | 24 | $(VENV_ACTIVATE): test-requirements.pip requirements.pip | 24 | DEVENV = devenv |
265 | 25 | virtualenv --distribute -p $(PYTHON) $(VENV) | 25 | QUICKSTART = $(DEVENV)/bin/juju-quickstart |
266 | 26 | $(VENV)/bin/pip install -r test-requirements.pip || \ | 26 | |
267 | 27 | (touch test-requirements.pip; exit 1) | 27 | .DEFAULT_GOAL := setup |
268 | 28 | @touch $(VENV_ACTIVATE) | 28 | |
269 | 29 | 29 | ||
270 | 30 | all: setup | 30 | $(QUICKSTART): juju-quickstart setup.py tox.ini |
271 | 31 | 31 | @tox -e devenv | |
272 | 32 | check: test lint | 32 | |
273 | 33 | 33 | $(SYSDEPS_INSTALLED): Makefile | |
274 | 34 | ifeq ($(shell command -v apt-get > /dev/null; echo $$?),0) | ||
275 | 35 | sudo apt-get install --yes $(APT_SYSDEPS) | ||
276 | 36 | else | ||
277 | 37 | @echo 'System dependencies can only be installed automatically on' | ||
278 | 38 | @echo 'systems with "apt-get". On OSX you can manually use Homebrew' | ||
279 | 39 | @echo 'if there are missing dependencies corresponding to the following' | ||
280 | 40 | @echo 'Debian packages:' | ||
281 | 41 | @echo '$(APT_SYSDEPS).' | ||
282 | 42 | endif | ||
283 | 43 | sudo pip2 install $(PIP_SYSDEPS) | ||
284 | 44 | touch $(SYSDEPS_INSTALLED) | ||
285 | 45 | |||
286 | 46 | |||
287 | 47 | .PHONY: check | ||
288 | 48 | check: setup | ||
289 | 49 | @tox -e lint | ||
290 | 50 | @tox | ||
291 | 51 | |||
292 | 52 | .PHONY: clean | ||
293 | 34 | clean: | 53 | clean: |
294 | 35 | $(PYTHON) setup.py clean | 54 | $(PYTHON) setup.py clean |
297 | 36 | rm -rfv build/ dist/ juju_quickstart.egg-info MANIFEST | 55 | # Remove the development environments. |
298 | 37 | rm -rfv $(VENV) | 56 | rm -rfv $(DEVENV) .tox/ |
299 | 57 | # Remove distribution artifacts. | ||
300 | 58 | rm -rfv *.egg build/ dist/ juju_quickstart.egg-info/ MANIFEST | ||
301 | 59 | # Remove tests artifacts. | ||
302 | 60 | rm -fv .coverage | ||
303 | 61 | # Remove the sysdeps canary file. | ||
304 | 62 | rm -fv $(SYSDEPS_INSTALLED) | ||
305 | 63 | # Remove Python compiled bytecode. | ||
306 | 38 | find . -name '*.pyc' -delete | 64 | find . -name '*.pyc' -delete |
307 | 39 | find . -name '__pycache__' -type d -delete | 65 | find . -name '__pycache__' -type d -delete |
311 | 40 | 66 | # Remove the virtualenv used in previous configurations. | |
312 | 41 | setup: $(VENV_ACTIVATE) | 67 | rm -rfv .venv/ |
313 | 42 | 68 | ||
314 | 69 | .PHONY: help | ||
315 | 43 | help: | 70 | help: |
316 | 44 | @echo -e 'Juju Quickstart - list of make targets:\n' | 71 | @echo -e 'Juju Quickstart - list of make targets:\n' |
317 | 45 | @echo 'make sysdeps - Install the development environment system packages.' | ||
318 | 46 | @echo 'make - Set up the development and testing environment.' | 72 | @echo 'make - Set up the development and testing environment.' |
319 | 47 | @echo 'make test - Run tests.' | 73 | @echo 'make test - Run tests.' |
320 | 48 | @echo 'make lint - Run linter and pep8.' | 74 | @echo 'make lint - Run linter and pep8.' |
322 | 49 | @echo 'make check - Run tests, linter and pep8.' | 75 | @echo 'make check - Run all the tests and lint in all supported scenarios.' |
323 | 50 | @echo 'make source - Create source package.' | 76 | @echo 'make source - Create source package.' |
324 | 51 | @echo 'make install - Install on local system.' | 77 | @echo 'make install - Install on local system.' |
332 | 52 | @echo 'make run - Run the application in the development environment.\n' | 78 | @echo 'make clean - Get rid of bytecode files, build and dist dirs, venvs.' |
326 | 53 | @echo ' If "juju switch" has been used to set a default environment, that' | ||
327 | 54 | @echo ' environment will be used. It is possible to override the default' | ||
328 | 55 | @echo ' Juju environment by setting the JUJU_ENV environment variable,' | ||
329 | 56 | @echo ' e.g.: "make run JUJU_ENV=ec2".' | ||
330 | 57 | @echo 'make debug - Same as the "run" target but with the --debug flag.\n' | ||
331 | 58 | @echo 'make clean - Get rid of bytecode files, build and dist dirs, venv.' | ||
333 | 59 | @echo 'make release - Register and upload a release on PyPI.' | 79 | @echo 'make release - Register and upload a release on PyPI.' |
334 | 80 | @echo 'make requirements - Print out the application requirements.' | ||
335 | 81 | @echo -e '\nAfter creating the development environment with "make", it is' | ||
336 | 82 | @echo 'also possible to do the following:' | ||
337 | 83 | @echo '- run the development version of Juju Quickstart by invoking' | ||
338 | 84 | @echo ' "$(QUICKSTART)";' | ||
339 | 85 | @echo '- run a specific subset of the test suite, e.g. with' | ||
340 | 86 | @echo ' "$(DEVENV)/bin/nosetests quickstart/tests/test_app.py:TestWatch";' | ||
341 | 87 | @echo '- use tox as usual on this project;' | ||
342 | 88 | @echo ' see https://tox.readthedocs.org/en/latest/' | ||
343 | 60 | 89 | ||
344 | 90 | .PHONY: install | ||
345 | 61 | install: | 91 | install: |
346 | 62 | $(PYTHON) setup.py install | 92 | $(PYTHON) setup.py install |
347 | 63 | rm -rfv ./build ./dist ./juju_quickstart.egg-info | 93 | rm -rfv ./build ./dist ./juju_quickstart.egg-info |
348 | 64 | 94 | ||
349 | 95 | .PHONY: lint | ||
350 | 65 | lint: setup | 96 | lint: setup |
352 | 66 | @$(VENV)/bin/flake8 --show-source --exclude=$(VENV) ./quickstart | 97 | @$(DEVENV)/bin/flake8 --show-source quickstart |
353 | 67 | 98 | ||
354 | 99 | .PHONY: release | ||
355 | 68 | release: check | 100 | release: check |
356 | 69 | $(PYTHON) setup.py register sdist upload | 101 | $(PYTHON) setup.py register sdist upload |
357 | 70 | 102 | ||
364 | 71 | run: setup | 103 | .PHONY: requirements |
365 | 72 | $(VENV)/bin/python ./juju-quickstart | 104 | requirements: |
366 | 73 | 105 | $(PYTHON) setup.py requirements | |
367 | 74 | debug: setup | 106 | |
368 | 75 | $(VENV)/bin/python ./juju-quickstart --debug | 107 | .PHONY: setup |
369 | 76 | 108 | setup: $(SYSDEPS_INSTALLED) $(QUICKSTART) | |
370 | 109 | |||
371 | 110 | .PHONY: source | ||
372 | 77 | source: | 111 | source: |
373 | 78 | $(PYTHON) setup.py sdist | 112 | $(PYTHON) setup.py sdist |
374 | 79 | 113 | ||
377 | 80 | sysdeps: | 114 | .PHONY: sysdeps |
378 | 81 | sudo apt-get install --yes $(SYSDEPS) | 115 | sysdeps: $(SYSDEPS_INSTALLED) |
379 | 82 | 116 | ||
380 | 117 | .PHONY: test | ||
381 | 83 | test: setup | 118 | test: setup |
388 | 84 | @$(VENV)/bin/nosetests -s --verbosity=2 \ | 119 | @$(DEVENV)/bin/nosetests \ |
389 | 85 | --with-coverage --cover-package=quickstart quickstart | 120 | --with-coverage --cover-erase --cover-package quickstart |
384 | 86 | @rm .coverage | ||
385 | 87 | |||
386 | 88 | .PHONY: all clean check debug help install lint release run setup source \ | ||
387 | 89 | sysdeps test | ||
390 | 90 | 121 | ||
391 | === removed file 'requirements.pip' | |||
392 | --- requirements.pip 2014-09-05 14:54:31 +0000 | |||
393 | +++ requirements.pip 1970-01-01 00:00:00 +0000 | |||
394 | @@ -1,31 +0,0 @@ | |||
395 | 1 | # Juju Quickstart application requirements. | ||
396 | 2 | |||
397 | 3 | # This file is part of the Juju Quickstart Plugin, which lets users set up a | ||
398 | 4 | # Juju environment in very few steps (https://launchpad.net/juju-quickstart). | ||
399 | 5 | # Copyright (C) 2013 Canonical Ltd. | ||
400 | 6 | # | ||
401 | 7 | # This program is free software: you can redistribute it and/or modify it under | ||
402 | 8 | # the terms of the GNU Affero General Public License version 3, as published by | ||
403 | 9 | # the Free Software Foundation. | ||
404 | 10 | # | ||
405 | 11 | # This program is distributed in the hope that it will be useful, but WITHOUT | ||
406 | 12 | # ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, | ||
407 | 13 | # SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
408 | 14 | # Affero General Public License for more details. | ||
409 | 15 | # | ||
410 | 16 | # You should have received a copy of the GNU Affero General Public License | ||
411 | 17 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
412 | 18 | |||
413 | 19 | # Note: since the source requirements are dynamically generated parsing the | ||
414 | 20 | # requirements.pip file, the list below must only include PACKAGE==VERSION | ||
415 | 21 | # formatted dependencies. Do not include other pip specific requirement | ||
416 | 22 | # specifications (e.g. -e ... or -r ...). | ||
417 | 23 | |||
418 | 24 | # XXX: BradCrittenden 2014-05-23: jujuclient 0.17.5 does not specify the | ||
419 | 25 | # version of websocket-client to use. Remove websocket-client as a dependency | ||
420 | 26 | # here when moving to a newer jujuclient that correctly specifies the | ||
421 | 27 | # version. | ||
422 | 28 | websocket-client==0.18.0 | ||
423 | 29 | jujuclient==0.18.4 | ||
424 | 30 | PyYAML==3.11 | ||
425 | 31 | urwid==1.2.1 | ||
426 | 32 | 0 | ||
427 | === added file 'setup.cfg' | |||
428 | --- setup.cfg 1970-01-01 00:00:00 +0000 | |||
429 | +++ setup.cfg 2015-01-30 16:35:06 +0000 | |||
430 | @@ -0,0 +1,20 @@ | |||
431 | 1 | # This file is part of the Juju Quickstart Plugin, which lets users set up a | ||
432 | 2 | # Juju environment in very few steps (https://launchpad.net/juju-quickstart). | ||
433 | 3 | # Copyright (C) 2015 Canonical Ltd. | ||
434 | 4 | # | ||
435 | 5 | # This program is free software: you can redistribute it and/or modify it under | ||
436 | 6 | # the terms of the GNU Affero General Public License version 3, as published by | ||
437 | 7 | # the Free Software Foundation. | ||
438 | 8 | # | ||
439 | 9 | # This program is distributed in the hope that it will be useful, but WITHOUT | ||
440 | 10 | # ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, | ||
441 | 11 | # SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
442 | 12 | # Affero General Public License for more details. | ||
443 | 13 | # | ||
444 | 14 | # You should have received a copy of the GNU Affero General Public License | ||
445 | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
446 | 16 | |||
447 | 17 | [nosetests] | ||
448 | 18 | detailed-errors=1 | ||
449 | 19 | nocapture=1 | ||
450 | 20 | verbosity=2 | ||
451 | 0 | 21 | ||
452 | === modified file 'setup.py' | |||
453 | --- setup.py 2014-01-29 15:25:06 +0000 | |||
454 | +++ setup.py 2015-01-30 16:35:06 +0000 | |||
455 | @@ -16,52 +16,140 @@ | |||
456 | 16 | 16 | ||
457 | 17 | """Juju Quickstart distribution file.""" | 17 | """Juju Quickstart distribution file.""" |
458 | 18 | 18 | ||
459 | 19 | from __future__ import print_function | ||
460 | 20 | |||
461 | 21 | import ConfigParser | ||
462 | 22 | from distutils.core import Command | ||
463 | 23 | from distutils.version import StrictVersion | ||
464 | 19 | import os | 24 | import os |
465 | 25 | import shlex | ||
466 | 26 | import sys | ||
467 | 20 | 27 | ||
468 | 21 | from setuptools import ( | 28 | from setuptools import ( |
469 | 22 | find_packages, | 29 | find_packages, |
470 | 23 | setup, | 30 | setup, |
471 | 24 | ) | 31 | ) |
472 | 32 | from setuptools.command.test import test as TestCommand | ||
473 | 25 | 33 | ||
474 | 26 | 34 | ||
475 | 27 | ROOT = os.path.abspath(os.path.dirname(__file__)) | 35 | ROOT = os.path.abspath(os.path.dirname(__file__)) |
476 | 28 | PROJECT_NAME = 'quickstart' | 36 | PROJECT_NAME = 'quickstart' |
477 | 29 | 37 | ||
478 | 38 | os.chdir(ROOT) | ||
479 | 30 | project = __import__(PROJECT_NAME) | 39 | project = __import__(PROJECT_NAME) |
499 | 31 | description_path = os.path.join(ROOT, 'README.rst') | 40 | |
500 | 32 | 41 | ||
501 | 33 | requirements_path = os.path.join(ROOT, 'requirements.pip') | 42 | def get_package_data(): |
502 | 34 | requirements = [i.strip() for i in open(requirements_path).readlines()] | 43 | """Return Juju Quickstart package data by walking through the project. |
503 | 35 | install_requires = [i for i in requirements if i and not i.startswith('#')] | 44 | |
504 | 36 | 45 | The package data includes all non-python files that must be included in | |
505 | 37 | os.chdir(ROOT) | 46 | the source distribution. |
506 | 38 | 47 | """ | |
507 | 39 | data_files = [] | 48 | data_files = [] |
508 | 40 | for dirpath, dirnames, filenames in os.walk(PROJECT_NAME): | 49 | for dirpath, dirnames, filenames in os.walk(PROJECT_NAME): |
509 | 41 | for i, dirname in enumerate(dirnames): | 50 | for i, dirname in enumerate(dirnames): |
510 | 42 | if dirname.startswith('.'): | 51 | if dirname.startswith('.'): |
511 | 43 | del dirnames[i] | 52 | del dirnames[i] |
512 | 44 | if '__init__.py' in filenames: | 53 | if '__init__.py' in filenames: |
513 | 45 | continue | 54 | continue |
514 | 46 | elif filenames: | 55 | elif filenames: |
515 | 47 | for f in filenames: | 56 | for f in filenames: |
516 | 48 | data_files.append(os.path.join( | 57 | data_files.append(os.path.join( |
517 | 49 | dirpath[len(PROJECT_NAME) + 1:], f)) | 58 | dirpath[len(PROJECT_NAME) + 1:], f)) |
518 | 59 | return {PROJECT_NAME: data_files} | ||
519 | 60 | |||
520 | 61 | |||
521 | 62 | def get_long_description(): | ||
522 | 63 | """Retrieve the project long description from the README.rst file.""" | ||
523 | 64 | with open(os.path.join(ROOT, 'README.rst')) as readme_file: | ||
524 | 65 | return readme_file.read() | ||
525 | 66 | |||
526 | 67 | |||
527 | 68 | def get_install_requires(): | ||
528 | 69 | """Dynamically generate the requirements list by parsing the tox file.""" | ||
529 | 70 | config = ConfigParser.ConfigParser() | ||
530 | 71 | config.read(os.path.join(ROOT, 'tox.ini')) | ||
531 | 72 | all_versions = {} | ||
532 | 73 | test_requirements = '{[testenv]deps}' | ||
533 | 74 | platforms = config.get('tox', 'envlist').split(',') | ||
534 | 75 | for platform in platforms: | ||
535 | 76 | section = 'testenv:{}'.format(platform) | ||
536 | 77 | deps = filter(None, config.get(section, 'deps').splitlines()) | ||
537 | 78 | for requirement in deps: | ||
538 | 79 | requirement = requirement.strip() | ||
539 | 80 | if requirement.startswith('#') or requirement == test_requirements: | ||
540 | 81 | continue | ||
541 | 82 | name, version = requirement.split('==') | ||
542 | 83 | versions = all_versions.setdefault(name, set()) | ||
543 | 84 | versions.add(version) | ||
544 | 85 | requirements = [] | ||
545 | 86 | for name, versions in all_versions.items(): | ||
546 | 87 | if len(versions) == 1: | ||
547 | 88 | requirements.append('{}=={}'.format(name, versions.pop())) | ||
548 | 89 | continue | ||
549 | 90 | versions = list(sorted(versions, key=StrictVersion)) | ||
550 | 91 | requirements.append( | ||
551 | 92 | '{}>={},<={}'.format(name, versions[0], versions[-1])) | ||
552 | 93 | return requirements | ||
553 | 94 | |||
554 | 95 | |||
555 | 96 | class RequirementsCommand(Command): | ||
556 | 97 | """Set up the requirements command.""" | ||
557 | 98 | |||
558 | 99 | description = 'output program requirements' | ||
559 | 100 | user_options = [] | ||
560 | 101 | |||
561 | 102 | def initialize_options(self): | ||
562 | 103 | pass | ||
563 | 104 | |||
564 | 105 | def finalize_options(self): | ||
565 | 106 | pass | ||
566 | 107 | |||
567 | 108 | def run(self): | ||
568 | 109 | requirements = get_install_requires() | ||
569 | 110 | print('\n{}'.format('\n'.join(requirements))) | ||
570 | 111 | |||
571 | 112 | |||
572 | 113 | class ToxCommand(TestCommand): | ||
573 | 114 | """Set up the tox testing command.""" | ||
574 | 115 | |||
575 | 116 | user_options = [('tox-args=', 'a', 'Arguments to pass to tox')] | ||
576 | 117 | |||
577 | 118 | def initialize_options(self): | ||
578 | 119 | TestCommand.initialize_options(self) | ||
579 | 120 | self.tox_args = None | ||
580 | 121 | |||
581 | 122 | def finalize_options(self): | ||
582 | 123 | TestCommand.finalize_options(self) | ||
583 | 124 | self.test_args = [] | ||
584 | 125 | self.test_suite = True | ||
585 | 126 | |||
586 | 127 | def run_tests(self): | ||
587 | 128 | # Import here, cause outside the eggs aren't loaded. | ||
588 | 129 | import tox | ||
589 | 130 | args = [] if self.tox_args is None else shlex.split(self.tox_args) | ||
590 | 131 | errno = tox.cmdline(args=args) | ||
591 | 132 | sys.exit(errno) | ||
592 | 50 | 133 | ||
593 | 51 | 134 | ||
594 | 52 | setup( | 135 | setup( |
595 | 53 | name='juju-quickstart', | 136 | name='juju-quickstart', |
596 | 54 | version=project.get_version(), | 137 | version=project.get_version(), |
597 | 55 | description=project.__doc__, | 138 | description=project.__doc__, |
599 | 56 | long_description=open(description_path).read(), | 139 | long_description=get_long_description(), |
600 | 57 | author='The Juju GUI team', | 140 | author='The Juju GUI team', |
601 | 58 | author_email='juju-gui@lists.ubuntu.com', | 141 | author_email='juju-gui@lists.ubuntu.com', |
602 | 59 | url='https://launchpad.net/juju-quickstart', | 142 | url='https://launchpad.net/juju-quickstart', |
603 | 60 | keywords='juju quickstart plugin', | 143 | keywords='juju quickstart plugin', |
604 | 61 | packages=find_packages(), | 144 | packages=find_packages(), |
606 | 62 | package_data={PROJECT_NAME: data_files}, | 145 | package_data=get_package_data(), |
607 | 63 | scripts=['juju-quickstart'], | 146 | scripts=['juju-quickstart'], |
609 | 64 | install_requires=install_requires, | 147 | install_requires=get_install_requires(), |
610 | 148 | tests_require=['tox'], | ||
611 | 149 | cmdclass = { | ||
612 | 150 | 'requirements': RequirementsCommand, | ||
613 | 151 | 'test': ToxCommand, | ||
614 | 152 | }, | ||
615 | 65 | zip_safe=False, | 153 | zip_safe=False, |
616 | 66 | classifiers=[ | 154 | classifiers=[ |
617 | 67 | 'Development Status :: 5 - Production/Stable', | 155 | 'Development Status :: 5 - Production/Stable', |
618 | 68 | 156 | ||
619 | === removed file 'test-requirements.pip' | |||
620 | --- test-requirements.pip 2014-09-05 14:54:31 +0000 | |||
621 | +++ test-requirements.pip 1970-01-01 00:00:00 +0000 | |||
622 | @@ -1,23 +0,0 @@ | |||
623 | 1 | # Juju Quickstart test requirements. | ||
624 | 2 | |||
625 | 3 | # This file is part of the Juju Quickstart Plugin, which lets users set up a | ||
626 | 4 | # Juju environment in very few steps (https://launchpad.net/juju-quickstart). | ||
627 | 5 | # Copyright (C) 2013 Canonical Ltd. | ||
628 | 6 | # | ||
629 | 7 | # This program is free software: you can redistribute it and/or modify it under | ||
630 | 8 | # the terms of the GNU Affero General Public License version 3, as published by | ||
631 | 9 | # the Free Software Foundation. | ||
632 | 10 | # | ||
633 | 11 | # This program is distributed in the hope that it will be useful, but WITHOUT | ||
634 | 12 | # ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, | ||
635 | 13 | # SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
636 | 14 | # Affero General Public License for more details. | ||
637 | 15 | # | ||
638 | 16 | # You should have received a copy of the GNU Affero General Public License | ||
639 | 17 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
640 | 18 | |||
641 | 19 | coverage==3.7.1 | ||
642 | 20 | flake8==2.2.3 | ||
643 | 21 | mock==1.0.1 | ||
644 | 22 | nose==1.3.4 | ||
645 | 23 | -r requirements.pip | ||
646 | 24 | 0 | ||
647 | === added file 'tox.ini' | |||
648 | --- tox.ini 1970-01-01 00:00:00 +0000 | |||
649 | +++ tox.ini 2015-01-30 16:35:06 +0000 | |||
650 | @@ -0,0 +1,115 @@ | |||
651 | 1 | # This file is part of the Juju Quickstart Plugin, which lets users set up a | ||
652 | 2 | # Juju environment in very few steps (https://launchpad.net/juju-quickstart). | ||
653 | 3 | # Copyright (C) 2015 Canonical Ltd. | ||
654 | 4 | # | ||
655 | 5 | # This program is free software: you can redistribute it and/or modify it under | ||
656 | 6 | # the terms of the GNU Affero General Public License version 3, as published by | ||
657 | 7 | # the Free Software Foundation. | ||
658 | 8 | # | ||
659 | 9 | # This program is distributed in the hope that it will be useful, but WITHOUT | ||
660 | 10 | # ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, | ||
661 | 11 | # SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
662 | 12 | # Affero General Public License for more details. | ||
663 | 13 | # | ||
664 | 14 | # You should have received a copy of the GNU Affero General Public License | ||
665 | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
666 | 16 | |||
667 | 17 | [tox] | ||
668 | 18 | # The envlist option must only include platform scenarios. In essence, those | ||
669 | 19 | # are used to test Juju Quickstart with the specific dependencies present in | ||
670 | 20 | # each supported OS platform. | ||
671 | 21 | envlist = pypi,ppa,vivid | ||
672 | 22 | # XXX frankban: currently tests do not pass on trusty and utopic scenarios. | ||
673 | 23 | # Fix the tests, then remove the line above and uncomment the line below. | ||
674 | 24 | # envlist = pypi,ppa,trusty,utopic,vivid | ||
675 | 25 | |||
676 | 26 | |||
677 | 27 | # Define the base requirements and commands to use when testing the program. | ||
678 | 28 | |||
679 | 29 | [testenv] | ||
680 | 30 | basepython = python2.7 | ||
681 | 31 | deps = | ||
682 | 32 | mock==1.0.1 | ||
683 | 33 | nose==1.3.4 | ||
684 | 34 | commands = | ||
685 | 35 | nosetests {posargs:--quiet} | ||
686 | 36 | |||
687 | 37 | |||
688 | 38 | # Set up the development environment. | ||
689 | 39 | |||
690 | 40 | [testenv:devenv] | ||
691 | 41 | envdir = devenv | ||
692 | 42 | usedevelop = True | ||
693 | 43 | deps = | ||
694 | 44 | {[testenv]deps} | ||
695 | 45 | {[testenv:lint]deps} | ||
696 | 46 | coverage==3.7.1 | ||
697 | 47 | commands = | ||
698 | 48 | |||
699 | 49 | |||
700 | 50 | # Set up different scenarios for each Juju Quickstart source repository. | ||
701 | 51 | # Note that the setup.py distribution file calculates Juju Quickstart | ||
702 | 52 | # requirements based on this file. For this reason, when updating dependencies, | ||
703 | 53 | # respect the following rules: | ||
704 | 54 | # - all scenarios must be listed in the envlist above (in the tox section); | ||
705 | 55 | # - each scenario must at least include a "{[testenv]deps}" line in its deps; | ||
706 | 56 | # - keep each requirement in deps in its own line; | ||
707 | 57 | # - always use specific revisions for environments (i.e. use "=="). | ||
708 | 58 | # After updating this file, run "make requirements" and ensure the general | ||
709 | 59 | # dependency rules in the output make sense. | ||
710 | 60 | |||
711 | 61 | [testenv:pypi] | ||
712 | 62 | # Always recreate the virtualenv here so that old installed dependencies are | ||
713 | 63 | # not reused and a fresh pip install can be accurately simulated. | ||
714 | 64 | recreate = True | ||
715 | 65 | deps = | ||
716 | 66 | {[testenv]deps} | ||
717 | 67 | # All the dependencies are installed by Juju Quickstart itself, using | ||
718 | 68 | # the dynamically generated "install_requires" setup field. | ||
719 | 69 | # Note that, since Homebrew internally uses pip when installing Quickstart, | ||
720 | 70 | # this scenario also covers OSX installations. | ||
721 | 71 | |||
722 | 72 | [testenv:ppa] | ||
723 | 73 | deps = | ||
724 | 74 | {[testenv]deps} | ||
725 | 75 | # Dependencies present in ppa:juju/stable. | ||
726 | 76 | # See https://launchpad.net/~juju/+archive/ubuntu/stable. | ||
727 | 77 | websocket-client==0.18.0 | ||
728 | 78 | jujuclient==0.18.4 | ||
729 | 79 | urwid==1.2.1 | ||
730 | 80 | # The distribution PyYAML requirement is used in this case. | ||
731 | 81 | |||
732 | 82 | [testenv:trusty] | ||
733 | 83 | deps = | ||
734 | 84 | {[testenv]deps} | ||
735 | 85 | # Ubuntu 14.04 (trusty) distro dependencies. | ||
736 | 86 | websocket-client==0.12.0 | ||
737 | 87 | jujuclient==0.17.5 | ||
738 | 88 | PyYAML==3.10 | ||
739 | 89 | urwid==1.1.1 | ||
740 | 90 | |||
741 | 91 | [testenv:utopic] | ||
742 | 92 | deps = | ||
743 | 93 | {[testenv]deps} | ||
744 | 94 | # Ubuntu 14.10 (utopic) distro dependencies. | ||
745 | 95 | websocket-client==0.12.0 | ||
746 | 96 | jujuclient==0.17.5 | ||
747 | 97 | PyYAML==3.11 | ||
748 | 98 | urwid==1.2.1 | ||
749 | 99 | |||
750 | 100 | [testenv:vivid] | ||
751 | 101 | deps = | ||
752 | 102 | {[testenv]deps} | ||
753 | 103 | # Ubuntu 15.04 (vivid) distro dependencies. | ||
754 | 104 | websocket-client==0.18.0 | ||
755 | 105 | jujuclient==0.18.5 | ||
756 | 106 | PyYAML==3.11 | ||
757 | 107 | urwid==1.2.1 | ||
758 | 108 | |||
759 | 109 | |||
760 | 110 | # Define additional tox targets to be used to validate and lint the code. | ||
761 | 111 | |||
762 | 112 | [testenv:lint] | ||
763 | 113 | usedevelop = True | ||
764 | 114 | deps = flake8==2.3.0 | ||
765 | 115 | commands = flake8 --show-source quickstart |
Reviewers: mp+246761_ code.launchpad. net,
Message:
Please take a look.
Description:
Introduce tox for testing multiple sets of deps.
Quickstart must be run on several platforms/Ubuntu series,
each one with its own versions of the packages that
Quickstart depends on. The tox utility is used for both:
- handling those kind of separate scenarios;
- creating the development virtual environments.
The latter was previously done using virtualenv directly
in the Makefile. The new infrastructure should be
more flexible.
Update the relevant parts of the Makefile, also handling
the automatic installation of system dependencies.
Implement the ability to calculate the requirements
for the PyPI package automatically by parsing the
tox.ini file. I am not really sure about the method I
used (take a look at the setup.py file), but the
alternative is to manually update those and violate DRY.
I think we could give it a try and fall back to the
manual approach if required.
Also implement a correct behavior for
"python setup.py test", which now runs all the tests.
To test and QA this branch, run `make clean` and then
follow what described in the HACKING.rst file, in the
following paragraphs:
- Creating a development environment
- Testing and debugging the application
- Requirements
- Updating application and test dependencies
Thank you!
https:/ /code.launchpad .net/~frankban/ juju-quickstart /add-tox/ +merge/ 246761
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/189580044/
Affected files (+409, -171 lines): ts.pip
M .bzrignore
M HACKING.rst
M MANIFEST.in
M Makefile
A [revision details]
D requirements.pip
A setup.cfg
M setup.py
D test-requiremen
A tox.ini