[test_i18n] Handle normalized version by pip

This commit is contained in:
Yen Chi Hsuan 2016-01-17 19:31:49 +08:00
parent 8347b46331
commit fb1da6be36

View File

@ -20,7 +20,10 @@ rootDir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, rootDir)
from youtube_dl.version import __version__
from youtube_dl.compat import subprocess_check_output
from youtube_dl.compat import (
subprocess_check_output,
compat_str,
)
from youtube_dl.utils import (
decodeFilename,
get_subprocess_encoding,
@ -44,6 +47,15 @@ def ydl_path(venv_root):
return [sys.executable, os.path.join(venv_root, 'bin', 'youtube-dl')]
def normalized_version(ver):
try:
from pip._vendor import packaging
except ImportError:
return version
return compat_str(packaging.version.Version(ver))
class I18NTestCase(object):
@classmethod
def setUpClass(cls):
@ -98,7 +110,7 @@ class TestPipInstall(I18NTestCase, unittest.TestCase):
with chdir_to('test'):
subprocess.check_call([
'pip', 'install', '--quiet',
os.path.join('..', 'dist', 'youtube_dl-%s.tar.gz' % __version__)])
os.path.join('..', 'dist', 'youtube_dl-%s.tar.gz' % normalized_version(__version__))])
@classmethod
def uninstall(cls):