Compare commits

..

No commits in common. "3566e35f21f3582255cd48bbc584d92cc4f4ac95" and "5222390c89f977c9cf3ac88795313b2318a06b03" have entirely different histories.

7 changed files with 21 additions and 14 deletions

View File

@ -58,4 +58,4 @@ jobs:
continue-on-error: False continue-on-error: False
run: | run: |
python3 -m yt_dlp -v || true # Print debug head python3 -m yt_dlp -v || true # Print debug head
python3 ./devscripts/run_tests.py core python3 -Werror ./devscripts/run_tests.py core

View File

@ -18,7 +18,7 @@ jobs:
run: pip install pytest -r requirements.txt run: pip install pytest -r requirements.txt
- name: Run tests - name: Run tests
continue-on-error: true continue-on-error: true
run: python3 ./devscripts/run_tests.py download run: python3 -Werror ./devscripts/run_tests.py download
full: full:
name: Full Download Tests name: Full Download Tests
@ -45,4 +45,4 @@ jobs:
run: pip install pytest -r requirements.txt run: pip install pytest -r requirements.txt
- name: Run tests - name: Run tests
continue-on-error: true continue-on-error: true
run: python3 ./devscripts/run_tests.py download run: python3 -Werror ./devscripts/run_tests.py download

View File

@ -19,7 +19,7 @@ jobs:
- name: Run tests - name: Run tests
run: | run: |
python3 -m yt_dlp -v || true python3 -m yt_dlp -v || true
python3 ./devscripts/run_tests.py core python3 -Werror ./devscripts/run_tests.py core
flake8: flake8:
name: Linter name: Linter
if: "!contains(github.event.head_commit.message, 'ci skip all')" if: "!contains(github.event.head_commit.message, 'ci skip all')"

View File

@ -189,16 +189,15 @@ After you have ensured this site is distributing its content legally, you can fo
'ext': 'mp4', 'ext': 'mp4',
# Then if the test run fails, it will output the missing/incorrect fields. # Then if the test run fails, it will output the missing/incorrect fields.
# Properties can be added as: # Properties can be added as:
# * A value, e.g. # * A value, e.g.:
# 'title': 'Video title goes here', # 'title': 'Video title goes here',
# * MD5 checksum; start the string with 'md5:', e.g. # * MD5 checksum; start the string with 'md5:', e.g.:
# 'description': 'md5:098f6bcd4621d373cade4e832627b4f6', # 'description': 'md5:098f6bcd4621d373cade4e832627b4f6',
# * A regular expression; start the string with 're:', e.g. # * A regular expression; start the string with 're:', e.g.:
# 'thumbnail': r're:^https?://.*\.jpg$', # 'thumbnail': r're:^https?://.*\.jpg$',
# * A count of elements in a list; start the string with 'count:', e.g. # * A count of elements in a list; start the string with 'count:', e.g.:
# 'tags': 'count:10', # 'tags': 'count:10',
# * Any Python type, e.g. # * Any Python type, e.g. int or float
# 'view_count': int,
} }
}] }]

View File

@ -1,4 +1,4 @@
@echo off @echo off
>&2 echo run_tests.bat is deprecated. Please use `devscripts/run_tests.py` instead >&2 echo run_tests.bat is deprecated. Please use `devscripts/run_tests.py` instead
python %~dp0run_tests.py %~1 python -Werror %~dp0run_tests.py %~1

View File

@ -6,6 +6,7 @@ import os
import re import re
import subprocess import subprocess
import sys import sys
import warnings
from pathlib import Path from pathlib import Path
@ -22,11 +23,14 @@ def parse_args():
def run_tests(*tests, pattern=None): def run_tests(*tests, pattern=None):
werror = ('error', None, Warning, None, 0) in warnings.filters
run_core = 'core' in tests or (not pattern and not tests) run_core = 'core' in tests or (not pattern and not tests)
run_download = 'download' in tests run_download = 'download' in tests
tests = list(map(fix_test_name, tests)) tests = list(map(fix_test_name, tests))
arguments = ['pytest', '-Werror', '--tb', 'short'] arguments = ['pytest', '--tb', 'short']
if werror:
arguments.append('-Werror')
if run_core: if run_core:
arguments.extend(['-m', 'not download']) arguments.extend(['-m', 'not download'])
elif run_download: elif run_download:
@ -44,7 +48,11 @@ def run_tests(*tests, pattern=None):
except FileNotFoundError: except FileNotFoundError:
pass pass
arguments = [sys.executable, '-Werror', '-m', 'unittest'] arguments = [sys.executable]
if werror:
arguments.append('-Werror')
arguments.extend(['-m', 'unittest'])
if run_core: if run_core:
print('"pytest" needs to be installed to run core tests', file=sys.stderr) print('"pytest" needs to be installed to run core tests', file=sys.stderr)
return return

View File

@ -1,4 +1,4 @@
#!/usr/bin/env sh #!/usr/bin/env sh
>&2 echo 'run_tests.sh is deprecated. Please use `devscripts/run_tests.py` instead' >&2 echo 'run_tests.sh is deprecated. Please use `devscripts/run_tests.py` instead'
python3 devscripts/run_tests.py "$1" python3 -Werror devscripts/run_tests.py "$1"