From aa731c429895280ad0be0588a2baa55876edf8e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Mon, 1 May 2023 16:31:26 +0200 Subject: [PATCH] [ytdl] run yt-dlp tests with latest code from master (#3989) Only use PyPI version for Python 3.6, since that's no longer supported by the current codebase. --- .github/workflows/tests.yml | 19 ++++++++++++++++--- gallery_dl/version.py | 2 +- test/test_ytdl.py | 11 ++++++++++- 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6f9b317f..a72761d4 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -26,13 +26,26 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install dependencies - env: - PYV: ${{ matrix.python-version }} run: | pip install -r requirements.txt pip install "flake8<4" "importlib-metadata<5" pip install youtube-dl - if [[ "$PYV" != "3.4" && "$PYV" != "3.5" ]]; then pip install yt-dlp; fi + + - name: Install yt-dlp + run: | + case "${{ matrix.python-version }}" in + 3.4|3.5) + # don't install yt-dlp + ;; + 3.6) + # install from PyPI + pip install yt-dlp + ;; + *) + # install from master + pip install https://github.com/yt-dlp/yt-dlp/archive/refs/heads/master.tar.gz + ;; + esac - name: Lint with flake8 run: | diff --git a/gallery_dl/version.py b/gallery_dl/version.py index d4ef532d..0f6b1dff 100644 --- a/gallery_dl/version.py +++ b/gallery_dl/version.py @@ -6,4 +6,4 @@ # it under the terms of the GNU General Public License version 2 as # published by the Free Software Foundation. -__version__ = "1.25.3" +__version__ = "1.25.4-dev" diff --git a/test/test_ytdl.py b/test/test_ytdl.py index 4c20f671..54fa467b 100644 --- a/test/test_ytdl.py +++ b/test/test_ytdl.py @@ -238,7 +238,7 @@ class Test_CommandlineArguments_YtDlp(Test_CommandlineArguments): @classmethod def setUpClass(cls): super().setUpClass() - if cls.module.version.__version__ > "2023.03.04": + if cls.module.version.__version__ > "2022.07.18": # last 3.6 release cls.test_geo_bypass = cls._test_geo_bypass_xff def test_retries_extractor(self): @@ -276,6 +276,15 @@ class Test_CommandlineArguments_YtDlp(Test_CommandlineArguments): }) def _test_geo_bypass_xff(self): + self._(["--xff", "default"], + "geo_bypass", "default") + self._(["--xff", "never"], + "geo_bypass", "never") + self._(["--xff", "EN"], + "geo_bypass", "EN") + self._(["--xff", "198.51.100.14/24"], + "geo_bypass", "198.51.100.14/24") + self._("--geo-bypass", "geo_bypass", "default") self._("--no-geo-bypass",