diff --git a/tests/unit/test_snap.py b/tests/unit/test_snap.py index 73256e68..d8c8ba8e 100644 --- a/tests/unit/test_snap.py +++ b/tests/unit/test_snap.py @@ -197,10 +197,10 @@ def __init__(self): class TestSnapCache(unittest.TestCase): + @patch.object(snap.SnapCache, "snapd_installed", new=False) def test_error_on_not_snapd_installed(self): - with patch.object(snap.SnapCache, "snapd_installed", new=False): - with self.assertRaises(snap.SnapError): - snap.SnapCache() + with self.assertRaises(snap.SnapError): + snap.SnapCache() @patch( "charms.operator_libs_linux.v2.snap.subprocess.check_output",