From f1e68ebaca1d0f3d593fa47ac8433368986abd56 Mon Sep 17 00:00:00 2001 From: Simon Quigley Date: Wed, 22 Jun 2016 01:31:45 -0500 Subject: [PATCH 1/8] Used Leo Arias' suggestion to fix bug 1574190 --- snapcraft/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snapcraft/main.py b/snapcraft/main.py index aa4f8e6bef0..5fce31229dc 100755 --- a/snapcraft/main.py +++ b/snapcraft/main.py @@ -206,7 +206,7 @@ def main(argv=None): if args['--debug']: raise - sys.exit(textwrap.fill(str(e))) + sys.exit(e) def _get_lifecycle_command(args): From 8d3d21ac879c1234f33b9854f5685842f8ea02f4 Mon Sep 17 00:00:00 2001 From: Simon Quigley Date: Wed, 22 Jun 2016 20:55:24 -0500 Subject: [PATCH 2/8] Made some tweaks that will hopefully fix the Travis tests --- snapcraft/main.py | 1 - snapcraft/tests/test_commands_cleanbuild.py | 8 ++++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/snapcraft/main.py b/snapcraft/main.py index d33452b64ed..d2acc8572c0 100755 --- a/snapcraft/main.py +++ b/snapcraft/main.py @@ -108,7 +108,6 @@ import shutil import sys import subprocess -import textwrap from docopt import docopt diff --git a/snapcraft/tests/test_commands_cleanbuild.py b/snapcraft/tests/test_commands_cleanbuild.py index c6090337dc1..265d6dc5ccb 100644 --- a/snapcraft/tests/test_commands_cleanbuild.py +++ b/snapcraft/tests/test_commands_cleanbuild.py @@ -110,7 +110,7 @@ def test_no_lxd(self, mock_installed): self.assertEqual( fake_logger.output, 'The lxd package is not installed, in order to use `cleanbuild` ' - 'you\nmust install lxd onto your system. Refer to the ' - '"Ubuntu Desktop and\nUbuntu Server" section on ' - 'https://linuxcontainers.org/lxd/getting-\nstarted-cli/' - '#ubuntu-desktop-and-ubuntu-server to enable a proper\nsetup.\n') + 'you must install lxd onto your system. Refer to the ' + '"Ubuntu Desktop and Ubuntu Server" section on ' + 'https://linuxcontainers.org/lxd/getting-started-cli/' + '#ubuntu-desktop-and-ubuntu-server to enable a proper setup.') From 5b010f178228f807b2877ffd82c27078b4b9619d Mon Sep 17 00:00:00 2001 From: Simon Quigley Date: Wed, 22 Jun 2016 23:59:09 -0500 Subject: [PATCH 3/8] Changed the wording of the change in main.py --- snapcraft/main.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/snapcraft/main.py b/snapcraft/main.py index d2acc8572c0..f2cfe5e3990 100755 --- a/snapcraft/main.py +++ b/snapcraft/main.py @@ -204,8 +204,9 @@ def main(argv=None): except Exception as e: if args['--debug']: raise - sys.exit(e) + logger.error(str(e)) + sys.exit(1) def _get_lifecycle_command(args): lifecycle_commands = ['pull', 'build', 'stage', 'prime'] From d910924a396838835a9a423dfb12dd0472d31dcd Mon Sep 17 00:00:00 2001 From: Simon Quigley Date: Mon, 27 Jun 2016 21:25:06 -0500 Subject: [PATCH 4/8] Added blank line where needed, removed uncalled subprocess import --- snapcraft/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snapcraft/main.py b/snapcraft/main.py index e83a3639b8b..52d41c83070 100755 --- a/snapcraft/main.py +++ b/snapcraft/main.py @@ -114,7 +114,6 @@ import pkgutil import shutil import sys -import subprocess from docopt import docopt @@ -208,6 +207,7 @@ def main(argv=None): logger.error(str(e)) sys.exit(1) + def _get_lifecycle_command(args): lifecycle_commands = ['pull', 'build', 'stage', 'prime'] lifecycle_command = [k for k in lifecycle_commands if args[k]] From 5cfcc2357721398a76b2fd19f82d42b707b0588c Mon Sep 17 00:00:00 2001 From: Simon Quigley Date: Mon, 27 Jun 2016 21:31:09 -0500 Subject: [PATCH 5/8] Fixed the test_no_lxd and test_topic_and_plugin_not_found_exits_with_tip unit tests --- snapcraft/tests/test_commands_cleanbuild.py | 2 +- snapcraft/tests/test_commands_help.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/snapcraft/tests/test_commands_cleanbuild.py b/snapcraft/tests/test_commands_cleanbuild.py index 265d6dc5ccb..b16b70c4f37 100644 --- a/snapcraft/tests/test_commands_cleanbuild.py +++ b/snapcraft/tests/test_commands_cleanbuild.py @@ -113,4 +113,4 @@ def test_no_lxd(self, mock_installed): 'you must install lxd onto your system. Refer to the ' '"Ubuntu Desktop and Ubuntu Server" section on ' 'https://linuxcontainers.org/lxd/getting-started-cli/' - '#ubuntu-desktop-and-ubuntu-server to enable a proper setup.') + '#ubuntu-desktop-and-ubuntu-server to enable a proper setup.\n') diff --git a/snapcraft/tests/test_commands_help.py b/snapcraft/tests/test_commands_help.py index 5d071d042c2..790be629782 100644 --- a/snapcraft/tests/test_commands_help.py +++ b/snapcraft/tests/test_commands_help.py @@ -48,7 +48,7 @@ def test_topic_and_plugin_not_found_exits_with_tip(self): self.assertEqual( fake_logger.output, 'The plugin does not exist. Run `snapcraft ' - 'list-plugins` to see the\navailable plugins.\n') + 'list-plugins` to see the available plugins.\n') @mock.patch('sys.stdout', new_callable=io.StringIO) def test_print_module_help_when_no_help_for_valid_plugin( From 99746bf41939d8a6c2fc63572203a0778e8035e1 Mon Sep 17 00:00:00 2001 From: Simon Quigley Date: Mon, 27 Jun 2016 21:35:08 -0500 Subject: [PATCH 6/8] Fixed test_error_with_unexistent_build_package (test_snap.SnapTestCase) fail (Integration tests) --- integration_tests/test_snap.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integration_tests/test_snap.py b/integration_tests/test_snap.py index 0e0480ec613..5c59b29d890 100644 --- a/integration_tests/test_snap.py +++ b/integration_tests/test_snap.py @@ -130,7 +130,7 @@ def test_error_with_unexistent_build_package(self): subprocess.CalledProcessError, self.run_snapcraft, 'snap') expected = ( "Could not find a required package in 'build-packages': " - '"The cache has\nno package named \'inexistent-package\'"\n') + '"The cache has no package named \'inexistent-package\'"\n') self.assertEqual(expected, exception.output) def test_snap_with_exposed_files(self): From 975a732470e0c64c533839f3f5f74fc09ebe367a Mon Sep 17 00:00:00 2001 From: Simon Quigley Date: Mon, 27 Jun 2016 22:46:58 -0500 Subject: [PATCH 7/8] Corrected unneeded line break in test_stage.StageTestCase.test_conflicts (Integration test) --- integration_tests/test_stage.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integration_tests/test_stage.py b/integration_tests/test_stage.py index 76f9f18f3e6..ce2d964bef4 100644 --- a/integration_tests/test_stage.py +++ b/integration_tests/test_stage.py @@ -32,5 +32,5 @@ def test_conflicts(self): self.assertEqual(1, exception.returncode) expected = ( "Parts 'p1' and 'p2' have the following file paths in common " - "which have\ndifferent contents: bin/test\n") + "which have different contents: bin/test\n") self.assertThat(exception.output, EndsWith(expected)) From cf96bb187fb1b5723f16061643c5ee0d906d7aa4 Mon Sep 17 00:00:00 2001 From: Simon Quigley Date: Tue, 28 Jun 2016 01:00:27 -0500 Subject: [PATCH 8/8] Fixes the build fail on test_stage.StageTestCase.test_conflicts (Integration test) --- integration_tests/test_stage.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integration_tests/test_stage.py b/integration_tests/test_stage.py index ce2d964bef4..986ab4ca087 100644 --- a/integration_tests/test_stage.py +++ b/integration_tests/test_stage.py @@ -32,5 +32,5 @@ def test_conflicts(self): self.assertEqual(1, exception.returncode) expected = ( "Parts 'p1' and 'p2' have the following file paths in common " - "which have different contents: bin/test\n") + "which have different contents:\nbin/test\n") self.assertThat(exception.output, EndsWith(expected))