Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Add snapcraft examples to scaffold getting started examples #513
Conversation
|
Rebased on latest master changes |
|
mock doesn't behave the same between python 3.4 (travis CI) and 3.5 (xenial), seems we have to patch builtins to be compatible in 3.4, gave it a shot for Travis CI. |
|
ok, pushed and hoping this is the last time I had to rebase :) So, for now, we are now shipping (as per demand) the binary in the snapcraft package (it needs to be installed alongside snapcraft). Ship them the scaffolding get started with it. I still have hope to get it renamed from snapcraft-examples to "snapcraft learn", but that will be in another separated PR. Do you mind merging this please? I'm away for a couple of days, FYI |
|
Note Mark's comment on bug #1586137: "Let's call this |
didrocks
changed the title from
Add snapcraft-examples binary to scaffold getting started examples
to
Add snapcraft examples to scaffold getting started examples
May 30, 2016
elopio
reviewed
Jun 1, 2016
| @@ -67,7 +68,7 @@ def main(): | ||
| # them again. | ||
| argv = [sys.argv[0]] | ||
| argv.append('discover') | ||
| - argv.append('demos_tests') | ||
| + argv.append(os.path.dirname(__file__).split(os.path.sep)[-1]) |
elopio
reviewed
Jun 1, 2016
| +version: 0.1 | ||
| +summary: Hello World simple C app | ||
| +description: | | ||
| + This demo is intended to show how to build a C app |
didrocks
Jun 1, 2016
Contributor
Well, you can ignore the current examples directory, they are being renamed as "tour" and Mark is rewriting them.
elopio
reviewed
Jun 1, 2016
| + dest_dir = os.path.join(dest_dir, _SNAPCRAFT_TOUR_DIR) | ||
| + shutil.copytree(get_examplesdir(), dest_dir) | ||
| + | ||
| + print("Snapcraft tour initialized in {}.\n" |
elopio
Jun 1, 2016
Member
I think this should be logger.info, but we have some inconsistencies here in how to handle errors and messages in main. That's a bug for the next milestone.
|
This is great didrocks. For the tests, what if instead of having a demos_tests and examples_tests, we put them all in a user_tests dir or snaps_tests dir? |
|
I'm all for having just one single _tests directory. Let me try to play with this (have both under snaps_tests/ dir) and then, looping on the 2 subdirs to tests tour/ (replacing examples/) and demos/. Do you still want the CI target to be "examples" or should be replace it with "snaps"? I'll rebase on this, push Mark's current changes (so /!\ not to merge, and Mark did some changes in term of help text content in the same branch, so the diff will be a little bit larger…), rebasing on master and implementing the above change for pre-review. |
|
I'd like the ci target to have the same name of that new demos+tours tests directory. |
|
Excellent! I'll push something with both targets "examples" and "snaps" first, running the some run_snaps tests (to ensure we always run something and I can see I didn't make a booboo ;)). We can even land it, and then, once CI has migrated (when most of current PR are rebased on master to change the targets), do another PR to remove the "examples" target. I'll go for pushing the update today and will ping you :) |
|
If we land this tomorrow, can we update The move from |
|
Here we go, rebased on master and with changes to have demos_tests and tour_tests under the same directory. Seems that autopkgtest are down again. Examples tests run both the old demos_tests and snaps_tests and the result is: (Note that the docstring changes are comming directly from Mark's branch as this one includes his current modifications: https://github.com/markshuttle/snapcraft/commits/tour) |
sergiusens
reviewed
Jun 2, 2016
| + sys.path = [topdir] + sys.path | ||
| + | ||
| + | ||
| +if __name__ == '__main__': |
sergiusens
Jun 2, 2016
Collaborator
I thought this was supposed to be snapcraft tour (no - dash)
What is this for, I might be missing something?
didrocks
Jun 2, 2016
Contributor
It's me, this binary should be removed and is useless, I forgot to delete it. Pushing the removal right away
sergiusens
reviewed
Jun 2, 2016
| @@ -43,7 +43,7 @@ | ||
| 'snapcraft.plugins', | ||
| 'snapcraft.storeapi'], | ||
| package_data={'snapcraft.internal': ['manifest.txt']}, | ||
| - scripts=['bin/snapcraft'], | ||
| + scripts=['bin/snapcraft', 'bin/snapcraft-examples'], |
elopio
reviewed
Jun 2, 2016
| import os | ||
| import subprocess | ||
| -class ROSTestCase(demos_tests.ExampleTestCase): | ||
| +class ROSTestCase(snaps_tests.SnapsTestCase): | ||
| demo_dir = 'ros' |
|
demostests FAIL non-zero exit status 1 |
|
/usr/bin/python3: No module named demos_tests |
didrocks
and others
added some commits
May 24, 2016
|
There is one error in one of the tests, but they are failing anyway. Skipped in #544 |
|
Seems like the forked version is now passing tests (I have no idea about the bad system calls though, seems like an apparmor issue when trying echo?) |
|
retest this please (seems the autopkgtest issue was a transient failure, connection dropped) |
|
and everything pass! This branch should be good to merge, containing latest elopio's changes :) |
didrocks commentedMay 24, 2016
Adds unit and integration tests for it, reusing and making more generic all demos tests helper.
Note that first commit is on another PR (move examples to demos): ubuntu-core#506 which needs to be merged first for review clarity.
This one will then be followed up by one PR changing the url for eamples 05- to point to this repository, and as well for disabling the manual run_demos() additional run when the "example" target is selected once CI changes the runner script.