mirror of
				https://github.com/yt-dlp/yt-dlp.git
				synced 2025-10-30 22:25:19 +00:00 
			
		
		
		
	Add support for single-test tox runs
Use a sintax like
    tox test.test_download:TestDownload.test_NowVideo
to run the specific test on all the tox environments (Python versions)
			
			
This commit is contained in:
		
							
								
								
									
										0
									
								
								test/__init__.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								test/__init__.py
									
									
									
									
									
										Normal file
									
								
							| @@ -8,7 +8,7 @@ import os | |||||||
| sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) | sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) | ||||||
|  |  | ||||||
| from youtube_dl import YoutubeDL | from youtube_dl import YoutubeDL | ||||||
| from helper import try_rm | from .helper import try_rm | ||||||
|  |  | ||||||
|  |  | ||||||
| def _download_restricted(url, filename, age): | def _download_restricted(url, filename, age): | ||||||
|   | |||||||
| @@ -8,7 +8,7 @@ import os | |||||||
| sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) | sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) | ||||||
|  |  | ||||||
| from youtube_dl.extractor import YoutubeIE, YoutubePlaylistIE, YoutubeChannelIE, JustinTVIE, gen_extractors | from youtube_dl.extractor import YoutubeIE, YoutubePlaylistIE, YoutubeChannelIE, JustinTVIE, gen_extractors | ||||||
| from helper import get_testcases | from .helper import get_testcases | ||||||
|  |  | ||||||
| class TestAllURLsMatching(unittest.TestCase): | class TestAllURLsMatching(unittest.TestCase): | ||||||
|     def setUp(self): |     def setUp(self): | ||||||
|   | |||||||
| @@ -10,7 +10,7 @@ sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) | |||||||
|  |  | ||||||
| from youtube_dl.extractor import DailymotionIE | from youtube_dl.extractor import DailymotionIE | ||||||
| from youtube_dl.utils import * | from youtube_dl.utils import * | ||||||
| from helper import FakeYDL | from .helper import FakeYDL | ||||||
|  |  | ||||||
| md5 = lambda s: hashlib.md5(s.encode('utf-8')).hexdigest() | md5 = lambda s: hashlib.md5(s.encode('utf-8')).hexdigest() | ||||||
|  |  | ||||||
|   | |||||||
| @@ -37,8 +37,8 @@ def _file_md5(fn): | |||||||
|     with open(fn, 'rb') as f: |     with open(fn, 'rb') as f: | ||||||
|         return hashlib.md5(f.read()).hexdigest() |         return hashlib.md5(f.read()).hexdigest() | ||||||
|  |  | ||||||
| import helper  # Set up remaining global configuration | import test.helper as helper  # Set up remaining global configuration | ||||||
| from helper import get_testcases, try_rm | from .helper import get_testcases, try_rm | ||||||
| defs = get_testcases() | defs = get_testcases() | ||||||
|  |  | ||||||
| with io.open(PARAMETERS_FILE, encoding='utf-8') as pf: | with io.open(PARAMETERS_FILE, encoding='utf-8') as pf: | ||||||
|   | |||||||
| @@ -20,7 +20,7 @@ from youtube_dl.extractor import ( | |||||||
| ) | ) | ||||||
| from youtube_dl.utils import * | from youtube_dl.utils import * | ||||||
|  |  | ||||||
| from helper import FakeYDL | from .helper import FakeYDL | ||||||
|  |  | ||||||
| class TestPlaylists(unittest.TestCase): | class TestPlaylists(unittest.TestCase): | ||||||
|     def assertIsPlaylist(self, info): |     def assertIsPlaylist(self, info): | ||||||
|   | |||||||
| @@ -11,7 +11,7 @@ sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) | |||||||
| from youtube_dl.extractor import YoutubeUserIE, YoutubePlaylistIE, YoutubeIE, YoutubeChannelIE, YoutubeShowIE | from youtube_dl.extractor import YoutubeUserIE, YoutubePlaylistIE, YoutubeIE, YoutubeChannelIE, YoutubeShowIE | ||||||
| from youtube_dl.utils import * | from youtube_dl.utils import * | ||||||
|  |  | ||||||
| from helper import FakeYDL | from .helper import FakeYDL | ||||||
|  |  | ||||||
| class TestYoutubeLists(unittest.TestCase): | class TestYoutubeLists(unittest.TestCase): | ||||||
|     def assertIsPlaylist(self,info): |     def assertIsPlaylist(self,info): | ||||||
|   | |||||||
| @@ -10,7 +10,7 @@ sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) | |||||||
|  |  | ||||||
| from youtube_dl.extractor import YoutubeIE | from youtube_dl.extractor import YoutubeIE | ||||||
| from youtube_dl.utils import * | from youtube_dl.utils import * | ||||||
| from helper import FakeYDL | from .helper import FakeYDL | ||||||
|  |  | ||||||
| md5 = lambda s: hashlib.md5(s.encode('utf-8')).hexdigest() | md5 = lambda s: hashlib.md5(s.encode('utf-8')).hexdigest() | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										7
									
								
								tox.ini
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								tox.ini
									
									
									
									
									
								
							| @@ -1,5 +1,8 @@ | |||||||
| [tox] | [tox] | ||||||
| envlist = py26,py27,py33 | envlist = py26,py27,py33 | ||||||
| [testenv] | [testenv] | ||||||
| deps = nose | deps = | ||||||
| commands = nosetests --with-coverage --cover-package=youtube_dl --cover-html --verbose test |    nose | ||||||
|  |    coverage | ||||||
|  | commands = nosetests --verbose {posargs:test}  # --with-coverage --cover-package=youtube_dl --cover-html | ||||||
|  |                                                # test.test_download:TestDownload.test_NowVideo | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Filippo Valsorda
					Filippo Valsorda