From c6a8bea31edd9bf55ee2c617880801613de5cfa1 Mon Sep 17 00:00:00 2001
From: Thor77 <thor77@thor77.org>
Date: Mon, 5 Feb 2018 15:49:21 +0100
Subject: [PATCH] Add test for broken/invalid cachefile

---
 tsstats/tests/test_cache.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tsstats/tests/test_cache.py b/tsstats/tests/test_cache.py
index 0f24735..472f5b3 100644
--- a/tsstats/tests/test_cache.py
+++ b/tsstats/tests/test_cache.py
@@ -1,6 +1,7 @@
 # -*- coding: utf-8 -*-
 import os
 import shutil
+from pickle import UnpicklingError
 
 import pytest
 
@@ -64,6 +65,11 @@ def test_cache_needs_parsing(cache, tmpdir):
     assert cache.needs_parsing(tmplog_path)
 
 
+def test_cache_read_broken_file():
+    with pytest.raises(UnpicklingError):
+        Cache.read('tsstats/__init__.py')
+
+
 # INTEGRATION
 def test_cache_integration(cache_path):
     first_run = list(parse_logs(