1
0
Fork 0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-03-09 12:50:23 -05:00

Remove test/devscripts/test_install_deps.py as it duplicates functionality in wlb/optional_deps branch

This commit is contained in:
Wilson Bilkovich 2025-03-09 03:59:58 -04:00
parent 1e7c02ca48
commit 13d72c5762
2 changed files with 0 additions and 62 deletions

View file

@ -1,62 +0,0 @@
import os
import sys
import unittest
from unittest import mock
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
from devscripts import install_deps
class TestInstallDeps(unittest.TestCase):
@mock.patch('devscripts.install_deps.parse_toml')
@mock.patch('devscripts.install_deps.read_file')
@mock.patch('devscripts.install_deps.subprocess.call')
def test_print_option(self, mock_call, mock_read_file, mock_parse_toml):
# Mock the parse_toml function to return a project table with dependencies
mock_parse_toml.return_value = {
'project': {
'name': 'yt-dlp',
'dependencies': ['dep1', 'dep2'],
'optional-dependencies': {
'default': ['opt1', 'opt2'],
'test': ['test1', 'test2'],
'dev': ['dev1', 'dev2'],
},
},
}
# Mock sys.argv to simulate command line arguments
with mock.patch('sys.argv', ['install_deps.py', '--print']):
# Redirect stdout to capture the output
from io import StringIO
import sys
original_stdout = sys.stdout
try:
output = StringIO()
sys.stdout = output
# Execute the main function
install_deps.main()
# Get the captured output
printed_deps = output.getvalue().strip().split('\n')
# Check that default dependencies are included
# 2 from dependencies + default dependencies
self.assertEqual(len(printed_deps), 4)
self.assertIn('dep1', printed_deps)
self.assertIn('dep2', printed_deps)
self.assertIn('opt1', printed_deps)
self.assertIn('opt2', printed_deps)
finally:
sys.stdout = original_stdout
# Call was not made because we used --print
mock_call.assert_not_called()
if __name__ == '__main__':
unittest.main()