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
run: |
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
- name: Run tests
continue-on-error: true
run: python3 ./devscripts/run_tests.py download
run: python3 -Werror ./devscripts/run_tests.py download
full:
name: Full Download Tests
@ -45,4 +45,4 @@ jobs:
run: pip install pytest -r requirements.txt
- name: Run tests
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
run: |
python3 -m yt_dlp -v || true
python3 ./devscripts/run_tests.py core
python3 -Werror ./devscripts/run_tests.py core
flake8:
name: Linter
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',
# Then if the test run fails, it will output the missing/incorrect fields.
# Properties can be added as:
# * A value, e.g.
# * A value, e.g.:
# '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',
# * 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$',
# * 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',
# * Any Python type, e.g.
# 'view_count': int,
# * Any Python type, e.g. int or float
}
}]

View File

@ -1,4 +1,4 @@
@echo off
>&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 subprocess
import sys
import warnings
from pathlib import Path
@ -22,11 +23,14 @@ def parse_args():
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_download = 'download' in 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:
arguments.extend(['-m', 'not download'])
elif run_download:
@ -44,7 +48,11 @@ def run_tests(*tests, pattern=None):
except FileNotFoundError:
pass
arguments = [sys.executable, '-Werror', '-m', 'unittest']
arguments = [sys.executable]
if werror:
arguments.append('-Werror')
arguments.extend(['-m', 'unittest'])
if run_core:
print('"pytest" needs to be installed to run core tests', file=sys.stderr)
return

View File

@ -1,4 +1,4 @@
#!/usr/bin/env sh
>&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"