[Pkg-mpd-commits] [python-mpd] 101/262: test.py Use unittest2, if avaible.
Simon McVittie
smcv at debian.org
Sun May 22 18:16:30 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 203e4ba797da39b27ec25090299d94abbc12e5e2
Author: Jörg Thalheim <jthalheim at gmail.com>
Date: Fri Feb 17 15:03:44 2012 +0100
test.py Use unittest2, if avaible.
This adds compatibility for python2.6
---
test.py | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/test.py b/test.py
index 40c5b9e..01ea4d9 100755
--- a/test.py
+++ b/test.py
@@ -1,10 +1,22 @@
#!/usr/bin/env python
-import unittest
+
import types
from socket import error as SocketError
import sys
from mpd import MPDClient, CommandError, ConnectionError
+try:
+ # is required for python2.6
+ # python2.7 works with this module too
+ import unittest2 as unittest
+except ImportError:
+ # required for python3
+ # python2.7 works with this module too!
+ try:
+ import unittest
+ except ImportError:
+ print("Please install unittest2 from pypi to run tests!")
+
# Alternate this to your setup
# Make sure you have at least one song on your playlist
MPD_HOST = "localhost"
--
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