diff --git a/mpd/tests.py b/mpd/tests.py
index <HASH>..<HASH> 100755
--- a/mpd/tests.py
+++ b/mpd/tests.py
@@ -685,14 +685,13 @@ class TestMPDClient(unittest.TestCase):
 
 # MPD client tests which do not mock the socket, but rather replace it
 # with a real socket from a socket
+@unittest.skipIf(not hasattr(socket, "socketpair"),
+                     "Socketpair is not supported on this platform")
 class TestMPDClientSocket(unittest.TestCase):
 
     longMessage = True
 
     def setUp(self):
-        if not hasattr(socket, "socketpair"):
-            self.skipTest("Socketpair is not supported on this platform")
-
         self.connect_patch = mock.patch("mpd.MPDClient._connect_unix")
         self.connect_mock = self.connect_patch.start()
Use decorator for conditionally skipping socketpair tests