Compare commits

..

2 Commits

Author SHA1 Message Date
Simon Sawicki
3566e35f21
Default to -Werror 2023-12-26 12:24:28 +01:00
pukkandan
999023e701
type example 2023-12-26 10:17:18 +05:30
7 changed files with 14 additions and 21 deletions

View File

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

View File

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

View File

@ -189,15 +189,16 @@ 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. int or float
# * Any Python type, e.g.
# 'view_count': int,
}
}]

View File

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

View File

@ -6,7 +6,6 @@ import os
import re
import subprocess
import sys
import warnings
from pathlib import Path
@ -23,14 +22,11 @@ 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', '--tb', 'short']
if werror:
arguments.append('-Werror')
arguments = ['pytest', '-Werror', '--tb', 'short']
if run_core:
arguments.extend(['-m', 'not download'])
elif run_download:
@ -48,11 +44,7 @@ def run_tests(*tests, pattern=None):
except FileNotFoundError:
pass
arguments = [sys.executable]
if werror:
arguments.append('-Werror')
arguments.extend(['-m', 'unittest'])
arguments = [sys.executable, '-Werror', '-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 -Werror devscripts/run_tests.py "$1"
python3 devscripts/run_tests.py "$1"