[Pkg-mpd-commits] [python-mpd] 115/262: Imported Upstream version 0.4.1

Simon McVittie smcv at debian.org
Sun May 22 18:16:33 UTC 2016


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to branch upstream
in repository python-mpd.

commit f044e8dfa444a76ac00c1ec83012f0d8971695d3
Author: kaliko <efrim at azylum.org>
Date:   Tue Mar 20 12:46:57 2012 +0100

    Imported Upstream version 0.4.1
---
 CHANGES.txt |  7 +++++++
 README.md   |  3 ++-
 mpd.py      |  6 +++---
 setup.py    |  2 +-
 test.py     | 41 +++++++++++++++++++++++++++++++----------
 5 files changed, 44 insertions(+), 15 deletions(-)

diff --git a/CHANGES.txt b/CHANGES.txt
index adb8f30..d856b6f 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,6 +1,13 @@
 python-mpd2 Changes List
 =======================
 
+Changes in 0.4.1
+----------------
+
+* prio and prioid was spelled wrong
+* added config command
+* remove deprecated volume command
+
 Changes in 0.4.0
 ----------------
 
diff --git a/README.md b/README.md
index 406f82e..49aa853 100644
--- a/README.md
+++ b/README.md
@@ -9,7 +9,8 @@ Current features list:
 
  - python3 support (python2.6 is minimum python version required)
  - support for the upcoming client-to-client protocol
- - adding new commands of mpd (seekcur, prior, priorid)
+ - adding new commands of mpd v0.17 (seekcur, prio, prioid, config)
+ - remove of deprecated commands (volume)
  - methods are explicit declared now, so they are shown in ipython
  - add unit tests
  - documented API to add new commands (see Future Compatible)
diff --git a/mpd.py b/mpd.py
index 9a29c61..f319993 100644
--- a/mpd.py
+++ b/mpd.py
@@ -72,7 +72,6 @@ _commands = {
     "single":             "_fetch_nothing",
     "replay_gain_mode":   "_fetch_nothing",
     "replay_gain_status": "_fetch_item",
-    "volume":             "_fetch_nothing",
     # Playback Control Commands
     "next":               "_fetch_nothing",
     "pause":              "_fetch_nothing",
@@ -98,8 +97,8 @@ _commands = {
     "playlistsearch":     "_fetch_songs",
     "plchanges":          "_fetch_songs",
     "plchangesposid":     "_fetch_changes",
-    "prior":              "_fetch_nothing",
-    "priorid":            "_fetch_nothing",
+    "prio":               "_fetch_nothing",
+    "prioid":             "_fetch_nothing",
     "shuffle":            "_fetch_nothing",
     "swap":               "_fetch_nothing",
     "swapid":             "_fetch_nothing",
@@ -142,6 +141,7 @@ _commands = {
     "enableoutput":       "_fetch_nothing",
     "outputs":            "_fetch_outputs",
     # Reflection Commands
+    "config":             "_fetch_item",
     "commands":           "_fetch_list",
     "notcommands":        "_fetch_list",
     "tagtypes":           "_fetch_list",
diff --git a/setup.py b/setup.py
index c8e5b8d..3e083e4 100644
--- a/setup.py
+++ b/setup.py
@@ -36,7 +36,7 @@ along with python-mpd2.  If not, see <http://www.gnu.org/licenses/>.\
 
 setup(
     name="python-mpd2",
-    version="0.4.0",
+    version="0.4.1",
     description="A Python MPD client library",
     long_description=DESCRIPTION,
     author="J. Thalheim",
diff --git a/test.py b/test.py
index 5ff9ee5..442457e 100755
--- a/test.py
+++ b/test.py
@@ -1,9 +1,9 @@
 #!/usr/bin/env python
 
 import types
-from socket import error as SocketError
 import sys
-from mpd import MPDClient, CommandError, ConnectionError
+from socket import error as SocketError
+import mpd
 
 try:
     # is required for python2.6
@@ -27,18 +27,19 @@ MPD_PASSW = None
 class TestMPDClient(unittest.TestCase):
     @classmethod
     def setUpClass(self):
-        self.client = MPDClient()
-        self.idleclient = MPDClient()
+        self.client = mpd.MPDClient()
+        self.idleclient = mpd.MPDClient()
         try:
             self.client.connect(MPD_HOST, MPD_PORT)
             self.idleclient.connect(MPD_HOST, MPD_PORT)
-        except (ConnectionError, SocketError) as e:
+            self.commands = self.client.commands()
+        except (mpd.ConnectionError, SocketError) as e:
             raise Exception("Can't connect mpd! Start it or check the configuration: %s" % e)
         if MPD_PASSW != None:
             try:
                 self.client.password(MPD_PASSW)
                 self.idleclient.password(MPD_PASSW)
-            except CommandError as e:
+            except mpd.CommandError as e:
                 raise Exception("Fail to authenticate to mpd.")
     @classmethod
     def tearDownClass(self):
@@ -98,12 +99,12 @@ class TestMPDClient(unittest.TestCase):
         event = self.idleclient.fetch_idle()
         self.assertEqual(event, ['update'])
     def test_add_and_remove_command(self):
-        self.client.add_command("awesome command", MPDClient._fetch_nothing)
+        self.client.add_command("awesome command", mpd.MPDClient._fetch_nothing)
         self.assertTrue(hasattr(self.client, "awesome_command"))
         self.assertTrue(hasattr(self.client, "send_awesome_command"))
         self.assertTrue(hasattr(self.client, "fetch_awesome_command"))
         # should be unknown by mpd
-        with self.assertRaises(CommandError):
+        with self.assertRaises(mpd.CommandError):
             self.client.awesome_command()
         self.client.remove_command("awesome_command")
         self.assertFalse(hasattr(self.client, "awesome_command"))
@@ -129,10 +130,30 @@ class TestMPDClient(unittest.TestCase):
         self.assertNotIn("monty", channels)
 
     def test_connection_error(self):
-        client2 = MPDClient()
-        with self.assertRaises(ConnectionError) as cm:
+        client2 = mpd.MPDClient()
+        with self.assertRaises(mpd.ConnectionError) as cm:
             # should never return getaddrinfo
             client2.connect("255.255.255.255", 6600)
 
+    def test_commands_list(self):
+        """
+        Test if all implemented commands are valid
+        and all avaible commands are implemented.
+        This test may fail, if a implement command isn't
+        avaible on older versions of mpd
+        """
+        avaible_cmds = set(self.client.commands() + self.client.notcommands())
+        imple_cmds   = set(mpd._commands.keys())
+        sticker_cmds = set(["sticker get", "sticker set", "sticker delete",
+                        "sticker list", "sticker find"])
+        imple_cmds = (imple_cmds - sticker_cmds)
+        imple_cmds.add("sticker")
+        imple_cmds.remove("noidle")
+        self.assertFalse(avaible_cmds - imple_cmds,
+                         "Not all commands supported by mpd are implemented!")
+        long_desc = "Not all commands implemented by this library are supported by the current mpd.\n" + \
+                "This either means the command list is wrong or mpd is not up-to-date."
+        self.assertFalse(imple_cmds - avaible_cmds, long_desc)
+
 if __name__ == '__main__':
     unittest.main()

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mpd/python-mpd.git



More information about the Pkg-mpd-commits mailing list