Reenable tour command #559

Merged
merged 7 commits into from Jun 9, 2016

Conversation

Projects
None yet
4 participants
Contributor

didrocks commented Jun 9, 2016

Reenable "snapcraft tour" command with tests.

Added a small logic enhancements backed up with tests to ensure we don't nest default directory inside each other for multiple commands run.

didrocks added some commits Jun 9, 2016

Reenable "tour" command
Now that we will have the finale "tour" example, reenable the tour command
and related tests.
Avoid creating snapcraft-tour/snapcraft-… in loop
When launching multiple time the command, as we could have a destination
path where we either dump the code or create a snapcraft-tour subdirectory
if it exists, multiple snapcraft tour command would create a snapcraft-tour
folded hierarchy.

To avoid that, if we didn't specify any parameter, only try to create a
snapcraft-tour subdir and don't nest under it. Added a test for that.
Prettify the path print now that default is ./snapcraft-tour/
Better output for the user when the path is joined to a prefix
(printing /tmp/foo/snapcraft-tour instead of /tmp/foo/./snapcraft-tour/).
Default without argument is still, as requested, ./snapcraft-tour/
Contributor

didrocks commented Jun 9, 2016

retest this please

Contributor

fgimenez commented Jun 9, 2016

retest this please

Contributor

fgimenez commented Jun 9, 2016

retest this please

snapcraft/tests/test_tour.py
def tearDown(self):
with suppress(OSError):
if self.temp_dir:
shutil.rmtree(self.temp_dir)
+ os.chdir(self.cwd)
@elopio

elopio Jun 9, 2016

Member

I missed this in the previous review.
We have a fixture for tmp cwd, which also works as a tempdir. Maybe you can replace your set up and tear down with that fixture, or inherit from the base test case.

@didrocks

didrocks Jun 9, 2016

Contributor

Oh, I didn't see that base class add that fixture, indeed, using this and preventing creating other temp directory when that makes sense for the tests.

Member

elopio commented Jun 9, 2016

all the commands need at least one integration test. That's not a blocker for this branch, but a blocker for releasing it. As always, I'm available to help.

didrocks added some commits Jun 9, 2016

Use base class cwd function
Only create temporary dir and file when needed. Otherwise, use temporary
cwd.
Add integration tests for the tour command
Support basics test case for the command itself. Don't repeat all edge cases
covered in unit tests already.
Contributor

didrocks commented Jun 9, 2016

pushed the base class changes + integration tests for the tour command.

As told on IRC, I didn't find all other commands beeing tested there, so I took the libery to create a new file for this command only and support 3 main tests cases. All other edge cases (copying to a directory which already has content, copying over a file…) are covered in unit tests.

+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+import integration_tests
+import os
@elopio

elopio Jun 9, 2016

Member

first import os, then an empty line, then integration_tests

Member

elopio commented Jun 9, 2016

💯 Full unit coverage, and integration tests for the main cases, thank you!

Collaborator

sergiusens commented Jun 9, 2016

retest this please

@sergiusens sergiusens merged commit cadeb87 into snapcore:master Jun 9, 2016

4 checks passed

Examples tests Success
Details
autopkgtest Success
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage increased (+0.1%) to 95.798%
Details

kalikiana pushed a commit to kalikiana/snapcraft that referenced this pull request Apr 6, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment