-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
conftest.py
63 lines (45 loc) · 1.33 KB
/
conftest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import os
import sys
import pytest
from nowplaying.show.show import Show
from nowplaying.track.observers.base import TrackObserver
from nowplaying.track.track import Track
PACKAGE_PARENT = "nowplaying"
SCRIPT_DIR = os.path.dirname(
os.path.realpath(os.path.join(os.getcwd(), os.path.expanduser(__file__)))
)
sys.path.append(os.path.normpath(os.path.join(SCRIPT_DIR, PACKAGE_PARENT)))
def new_show(name="Hairmare Traveling Medicine Show"):
s = Show()
s.set_name("Hairmare Traveling Medicine Show")
return s
@pytest.fixture()
def show_factory():
"""Return a method to help creating new show objects for tests."""
return new_show
def new_track(
artist="Hairmare and the Band",
title="An Ode to legacy Python Code",
album="Live at the Refactoring Club",
duration=128,
):
t = Track()
t.set_artist(artist)
t.set_title(title)
t.set_album(album)
t.set_duration(duration)
return t
@pytest.fixture()
def track_factory():
"""Return a method to help creating new track objects for tests."""
return new_track
class DummyObserver(TrackObserver):
"""Shunt class for testing the abstract TrackObserver."""
pass
def track_started(self, track):
pass
def track_finished(self, track):
pass
@pytest.fixture()
def dummy_observer():
return DummyObserver()