diff --git a/.gitignore b/.gitignore index 2cb83eb..aae2eb0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *~ locale/* +__pycache__/ diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..8c5677c --- /dev/null +++ b/.travis.yml @@ -0,0 +1,7 @@ +language: python +python: + - "3.5" +before_install: + - sudo apt-get install -qq -y python3-gi gir1.2-gtk-3.0 +# command to run tests +script: python -m unittest diff --git a/BUILD/PKGBUILD b/BUILD/PKGBUILD index db4c9d7..fcc348c 100644 --- a/BUILD/PKGBUILD +++ b/BUILD/PKGBUILD @@ -17,7 +17,7 @@ package() { cp -a ui/* "${pkgdir}/usr/share/${_pkgname}" install -D -m644 ${_pkgname}.desktop ${pkgdir}/etc/skel/.config/autostart/${_pkgname}.desktop install -D -m644 ${_pkgname}.desktop ${pkgdir}/usr/share/applications/${_pkgname}.desktop - install -D -m755 "src/${_pkgname}.py" "${pkgdir}/usr/bin/${_pkgname}.py" + install -D -m755 "src/manjaro_hello.py" "${pkgdir}/usr/bin/manjaro_hello.py" cd "po" for lang in $(ls -1 | sed -e 's/\..*$//'); do if [ $lang != "manjaro-hello" ] diff --git a/launch.sh b/launch.sh index 5b3b67f..7e8430a 100644 --- a/launch.sh +++ b/launch.sh @@ -12,4 +12,4 @@ for lang in $(ls -1 | sed -e 's/\..*$//'); do fi done cd .. -python src/manjaro-hello.py +python src/manjaro_hello.py diff --git a/src/__init__.py b/src/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/manjaro-hello.py b/src/manjaro_hello.py similarity index 100% rename from src/manjaro-hello.py rename to src/manjaro_hello.py diff --git a/test/__init__.py b/test/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/test/test.json b/test/test.json new file mode 100644 index 0000000..83e795e --- /dev/null +++ b/test/test.json @@ -0,0 +1,3 @@ +{ + "test": "json" +} diff --git a/test/test.py b/test/test.py new file mode 100644 index 0000000..4fd6e36 --- /dev/null +++ b/test/test.py @@ -0,0 +1,16 @@ +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)