Merge lp:~sergiusens/snapcraft/1501494 into lp:~snappy-dev/snapcraft/core

Proposed by Sergio Schvezov
Status: Merged
Approved by: Michael Vogt
Approved revision: 224
Merged at revision: 224
Proposed branch: lp:~sergiusens/snapcraft/1501494
Merge into: lp:~snappy-dev/snapcraft/core
Diff against target: 46 lines (+26/-0)
2 files modified
snapcraft/tests/test_yaml.py (+22/-0)
snapcraft/yaml.py (+4/-0)
To merge this branch: bzr merge lp:~sergiusens/snapcraft/1501494
Reviewer Review Type Date Requested Status
Michael Vogt (community) Approve
Review via email: mp+272982@code.launchpad.net

Commit message

Backwards compatibility for using type

To post a comment you must log in.
Revision history for this message
Michael Vogt (mvo) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'snapcraft/tests/test_yaml.py'
--- snapcraft/tests/test_yaml.py 2015-09-29 13:36:43 +0000
+++ snapcraft/tests/test_yaml.py 2015-09-30 20:42:09 +0000
@@ -198,6 +198,28 @@
198 self.assertEqual(raised.exception.message, '\'myapp@me_1.0\' does not match \'^[a-z0-9][a-z0-9+-]*$\'')198 self.assertEqual(raised.exception.message, '\'myapp@me_1.0\' does not match \'^[a-z0-9][a-z0-9+-]*$\'')
199199
200 @unittest.mock.patch('snapcraft.yaml.Config.load_plugin')200 @unittest.mock.patch('snapcraft.yaml.Config.load_plugin')
201 def test_deprecation_for_type(self, mock_loadPlugin):
202 fake_logger = fixtures.FakeLogger(level=logging.WARNING)
203 self.useFixture(fake_logger)
204
205 self.make_snapcraft_yaml("""name: myapp
206version: "1"
207vendor: me <me@me.com>
208summary: test
209description: nothing
210icon: my-icon.png
211
212parts:
213 part1:
214 type: go
215 stage-packages: [fswebcam]
216""")
217 config = snapcraft.yaml.Config()
218 self.assertEqual(fake_logger.output,
219 'DEPRECATED: Use "plugin" instead of "type"\n')
220 self.assertFalse('type' in config.data)
221
222 @unittest.mock.patch('snapcraft.yaml.Config.load_plugin')
201 def test_invalid_yaml_missing_description(self, mock_loadPlugin):223 def test_invalid_yaml_missing_description(self, mock_loadPlugin):
202 fake_logger = fixtures.FakeLogger(level=logging.ERROR)224 fake_logger = fixtures.FakeLogger(level=logging.ERROR)
203 self.useFixture(fake_logger)225 self.useFixture(fake_logger)
204226
=== modified file 'snapcraft/yaml.py'
--- snapcraft/yaml.py 2015-09-30 19:44:28 +0000
+++ snapcraft/yaml.py 2015-09-30 20:42:09 +0000
@@ -86,6 +86,10 @@
8686
87 plugin_name = properties.pop("plugin", None)87 plugin_name = properties.pop("plugin", None)
88 # TODO search the wiki88 # TODO search the wiki
89 if not plugin_name and 'type' in properties:
90 plugin_name = properties.pop('type')
91 logger.warning('DEPRECATED: Use "plugin" instead of "type"')
92
89 if not plugin_name:93 if not plugin_name:
90 raise PluginNotDefinedError94 raise PluginNotDefinedError
9195

Subscribers

People subscribed via source and target branches