def test_returns_True_when_not_ExternalProcessError(self): self.patch(ps_module, "call_and_check") running_in_container.cache_clear() self.assertTrue(running_in_container())
def test_returns_False_when_ExternalProcessError(self): mock_call = self.patch(ps_module, "call_and_check") mock_call.side_effect = ExternalProcessError( 1, ["systemd-detect-virt", "-c"], output="none") running_in_container.cache_clear() self.assertFalse(running_in_container())