always have working directory with entry
This commit is contained in:
parent
12e0c5b84d
commit
b69c45adbd
4 changed files with 4 additions and 14 deletions
|
|
@ -1,7 +1,6 @@
|
||||||
from abc import ABC
|
from abc import ABC
|
||||||
from typing import Any
|
from typing import Any
|
||||||
from typing import Dict
|
from typing import Dict
|
||||||
from typing import Optional
|
|
||||||
|
|
||||||
|
|
||||||
class BaseEntry(ABC):
|
class BaseEntry(ABC):
|
||||||
|
|
@ -9,7 +8,7 @@ class BaseEntry(ABC):
|
||||||
Abstract entry object to represent anything download from ytdl (playlist metadata, media, etc).
|
Abstract entry object to represent anything download from ytdl (playlist metadata, media, etc).
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, entry_dict: Dict, working_directory: Optional[str] = None):
|
def __init__(self, entry_dict: Dict, working_directory: str):
|
||||||
"""
|
"""
|
||||||
Initialize the entry using ytdl metadata
|
Initialize the entry using ytdl metadata
|
||||||
|
|
||||||
|
|
@ -38,14 +37,5 @@ class BaseEntry(ABC):
|
||||||
Returns
|
Returns
|
||||||
-------
|
-------
|
||||||
The working directory
|
The working directory
|
||||||
|
|
||||||
Raises
|
|
||||||
------
|
|
||||||
ValueError
|
|
||||||
The working directory was never defined in the init
|
|
||||||
"""
|
"""
|
||||||
if self._working_directory is None:
|
|
||||||
raise ValueError(
|
|
||||||
"Entry working directory is not set when trying to access its download file path"
|
|
||||||
)
|
|
||||||
return self._working_directory
|
return self._working_directory
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,7 @@ def mock_entry_kwargs(
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def mock_entry(mock_entry_kwargs):
|
def mock_entry(mock_entry_kwargs):
|
||||||
return Entry(entry_dict=mock_entry_kwargs)
|
return Entry(entry_dict=mock_entry_kwargs, working_directory=".")
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ def mock_soundcloud_track_kwargs(mock_entry_kwargs, url):
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def mock_soundcloud_track(mock_soundcloud_track_kwargs):
|
def mock_soundcloud_track(mock_soundcloud_track_kwargs):
|
||||||
return SoundcloudTrack(entry_dict=mock_soundcloud_track_kwargs)
|
return SoundcloudTrack(entry_dict=mock_soundcloud_track_kwargs, working_directory=".")
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ def mock_youtube_video_kwargs(
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def mock_youtube_video(mock_youtube_video_kwargs):
|
def mock_youtube_video(mock_youtube_video_kwargs):
|
||||||
return YoutubeVideo(entry_dict=mock_youtube_video_kwargs)
|
return YoutubeVideo(entry_dict=mock_youtube_video_kwargs, working_directory=".")
|
||||||
|
|
||||||
|
|
||||||
class TestYoutubeVideo(object):
|
class TestYoutubeVideo(object):
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue