"""Tests for handling failed builds"""

from dxr.testing import SingleFileTestCase, CommandFailure


class BuildFailureTests(SingleFileTestCase):
    source = r"""A bunch of garbage"""

    @classmethod
    def setup_class(cls):
        """Make sure a failed build returns a non-zero status code."""
        try:
            super(BuildFailureTests, cls).setup_class()
        except CommandFailure:
            pass
        else:
            raise AssertionError('A failed build returned an exit code of 0.')

    def test_nothing(self):
        """A null test just to make the setup method run"""

Add a test that proves build_instance raises an exception if `make` (etc.) fails.
Add a test that proves build_instance raises an exception if `make` (etc.) fails.

From here, it's trivial to observe that dxr-build.py itself exits with a non-zero status code on build failure. Thus, our spurious deployment of a new instance even after the moz-central build failed must be the fault of a calling shell script or something.