Merge lp:~chris.macnaughton/mojo/py3002 into lp:~ost-maintainers/mojo/py3
- py3002
- Merge into py3
Status: | Merged |
---|---|
Approved by: | Ryan Beisner |
Approved revision: | 474 |
Merged at revision: | 465 |
Proposed branch: | lp:~chris.macnaughton/mojo/py3002 |
Merge into: | lp:~ost-maintainers/mojo/py3 |
Diff against target: |
337 lines (+71/-33) 9 files modified
contrib/test/utils.py (+1/-1) mojo/cli.py (+13/-15) mojo/juju/status.py (+3/-1) mojo/juju/wait.py (+3/-0) mojo/phase.py (+4/-1) mojo/tests/test_juju2.py (+19/-9) mojo/utils.py (+3/-0) setup.py (+1/-0) tox.ini (+24/-6) |
To merge this branch: | bzr merge lp:~chris.macnaughton/mojo/py3002 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
OpenStack Charm Testing Maintainers | Pending | ||
Review via email: mp+336352@code.launchpad.net |
Commit message
Description of the change
- 470. By Chris MacNaughton
-
add list() back around map() to make it work on py2+3
Chris MacNaughton (chris.macnaughton) wrote : | # |
Chris MacNaughton (chris.macnaughton) wrote : | # |
Not quite py3 ready:
2018-01-24 11:10:49 [INFO] Rsyncing /home/ubuntu/
2018-01-24 11:10:50 [INFO] Retrieve the spec's manifest
2018-01-24 11:10:50 [INFO] Manifest comment:
#######
Collect the charm branches from Launchpad
#######
2018-01-24 11:10:50 [INFO] Building resource tree
2018-01-24 11:10:50 [ERROR] Unknown error
Traceback (most recent call last):
File "/home/
args.func(args)
File "/home/
return method(*args, **kwargs)
File "/home/
manifest.
File "/home/
auto_
File "/home/
rendered_
File "/home/
return func(*args, **kwargs)
TypeError: a bytes-like object is required, not 'str'
- 471. By Chris MacNaughton
-
decode bytes to str
- 472. By Chris MacNaughton
-
import six
- 473. By Chris MacNaughton
-
add encoding to popen
- 474. By Chris MacNaughton
-
ensure we decode command line output if needed
Chris MacNaughton (chris.macnaughton) wrote : | # |
Ok, have run the openstack-
Preview Diff
1 | === modified file 'contrib/test/utils.py' | |||
2 | --- contrib/test/utils.py 2018-01-18 10:23:15 +0000 | |||
3 | +++ contrib/test/utils.py 2018-01-25 14:10:22 +0000 | |||
4 | @@ -44,6 +44,6 @@ | |||
5 | 44 | """ | 44 | """ |
6 | 45 | try: | 45 | try: |
7 | 46 | subprocess.check_output(['juju', 'switch']) | 46 | subprocess.check_output(['juju', 'switch']) |
9 | 47 | except subprocess.CalledProcessError as OSError: | 47 | except subprocess.CalledProcessError, OSError: |
10 | 48 | print('Error checking active Juju controller') | 48 | print('Error checking active Juju controller') |
11 | 49 | sys.exit(1) | 49 | sys.exit(1) |
12 | 50 | 50 | ||
13 | === modified file 'mojo/cli.py' | |||
14 | --- mojo/cli.py 2018-01-18 10:23:15 +0000 | |||
15 | +++ mojo/cli.py 2018-01-25 14:10:22 +0000 | |||
16 | @@ -1,6 +1,6 @@ | |||
17 | 1 | # Copyright 2014, 2015 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2014, 2015 Canonical Ltd. This software is licensed under the |
18 | 2 | # GNU General Public License version 3 (see the file LICENSE). | 2 | # GNU General Public License version 3 (see the file LICENSE). |
20 | 3 | 3 | from __future__ import print_function | |
21 | 4 | import argparse | 4 | import argparse |
22 | 5 | import errno | 5 | import errno |
23 | 6 | import logging | 6 | import logging |
24 | @@ -76,7 +76,7 @@ | |||
25 | 76 | 76 | ||
26 | 77 | 77 | ||
27 | 78 | def exit_with_usage(parser, message): | 78 | def exit_with_usage(parser, message): |
29 | 79 | print(message + "\n", file=sys.stderr) | 79 | sys.stderr.write(message + "\n") |
30 | 80 | parser.print_help(file=sys.stderr) | 80 | parser.print_help(file=sys.stderr) |
31 | 81 | sys.exit(1) | 81 | sys.exit(1) |
32 | 82 | 82 | ||
33 | @@ -268,7 +268,7 @@ | |||
34 | 268 | try: | 268 | try: |
35 | 269 | project.create_workspace(spec_url, workspace, stage=args.stage, logfile=args.logfile) | 269 | project.create_workspace(spec_url, workspace, stage=args.stage, logfile=args.logfile) |
36 | 270 | except OSError: | 270 | except OSError: |
38 | 271 | print("Are you sure the project exists?", file=sys.stderr) | 271 | sys.stderr.write("Are you sure the project exists?") |
39 | 272 | if args.blunt: | 272 | if args.blunt: |
40 | 273 | raise | 273 | raise |
41 | 274 | sys.exit(2) | 274 | sys.exit(2) |
42 | @@ -649,9 +649,9 @@ | |||
43 | 649 | sys.exit(1) | 649 | sys.exit(1) |
44 | 650 | except mojo.exceptions.ConfigNotFoundException as e: | 650 | except mojo.exceptions.ConfigNotFoundException as e: |
45 | 651 | logging.error(e.message) | 651 | logging.error(e.message) |
47 | 652 | print("Searched:", file=sys.stderr) | 652 | sys.stderr.write("Searched:") |
48 | 653 | for path in e.search_list: | 653 | for path in e.search_list: |
50 | 654 | print(" {}".format(path), file=sys.stderr) | 654 | sys.stderr.write(" {}".format(path)) |
51 | 655 | sys.exit(1) | 655 | sys.exit(1) |
52 | 656 | except (mojo.exceptions.InvalidManifestException, | 656 | except (mojo.exceptions.InvalidManifestException, |
53 | 657 | mojo.phase.FileDoesNotExistException, | 657 | mojo.phase.FileDoesNotExistException, |
54 | @@ -672,14 +672,14 @@ | |||
55 | 672 | if ioe.errno != errno.EACCES: | 672 | if ioe.errno != errno.EACCES: |
56 | 673 | raise | 673 | raise |
57 | 674 | 674 | ||
60 | 675 | print('ERROR: Unable to read container configuration ' | 675 | sys.stderr.write('ERROR: Unable to read container configuration ' |
61 | 676 | 'from {}'.format(filename), file=sys.stderr) | 676 | 'from {}'.format(filename)) |
62 | 677 | 677 | ||
63 | 678 | try: | 678 | try: |
64 | 679 | os.listdir('/var/lib/lxc') | 679 | os.listdir('/var/lib/lxc') |
65 | 680 | except OSError as ose: | 680 | except OSError as ose: |
66 | 681 | if ose.errno == errno.EACCES: | 681 | if ose.errno == errno.EACCES: |
68 | 682 | print(dedent( | 682 | sys.stderr.write(dedent( |
69 | 683 | '''\ | 683 | '''\ |
70 | 684 | ERROR: /var/lib/lxc is not readable; consider one of the following: | 684 | ERROR: /var/lib/lxc is not readable; consider one of the following: |
71 | 685 | 685 | ||
72 | @@ -688,8 +688,7 @@ | |||
73 | 688 | sudo chmod 0750 /var/lib/lxc | 688 | sudo chmod 0750 /var/lib/lxc |
74 | 689 | 689 | ||
75 | 690 | Option 2: | 690 | Option 2: |
78 | 691 | sudo chmod 0755 /var/lib/lxc'''), | 691 | sudo chmod 0755 /var/lib/lxc''')) |
77 | 692 | file=sys.stderr) | ||
79 | 693 | sys.exit(1) | 692 | sys.exit(1) |
80 | 694 | 693 | ||
81 | 695 | try: | 694 | try: |
82 | @@ -699,18 +698,17 @@ | |||
83 | 699 | # The problem isn't /var/lib/lxc; it's the container! | 698 | # The problem isn't /var/lib/lxc; it's the container! |
84 | 700 | if ose.errno == errno.EACCES: | 699 | if ose.errno == errno.EACCES: |
85 | 701 | # We know it's not /var/lib/lxc; that was checked above. | 700 | # We know it's not /var/lib/lxc; that was checked above. |
87 | 702 | print(dedent( | 701 | sys.stderr.write(dedent( |
88 | 703 | '''\ | 702 | '''\ |
89 | 704 | ERROR: {container} exists but is not readable; consider doing the following: | 703 | ERROR: {container} exists but is not readable; consider doing the following: |
90 | 705 | 704 | ||
91 | 706 | sudo chmod 0755 {container}''').format( | 705 | sudo chmod 0755 {container}''').format( |
94 | 707 | container=container), | 706 | container=container)) |
93 | 708 | file=sys.stderr) | ||
95 | 709 | sys.exit(1) | 707 | sys.exit(1) |
96 | 710 | if ose.errno == errno.ENOENT: | 708 | if ose.errno == errno.ENOENT: |
97 | 711 | # Mojo checks this itself, so this would be very strange. | 709 | # Mojo checks this itself, so this would be very strange. |
100 | 712 | print('ERROR: {} does not exist; was the Mojo project ' | 710 | sys.stderr.write('ERROR: {} does not exist; was the Mojo project ' |
101 | 713 | 'created properly?!'.format(container), file=sys.stderr) | 711 | 'created properly?!'.format(container)) |
102 | 714 | sys.exit(1) | 712 | sys.exit(1) |
103 | 715 | 713 | ||
104 | 716 | # Some things are beyond even our powers to diagnose. | 714 | # Some things are beyond even our powers to diagnose. |
105 | 717 | 715 | ||
106 | === modified file 'mojo/juju/status.py' | |||
107 | --- mojo/juju/status.py 2018-01-18 10:23:15 +0000 | |||
108 | +++ mojo/juju/status.py 2018-01-25 14:10:22 +0000 | |||
109 | @@ -4,6 +4,7 @@ | |||
110 | 4 | import subprocess | 4 | import subprocess |
111 | 5 | import time | 5 | import time |
112 | 6 | import yaml | 6 | import yaml |
113 | 7 | import six | ||
114 | 7 | 8 | ||
115 | 8 | from collections import Counter | 9 | from collections import Counter |
116 | 9 | 10 | ||
117 | @@ -12,6 +13,8 @@ | |||
118 | 12 | try: | 13 | try: |
119 | 13 | with open(os.devnull, 'w') as devnull: | 14 | with open(os.devnull, 'w') as devnull: |
120 | 14 | version = subprocess.check_output(['juju', 'version'], stderr=devnull) | 15 | version = subprocess.check_output(['juju', 'version'], stderr=devnull) |
121 | 16 | if six.PY3: | ||
122 | 17 | version = version.decode('utf-8') | ||
123 | 15 | major_version = int(version[0]) | 18 | major_version = int(version[0]) |
124 | 16 | except subprocess.CalledProcessError: | 19 | except subprocess.CalledProcessError: |
125 | 17 | # In cases where the Juju Status yaml is provided by a file this may legitimately fail | 20 | # In cases where the Juju Status yaml is provided by a file this may legitimately fail |
126 | @@ -463,7 +466,6 @@ | |||
127 | 463 | # self.ready() will raise exceptions on error states | 466 | # self.ready() will raise exceptions on error states |
128 | 464 | if self.ready() or not wait_for_steady: | 467 | if self.ready() or not wait_for_steady: |
129 | 465 | return | 468 | return |
130 | 466 | |||
131 | 467 | logging.info("Waiting for environment to reach steady state") | 469 | logging.info("Waiting for environment to reach steady state") |
132 | 468 | wait(max_wait=timeout) | 470 | wait(max_wait=timeout) |
133 | 469 | logging.info("Environment has reached steady state") | 471 | logging.info("Environment has reached steady state") |
134 | 470 | 472 | ||
135 | === modified file 'mojo/juju/wait.py' | |||
136 | --- mojo/juju/wait.py 2018-01-18 10:23:15 +0000 | |||
137 | +++ mojo/juju/wait.py 2018-01-25 14:10:22 +0000 | |||
138 | @@ -31,6 +31,7 @@ | |||
139 | 31 | from textwrap import dedent | 31 | from textwrap import dedent |
140 | 32 | import time | 32 | import time |
141 | 33 | import yaml | 33 | import yaml |
142 | 34 | import six | ||
143 | 34 | 35 | ||
144 | 35 | 36 | ||
145 | 36 | __version__ = '2.5.0' | 37 | __version__ = '2.5.0' |
146 | @@ -76,6 +77,8 @@ | |||
147 | 76 | logging.error(err) | 77 | logging.error(err) |
148 | 77 | logging.error("{} failed: {}".format(' '.join(cmd), p.returncode)) | 78 | logging.error("{} failed: {}".format(' '.join(cmd), p.returncode)) |
149 | 78 | raise JujuWaitException(p.returncode or 43) | 79 | raise JujuWaitException(p.returncode or 43) |
150 | 80 | if six.PY3: | ||
151 | 81 | out = out.decode('utf-8') | ||
152 | 79 | return out | 82 | return out |
153 | 80 | 83 | ||
154 | 81 | 84 | ||
155 | 82 | 85 | ||
156 | === modified file 'mojo/phase.py' | |||
157 | --- mojo/phase.py 2018-01-18 11:04:39 +0000 | |||
158 | +++ mojo/phase.py 2018-01-25 14:10:22 +0000 | |||
159 | @@ -25,6 +25,7 @@ | |||
160 | 25 | import mojo.juju | 25 | import mojo.juju |
161 | 26 | import mojo.juju.utils | 26 | import mojo.juju.utils |
162 | 27 | import codetree | 27 | import codetree |
163 | 28 | import six | ||
164 | 28 | from deployer.config import ConfigStack | 29 | from deployer.config import ConfigStack |
165 | 29 | 30 | ||
166 | 30 | 31 | ||
167 | @@ -215,7 +216,7 @@ | |||
168 | 215 | with chdir(workspace.build_dir): | 216 | with chdir(workspace.build_dir): |
169 | 216 | try: | 217 | try: |
170 | 217 | tmpl_vars = {'series': project.series} | 218 | tmpl_vars = {'series': project.series} |
172 | 218 | with tempfile.NamedTemporaryFile() as rendered_collect: | 219 | with tempfile.NamedTemporaryFile(mode='wt') as rendered_collect: |
173 | 219 | with open(config) as inp: | 220 | with open(config) as inp: |
174 | 220 | try: | 221 | try: |
175 | 221 | rendered_collect.write(Template(inp.read()).render(**tmpl_vars)) | 222 | rendered_collect.write(Template(inp.read()).render(**tmpl_vars)) |
176 | @@ -363,6 +364,8 @@ | |||
177 | 363 | command = env_vars + [script] | 364 | command = env_vars + [script] |
178 | 364 | try: | 365 | try: |
179 | 365 | output = subprocess.check_output(command, stderr=subprocess.STDOUT) | 366 | output = subprocess.check_output(command, stderr=subprocess.STDOUT) |
180 | 367 | if six.PY3: | ||
181 | 368 | output = output.decode('utf-8') | ||
182 | 366 | except subprocess.CalledProcessError as e: | 369 | except subprocess.CalledProcessError as e: |
183 | 367 | if gather_debug_logs: | 370 | if gather_debug_logs: |
184 | 368 | exception_output = self._gather_debug_logs(e, workspace, stage) | 371 | exception_output = self._gather_debug_logs(e, workspace, stage) |
185 | 369 | 372 | ||
186 | === modified file 'mojo/tests/test_juju2.py' | |||
187 | --- mojo/tests/test_juju2.py 2018-01-18 10:23:15 +0000 | |||
188 | +++ mojo/tests/test_juju2.py 2018-01-25 14:10:22 +0000 | |||
189 | @@ -128,19 +128,22 @@ | |||
190 | 128 | def test_model_version(self): | 128 | def test_model_version(self): |
191 | 129 | self.assertEqual(self.status.model_version(), '2.0-beta18') | 129 | self.assertEqual(self.status.model_version(), '2.0-beta18') |
192 | 130 | 130 | ||
194 | 131 | def test_status(self): | 131 | @mock.patch('subprocess.check_output') |
195 | 132 | def test_status(self, mock_check_output): | ||
196 | 132 | """Test the status function""" | 133 | """Test the status function""" |
197 | 133 | self.assertEqual(self.status.status(), self.status._raw_status) | 134 | self.assertEqual(self.status.status(), self.status._raw_status) |
198 | 134 | 135 | ||
199 | 135 | with mock.patch('subprocess.check_output') as mock_check_output: | 136 | with mock.patch('subprocess.check_output') as mock_check_output: |
200 | 136 | # First check with no environment set | 137 | # First check with no environment set |
203 | 137 | no_env_status = mojo.juju.status.Juju2Status(command_timeout=None) | 138 | with mock.patch('mojo.juju.status.major_version', new=2): |
204 | 138 | no_env_status.status() | 139 | no_env_status = mojo.juju.status.Juju2Status(command_timeout=None) |
205 | 140 | no_env_status.status() | ||
206 | 139 | mock_check_output.assert_called_with( | 141 | mock_check_output.assert_called_with( |
207 | 140 | ['juju', 'status', '--format=yaml']) | 142 | ['juju', 'status', '--format=yaml']) |
208 | 141 | # Second test with an environment set | 143 | # Second test with an environment set |
211 | 142 | env_status = mojo.juju.status.Juju2Status(environment="test-env") | 144 | with mock.patch('mojo.juju.status.major_version', new=2): |
212 | 143 | env_status.status() | 145 | env_status = mojo.juju.status.Juju2Status(environment="test-env") |
213 | 146 | env_status.status() | ||
214 | 144 | mock_check_output.assert_called_with( | 147 | mock_check_output.assert_called_with( |
215 | 145 | ['/usr/bin/timeout', '--kill-after', '5', '600', | 148 | ['/usr/bin/timeout', '--kill-after', '5', '600', |
216 | 146 | 'juju', 'status', '--format=yaml', '-m', 'test-env']) | 149 | 'juju', 'status', '--format=yaml', '-m', 'test-env']) |
217 | @@ -240,7 +243,12 @@ | |||
218 | 240 | 'since': '16 Sep 2016 15:23:55Z'}, | 243 | 'since': '16 Sep 2016 15:23:55Z'}, |
219 | 241 | 'relations': {'juju-info': ['apache2', 'prometheus']}, | 244 | 'relations': {'juju-info': ['apache2', 'prometheus']}, |
220 | 242 | 'subordinate-to': ['apache2', 'prometheus']}}} | 245 | 'subordinate-to': ['apache2', 'prometheus']}}} |
222 | 243 | self.assertEqual(self.status.yaml_status(force_update=True), expected) | 246 | with mock.patch('subprocess.check_output') as mock_check_output: |
223 | 247 | mock_check_output.return_value = self._testdata_from_file('juju2-idle.yaml') | ||
224 | 248 | self.assertEqual(self.status.yaml_status(force_update=True), expected) | ||
225 | 249 | # mock_check_output.assert_called_with( | ||
226 | 250 | # ['/usr/bin/timeout', '--kill-after', '5', '600', | ||
227 | 251 | # 'juju', 'status', '--format=yaml']) | ||
228 | 244 | 252 | ||
229 | 245 | 253 | ||
230 | 246 | class Juju2CheckOutputWithTimeoutTestException(Exception): | 254 | class Juju2CheckOutputWithTimeoutTestException(Exception): |
231 | @@ -305,7 +313,7 @@ | |||
232 | 305 | timeout_exception=Juju2CheckOutputWithTimeoutTestException) | 313 | timeout_exception=Juju2CheckOutputWithTimeoutTestException) |
233 | 306 | 314 | ||
234 | 307 | self.assertTrue( | 315 | self.assertTrue( |
236 | 308 | arcm.exception.message.endswith(' timed out after 5 seconds')) | 316 | str(arcm.exception).endswith(' timed out after 5 seconds')) |
237 | 309 | 317 | ||
238 | 310 | @mock.patch('subprocess.check_output') | 318 | @mock.patch('subprocess.check_output') |
239 | 311 | def test_command_times_out_and_is_killed(self, check_output_mock): | 319 | def test_command_times_out_and_is_killed(self, check_output_mock): |
240 | @@ -323,7 +331,7 @@ | |||
241 | 323 | timeout_exception=Juju2CheckOutputWithTimeoutTestException) | 331 | timeout_exception=Juju2CheckOutputWithTimeoutTestException) |
242 | 324 | 332 | ||
243 | 325 | self.assertTrue( | 333 | self.assertTrue( |
245 | 326 | arcm.exception.message.endswith(' timed out after 5 seconds (killed)')) | 334 | str(arcm.exception).endswith(' timed out after 5 seconds (killed)')) |
246 | 327 | 335 | ||
247 | 328 | 336 | ||
248 | 329 | class Juju2ChecksTest(TestCase): | 337 | class Juju2ChecksTest(TestCase): |
249 | @@ -386,7 +394,9 @@ | |||
250 | 386 | sys.argv = ['self', '-f', self.status_path, 'get_ips', 'all'] | 394 | sys.argv = ['self', '-f', self.status_path, 'get_ips', 'all'] |
251 | 387 | rc = parse_status() | 395 | rc = parse_status() |
252 | 388 | self.assertEqual(rc, 0) | 396 | self.assertEqual(rc, 0) |
254 | 389 | self.assertEqual(mock_stdout.getvalue(), '10.25.2.111\n10.242.242.242\n10.25.2.109\n10.25.2.112\n10.25.2.110\n') | 397 | ips = mock_stdout.getvalue().split("\n") |
255 | 398 | ips.sort() | ||
256 | 399 | self.assertEqual("{}\n".format("\n".join(ips).lstrip()), '10.242.242.242\n10.25.2.109\n10.25.2.110\n10.25.2.111\n10.25.2.112\n') | ||
257 | 390 | 400 | ||
258 | 391 | @mock.patch('sys.stdout', new_callable=StringIO) | 401 | @mock.patch('sys.stdout', new_callable=StringIO) |
259 | 392 | def test_GetIPs_app(self, mock_stdout): | 402 | def test_GetIPs_app(self, mock_stdout): |
260 | 393 | 403 | ||
261 | === modified file 'mojo/utils.py' | |||
262 | --- mojo/utils.py 2017-12-22 10:31:56 +0000 | |||
263 | +++ mojo/utils.py 2018-01-25 14:10:22 +0000 | |||
264 | @@ -13,6 +13,7 @@ | |||
265 | 13 | import time | 13 | import time |
266 | 14 | 14 | ||
267 | 15 | from hashlib import sha1 | 15 | from hashlib import sha1 |
268 | 16 | import six | ||
269 | 16 | from .exceptions import Unprivileged | 17 | from .exceptions import Unprivileged |
270 | 17 | 18 | ||
271 | 18 | 19 | ||
272 | @@ -262,6 +263,8 @@ | |||
273 | 262 | eof = True | 263 | eof = True |
274 | 263 | for stream in to_read: | 264 | for stream in to_read: |
275 | 264 | line = stream.read(read_bytes) | 265 | line = stream.read(read_bytes) |
276 | 266 | if six.PY3: | ||
277 | 267 | line = line.decode('utf-8') | ||
278 | 265 | if line != "": | 268 | if line != "": |
279 | 266 | eof = False | 269 | eof = False |
280 | 267 | output += line | 270 | output += line |
281 | 268 | 271 | ||
282 | === modified file 'setup.py' | |||
283 | --- setup.py 2017-05-10 03:58:59 +0000 | |||
284 | +++ setup.py 2018-01-25 14:10:22 +0000 | |||
285 | @@ -21,6 +21,7 @@ | |||
286 | 21 | "jujuclient >= 0.0.7", | 21 | "jujuclient >= 0.0.7", |
287 | 22 | "juju-deployer >= 0.6.4", | 22 | "juju-deployer >= 0.6.4", |
288 | 23 | "pylxd < 2.1.0", | 23 | "pylxd < 2.1.0", |
289 | 24 | "six >= 1.11.0", | ||
290 | 24 | "python-cinderclient >= 1.0.0"], | 25 | "python-cinderclient >= 1.0.0"], |
291 | 25 | packages=find_packages(), | 26 | packages=find_packages(), |
292 | 26 | classifiers=[ | 27 | classifiers=[ |
293 | 27 | 28 | ||
294 | === modified file 'tox.ini' | |||
295 | --- tox.ini 2018-01-18 10:23:15 +0000 | |||
296 | +++ tox.ini 2018-01-25 14:10:22 +0000 | |||
297 | @@ -1,6 +1,6 @@ | |||
298 | 1 | # mojo_exec: build a py3 virtualenv and execute a basic mojo command to confirm py3-only functionality. | 1 | # mojo_exec: build a py3 virtualenv and execute a basic mojo command to confirm py3-only functionality. |
299 | 2 | [tox] | 2 | [tox] |
301 | 3 | envlist = mojo_exec | 3 | envlist = mojo2_exec,mojo3_exec,py27,py36 |
302 | 4 | skipsdist = True | 4 | skipsdist = True |
303 | 5 | 5 | ||
304 | 6 | [testenv] | 6 | [testenv] |
305 | @@ -10,8 +10,26 @@ | |||
306 | 10 | install_command = | 10 | install_command = |
307 | 11 | pip install --allow-unverified python-apt {opts} {packages} | 11 | pip install --allow-unverified python-apt {opts} {packages} |
308 | 12 | 12 | ||
314 | 13 | [testenv:mojo_exec] | 13 | [testenv:mojo3_exec] |
315 | 14 | basepython = python3 | 14 | basepython = python3 |
316 | 15 | deps = -r{toxinidir}/requirements.txt | 15 | deps = -r{toxinidir}/requirements.txt |
317 | 16 | commands = pip install --upgrade . | 16 | commands = pip install --upgrade . |
318 | 17 | mojo --version | 17 | mojo --version |
319 | 18 | |||
320 | 19 | [testenv:mojo2_exec] | ||
321 | 20 | basepython = python2 | ||
322 | 21 | deps = -r{toxinidir}/requirements.txt | ||
323 | 22 | commands = pip install --upgrade . | ||
324 | 23 | mojo --version | ||
325 | 24 | |||
326 | 25 | [testenv:py3] | ||
327 | 26 | basepython = python3 | ||
328 | 27 | deps = -r{toxinidir}/requirements.txt | ||
329 | 28 | -r{toxinidir}/test-requirements.txt | ||
330 | 29 | commands = nosetests {posargs} {toxinidir}/mojo/tests | ||
331 | 30 | |||
332 | 31 | [testenv:py27] | ||
333 | 32 | basepython = python2.7 | ||
334 | 33 | deps = -r{toxinidir}/requirements.txt | ||
335 | 34 | -r{toxinidir}/test-requirements.txt | ||
336 | 35 | commands = nosetests {posargs} {toxinidir}/mojo/tests | ||
337 | 18 | \ No newline at end of file | 36 | \ No newline at end of file |
Have confirmed with a basic mojo run that this works on py2 still, commencing a test on py3