diff --git a/src/manjaro_hello.py b/src/manjaro_hello.py index 5c0dcad..db0900b 100644 --- a/src/manjaro_hello.py +++ b/src/manjaro_hello.py @@ -13,6 +13,8 @@ from gi.repository import Gtk, GdkPixbuf class ManjaroHello(): + """Manjaro-Hello""" + def __init__(self): # App vars self.app = "manjaro-hello" @@ -202,16 +204,16 @@ class ManjaroHello(): f.write(content.replace(i3_autostart, "#" + i3_autostart)) f.truncate() self.autostart = autostart - except OSError as e: - print(e) + except OSError as error: + print(error) def save_preferences(self): """Save preferences in config file.""" try: with open(self.preferences_path, "w") as f: json.dump(self.preferences, f) - except OSError as e: - print(e) + except OSError as error: + print(error) def get_preferences(self): """Read preferences from config file.""" @@ -300,12 +302,16 @@ def get_lsb_infos(): arg = arg[1:-1] if arg: lsb[var] = arg - except OSError as e: - print(e) + except OSError as error: + print(error) return lsb def read_json(path): + """Read content of a json file. + :return: json content + :rtype: str + """ try: with open(path, "r") as f: return json.load(f) diff --git a/test/__init__.py b/test/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/test/test.json b/test/test.json deleted file mode 100644 index 83e795e..0000000 --- a/test/test.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "test": "json" -} diff --git a/test/test.py b/test/test.py deleted file mode 100644 index c332866..0000000 --- a/test/test.py +++ /dev/null @@ -1,17 +0,0 @@ -import unittest - -from src import manjaro_hello - - -class ManjaroHello(unittest.TestCase): - def setUp(self): - self.path = "test/" - - def test_read_json(self): - json = manjaro_hello.read_json(self.path + "test.json") - self.assertEqual(json, {"test": "json"}) - json = manjaro_hello.read_json(self.path + "test") - self.assertEqual(json, None) - - def test_get_lsb_infos(self): - self.assertIsInstance(manjaro_hello.get_lsb_infos(), dict)