From 1aee79da3e40f7d48211c484c818e37c736ef9ee Mon Sep 17 00:00:00 2001 From: Yen Chi Hsuan Date: Sun, 17 Jan 2016 16:58:38 +0800 Subject: [PATCH] [test_i18n] Correctly skip tests in non-virtualenv --- test/test_i18n.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/test/test_i18n.py b/test/test_i18n.py index e837bcf43..a0a488db5 100644 --- a/test/test_i18n.py +++ b/test/test_i18n.py @@ -77,10 +77,10 @@ class I18NTestCase(object): @unittest.skipUnless(os.environ.get('VIRTUAL_ENV'), 'Requires virtualenv because of call to pip install') class TestPipInstall(I18NTestCase, unittest.TestCase): - PROGRAM = os.path.join(os.environ['VIRTUAL_ENV'], 'bin', 'youtube-dl') - @classmethod def install(cls): + cls.PROGRAM = os.path.join(os.environ['VIRTUAL_ENV'], 'bin', 'youtube-dl') + with chdir_to('.'): subprocess.check_call([sys.executable, 'setup.py', '--quiet', 'sdist']) @@ -95,11 +95,12 @@ class TestPipInstall(I18NTestCase, unittest.TestCase): subprocess.check_call(['pip', 'uninstall', '--yes', 'youtube_dl']) +@unittest.skipUnless(os.environ.get('VIRTUAL_ENV'), 'Requires virtualenv because of call to setup.py install') class TestDirectInstall(I18NTestCase, unittest.TestCase): - PROGRAM = os.path.join(os.environ['VIRTUAL_ENV'], 'bin', 'youtube-dl') - @classmethod def install(cls): + cls.PROGRAM = os.path.join(os.environ['VIRTUAL_ENV'], 'bin', 'youtube-dl') + with chdir_to('.'): subprocess.check_call([sys.executable, 'setup.py', '--quiet', 'install'])