You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
yt-dlp/test
Wilson Bilkovich 1e7c02ca48 [test] Add code coverage framework
Implement a comprehensive test coverage framework that integrates with pytest-cov
to generate code coverage reports for the yt-dlp codebase. Key components:

- Configuration file (.coveragerc) with appropriate include/exclude patterns
- Helper script (run_coverage.py) with parallel report generation
- GitHub Actions workflow for automatic coverage reporting on PRs and pushes
- Support for Hatch testing environment and CLI integration
- Testing documentation for running coverage reports
- Sample test for demonstrating coverage reporting
2 months ago
..
devscripts [test] Add code coverage framework 2 months ago
testdata [core] Load plugins on demand (#11305) 2 months ago
README.md [test] Add code coverage framework 2 months ago
__init__.py Add support for single-test tox runs 12 years ago
conftest.py [cleanup] Add more ruff rules (#10149) 11 months ago
helper.py [test] Show all differences for `expect_value` and `expect_dict` (#12334) 2 months ago
parameters.json [cleanup] Misc 2 years ago
test_InfoExtractor.py Fix `--netrc` empty string parsing for Python <=3.10 (#11414) 6 months ago
test_YoutubeDL.py [core] Load plugins on demand (#11305) 2 months ago
test_YoutubeDLCookieJar.py [cleanup] Misc fixes 2 years ago
test_aes.py [cleanup] Deprecate more compat functions (#11439) 5 months ago
test_age_restriction.py Update to ytdl-commit-2dd6c6e 2 years ago
test_all_urls.py [cleanup] Consistent style for file heads 3 years ago
test_cache.py [cleanup] Consistent style for file heads 3 years ago
test_compat.py [cleanup] Deprecate more compat functions (#11439) 5 months ago
test_config.py [cleanup] Add more ruff rules (#10149) 11 months ago
test_cookies.py [cookies] Support chrome table version 24 (#11425) 6 months ago
test_download.py [test:download] Raise on network errors (#10283) 10 months ago
test_downloader_external.py [fd/external] Fix ffmpeg input from stdin (#7655) 2 years ago
test_downloader_http.py [cleanup] Deprecate more compat functions (#11439) 5 months ago
test_execution.py [docs] Misc Cleanup (#8977) 1 year ago
test_http_proxy.py [cleanup] Add more ruff rules (#10149) 11 months ago
test_iqiyi_sdk_interpreter.py [cleanup] Add more ruff rules (#10149) 11 months ago
test_jsinterp.py [jsinterp] Improve zeroise (#12313) 2 months ago
test_netrc.py [cleanup] Add more ruff rules (#10149) 11 months ago
test_networking.py [networking] Add `keep_header_casing` extension (#11652) 2 months ago
test_networking_utils.py [cleanup] Add more ruff rules (#10149) 11 months ago
test_overwrites.py [cleanup] Add more ruff rules (#10149) 11 months ago
test_plugins.py [core] Load plugins on demand (#11305) 2 months ago
test_post_hooks.py [cleanup] Add more ruff rules (#10149) 11 months ago
test_postprocessors.py [cleanup] Add more ruff rules (#10149) 11 months ago
test_socks.py [rh:websockets] Support websockets 14.0+ (#11616) 5 months ago
test_subtitles.py [cleanup] Add more ruff rules (#10149) 11 months ago
test_traversal.py [utils] `subs_list_to_dict`: Add `lang` default parameter (#11508) 5 months ago
test_update.py Remove Python 3.8 support (#11321) 6 months ago
test_utils.py [networking] Add `keep_header_casing` extension (#11652) 2 months ago
test_verbose_output.py [cleanup] Consistent style for file heads 3 years ago
test_websockets.py [networking] Add `keep_header_casing` extension (#11652) 2 months ago
test_write_annotations.py.disabled [cleanup] Consistent style for file heads 3 years ago
test_youtube_lists.py [extractor/youtube:tab] Update tab handling for redesign (#5439) 2 years ago
test_youtube_misc.py [cleanup] Add more ruff rules (#10149) 11 months ago
test_youtube_signature.py [jsinterp] Improve zeroise (#12313) 2 months ago
testcert.pem Add a test for --no-check-certificate 10 years ago

README.md

yt-dlp Tests

This directory contains tests for the yt-dlp codebase.

Running Tests

Using hatch (requires pip install hatch)

# Run tests for a specific test file
hatch run hatch-test:run test/test_utils.py

# Run a specific test class or method
hatch run hatch-test:run test/test_utils.py::TestUtil
hatch run hatch-test:run test/test_utils.py::TestUtil::test_url_basename

# Run with verbosity
hatch run hatch-test:run -- test/test_utils.py -v

Using pytest directly

# Run a specific test file
python -m pytest test/test_utils.py

# Run a specific test class or method
python -m pytest test/test_utils.py::TestUtil
python -m pytest test/test_utils.py::TestUtil::test_url_basename

# Run with verbosity
python -m pytest -v test/test_utils.py

Important: Always run tests from the project root directory, not from a subdirectory.

Code Coverage

For information on running tests with code coverage, see the documentation in .coverage-reports/README.md.