Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cli: disable raven if not running from package #2503

Merged
merged 2 commits into from
Mar 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion snapcraft/cli/_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def exception_handler( # noqa: C901
is_snapcraft_reportable_error = issubclass(
exception_type, errors.SnapcraftReportableError
)
is_raven_setup = RavenClient is not None
is_raven_setup = snapcraft.internal.common.is_snap()
is_connected_to_tty = (
# used by inner instance, variable set by outer instance
(distutils.util.strtobool(os.getenv("SNAPCRAFT_HAS_TTY", "n")) == 1)
Expand Down
7 changes: 5 additions & 2 deletions tests/unit/cli/test_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import snapcraft.internal.errors
from snapcraft.internal.build_providers.errors import ProviderExecError
from snapcraft.cli._errors import exception_handler
from tests import unit
from tests import fixture_setup, unit


class TestSnapcraftError(snapcraft.internal.errors.SnapcraftError):
Expand All @@ -47,6 +47,8 @@ class ErrorsBaseTestCase(unit.TestCase):
def setUp(self):
super().setUp()

self.useFixture(fixture_setup.FakeSnapcraftIsASnap())

patcher = mock.patch("sys.exit")
self.exit_mock = patcher.start()
self.addCleanup(patcher.stop)
Expand Down Expand Up @@ -98,8 +100,9 @@ def setUp(self):
super().setUp()

@mock.patch.object(snapcraft.cli._errors, "RavenClient")
@mock.patch("snapcraft.internal.common.is_snap", return_value=False)
def test_handler_no_raven_traceback_non_snapcraft_exceptions_debug(
self, raven_client_mock
self, is_snap_mock, raven_client_mock
):
snapcraft.cli._errors.RavenClient = None
try:
Expand Down