mirror of
https://github.com/darkzoul5/YoutubePlaylistSync.git
synced 2026-11-03 23:38:14 +02:00
ci/tests: simplify tests and workflows
This commit is contained in:
1 parent
17c2df3640
commit
8550203411
5 files changed
+16
-11
No files matched your search
@@ -17,6 +17,7 @@ jobs:
|
|||||||
INTEGRATION_TEST: '1'
|
INTEGRATION_TEST: '1'
|
||||||
# Used by the integration tests to locate ffmpeg reliably.
|
# Used by the integration tests to locate ffmpeg reliably.
|
||||||
FFMPEG_PATH: '/usr/bin/ffmpeg'
|
FFMPEG_PATH: '/usr/bin/ffmpeg'
|
||||||
|
TEST_PLAYLIST_URL: 'https://www.youtube.com/playlist?list=PLUmRr21IDW9WCW87FnbWAbIwwZHbf-lAz'
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
|
|||||||
@@ -3,9 +3,11 @@ name: Unit tests
|
|||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
push:
|
push:
|
||||||
branches: [ main ]
|
branches:
|
||||||
|
- main
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ main ]
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
@@ -22,14 +24,12 @@ jobs:
|
|||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
- name: Create venv and install project
|
- name: Install project
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
python3 -m venv .venv
|
|
||||||
. .venv/bin/activate
|
|
||||||
python -m pip install --upgrade pip
|
python -m pip install --upgrade pip
|
||||||
# Install project (editable) and test deps
|
# Install project (editable) and test deps
|
||||||
python -m pip install -e .[test] || python -m pip install -e .
|
python -m pip install -e .
|
||||||
python -m pip install pytest
|
python -m pip install pytest
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
@@ -37,5 +37,4 @@ jobs:
|
|||||||
PYTHONPATH: ${{ github.workspace }}
|
PYTHONPATH: ${{ github.workspace }}
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
. .venv/bin/activate
|
|
||||||
pytest -q
|
pytest -q
|
||||||
@@ -9,12 +9,14 @@ from src.app.core.sync.executor import ActionExecutor
|
|||||||
from src.app.core.sync.service import SyncService
|
from src.app.core.sync.service import SyncService
|
||||||
|
|
||||||
|
|
||||||
PLAYLIST_URL = "https://www.youtube.com/playlist?list=PLUmRr21IDW9WCW87FnbWAbIwwZHbf-lAz"
|
PLAYLIST_URL = os.getenv("TEST_PLAYLIST_URL")
|
||||||
|
|
||||||
|
|
||||||
def _require_integration():
|
def _require_integration():
|
||||||
if not os.getenv("INTEGRATION_TEST"):
|
if not os.getenv("INTEGRATION_TEST"):
|
||||||
pytest.skip("Set INTEGRATION_TEST=1 to enable real download tests")
|
pytest.skip("Set INTEGRATION_TEST=1 to enable real download tests")
|
||||||
|
if not PLAYLIST_URL:
|
||||||
|
pytest.skip("Set TEST_PLAYLIST_URL to enable real download tests")
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.integration
|
@pytest.mark.integration
|
||||||
|
|||||||
@@ -9,12 +9,14 @@ from src.app.core.sync.executor import ActionExecutor
|
|||||||
from src.app.core.sync.service import SyncService
|
from src.app.core.sync.service import SyncService
|
||||||
|
|
||||||
|
|
||||||
PLAYLIST_URL = "https://www.youtube.com/playlist?list=PLUmRr21IDW9WCW87FnbWAbIwwZHbf-lAz"
|
PLAYLIST_URL = os.getenv("TEST_PLAYLIST_URL")
|
||||||
|
|
||||||
|
|
||||||
def _require_integration():
|
def _require_integration():
|
||||||
if not os.getenv("INTEGRATION_TEST"):
|
if not os.getenv("INTEGRATION_TEST"):
|
||||||
pytest.skip("Set INTEGRATION_TEST=1 to enable real download tests")
|
pytest.skip("Set INTEGRATION_TEST=1 to enable real download tests")
|
||||||
|
if not PLAYLIST_URL:
|
||||||
|
pytest.skip("Set TEST_PLAYLIST_URL to enable real download tests")
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.integration
|
@pytest.mark.integration
|
||||||
|
|||||||
@@ -9,12 +9,14 @@ from src.app.core.sync.executor import ActionExecutor
|
|||||||
from src.app.core.sync.service import SyncService
|
from src.app.core.sync.service import SyncService
|
||||||
|
|
||||||
|
|
||||||
PLAYLIST_URL = "https://www.youtube.com/playlist?list=PLUmRr21IDW9WCW87FnbWAbIwwZHbf-lAz"
|
PLAYLIST_URL = os.getenv("TEST_PLAYLIST_URL")
|
||||||
|
|
||||||
|
|
||||||
def _require_integration():
|
def _require_integration():
|
||||||
if not os.getenv("INTEGRATION_TEST"):
|
if not os.getenv("INTEGRATION_TEST"):
|
||||||
pytest.skip("Set INTEGRATION_TEST=1 to enable real download tests")
|
pytest.skip("Set INTEGRATION_TEST=1 to enable real download tests")
|
||||||
|
if not PLAYLIST_URL:
|
||||||
|
pytest.skip("Set TEST_PLAYLIST_URL to enable real download tests")
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.integration
|
@pytest.mark.integration
|
||||||
@@ -55,4 +57,3 @@ def test_integration_download_video(tmp_path):
|
|||||||
video_dir = save_path / "video"
|
video_dir = save_path / "video"
|
||||||
assert video_dir.exists()
|
assert video_dir.exists()
|
||||||
assert any(p.suffix.lower() == ".mp4" for p in video_dir.glob("*.mp4"))
|
assert any(p.suffix.lower() == ".mp4" for p in video_dir.glob("*.mp4"))
|
||||||
|
|
||||||
Reference in new issue
Block a user