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

Proposed by Sergio Schvezov
Status: Merged
Approved by: Leo Arias
Approved revision: 151
Merged at revision: 141
Proposed branch: lp://qastaging/~sergiusens/snapcraft/validation
Merge into: lp://qastaging/~snappy-dev/snapcraft/core
Prerequisite: lp://qastaging/~sergiusens/snapcraft/meta-all-yaml
Diff against target: 551 lines (+394/-9)
9 files modified
debian/control (+3/-1)
integration-tests/data/local-plugin/snapcraft.yaml (+1/-0)
schema/snapcraft.yaml (+89/-0)
setup.py (+5/-2)
snapcraft/common.py (+11/-0)
snapcraft/dirs.py (+1/-0)
snapcraft/tests/__init__.py (+1/-0)
snapcraft/tests/test_yaml.py (+251/-6)
snapcraft/yaml.py (+32/-0)
To merge this branch: bzr merge lp://qastaging/~sergiusens/snapcraft/validation
Reviewer Review Type Date Requested Status
John Lenton (community) Approve
Leo Arias (community) Approve
Review via email: mp+269120@code.qastaging.launchpad.net

Commit message

Initial json schema support

Description of the change

I'm just not sure where to add the tests here, so please advise during the review :-)

To post a comment you must log in.
Revision history for this message
Leo Arias (elopio) wrote :

To test, I think you should encapsulate your additions to the Config.__init__ in a validate method. Then we can pass valid and invalid yamls to it.

Some comments in the diff.

Revision history for this message
Zygmunt Krynicki (zyga) wrote :

One more comment below

Revision history for this message
Sergio Schvezov (sergiusens) :
Revision history for this message
Leo Arias (elopio) wrote :

This is great. I left some IMO comments. The only one I feel strong about is splitting the tests in scenarios or subtests.

review: Needs Fixing
Revision history for this message
Sergio Schvezov (sergiusens) wrote :

Hey you asked me for subtests a lot and I had them added explained as in the documentation you linked to ;-)

Revision history for this message
Leo Arias (elopio) wrote :

how did I not see the subtests??? Sorry about that.
So the only thing that's missing is bumping the dependency to python3 (>= 3.4),

Revision history for this message
Leo Arias (elopio) :
review: Approve
Revision history for this message
John Lenton (chipaca) wrote :

LGTM. zOMGwtfbbqschemajsonyaml, but LGTM.

review: Approve
Revision history for this message
Leo Arias (elopio) wrote :

Once this lands, the guys from erle and spreed have to be notified about the new format, right?

Revision history for this message
Snappy Tarmac (snappydevtarmac) wrote :

The attempt to merge lp:~sergiusens/snapcraft/validation into lp:snapcraft failed. Below is the output from the failed tests.

wget -c http://0.0.0.0:39937/test.tar
cp --preserve=all -R zzz /tmp/tmpo5btu74v/parts/copy/install/zzz
cp --preserve=all -R src /tmp/tmpyoazun5w/parts/copy/install/dst
cp --preserve=all -R src /tmp/tmprwukoxqe/parts/copy/install/dir/dst

...........--2015-08-27 19:50:49-- http://0.0.0.0:39937/test.tar
Connecting to 0.0.0.0:39937... connected.
HTTP request sent, awaiting response... 200 OK
Length: 22 [text/html]
Saving to: ‘test.tar’

     0K 100% 4.74M=0s

2015-08-27 19:50:49 (4.74 MB/s) - ‘test.tar’ saved [22/22]

.E.................Warning: unable to find "test_relexepath" in the path
.............E
======================================================================
ERROR: snapcraft.tests.test_cmds (unittest.loader.ModuleImportFailure)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.4/unittest/case.py", line 57, in testPartExecutor
    yield
  File "/usr/lib/python3.4/unittest/case.py", line 574, in run
    testMethod()
  File "/usr/lib/python3.4/unittest/loader.py", line 32, in testFailure
    raise exception
ImportError: Failed to import test module: snapcraft.tests.test_cmds
Traceback (most recent call last):
  File "/usr/lib/python3.4/unittest/loader.py", line 312, in _find_tests
    module = self._get_module_from_name(name)
  File "/usr/lib/python3.4/unittest/loader.py", line 290, in _get_module_from_name
    __import__(name)
  File "/tmp/tarmac/branch.04EPnA/snapcraft/tests/test_cmds.py", line 24, in <module>
    from snapcraft import (
  File "/tmp/tarmac/branch.04EPnA/snapcraft/cmds.py", line 27, in <module>
    import snapcraft.yaml
  File "/tmp/tarmac/branch.04EPnA/snapcraft/yaml.py", line 21, in <module>
    import jsonschema
ImportError: No module named 'jsonschema'

======================================================================
ERROR: snapcraft.tests.test_yaml (unittest.loader.ModuleImportFailure)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.4/unittest/case.py", line 57, in testPartExecutor
    yield
  File "/usr/lib/python3.4/unittest/case.py", line 574, in run
    testMethod()
  File "/usr/lib/python3.4/unittest/loader.py", line 32, in testFailure
    raise exception
ImportError: Failed to import test module: snapcraft.tests.test_yaml
Traceback (most recent call last):
  File "/usr/lib/python3.4/unittest/loader.py", line 312, in _find_tests
    module = self._get_module_from_name(name)
  File "/usr/lib/python3.4/unittest/loader.py", line 290, in _get_module_from_name
    __import__(name)
  File "/tmp/tarmac/branch.04EPnA/snapcraft/tests/test_yaml.py", line 17, in <module>
    import jsonschema
ImportError: No module named 'jsonschema'

----------------------------------------------------------------------
Ran 44 tests in 1.155s

FAILED (errors=2)

Revision history for this message
Sergio Schvezov (sergiusens) wrote :

On Thu, Aug 27, 2015 at 4:47 PM, Leo Arias <email address hidden> wrote:

> Once this lands, the guys from erle and spreed have to be notified about
> the new format, right?

I've disabled daily builds for now

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches