-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
149 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
import click | ||
|
||
from slow_start_rewatch.config import Config | ||
|
||
|
||
class App(object): | ||
"""The main application object.""" | ||
|
||
def __init__(self, config: Config) -> None: | ||
"""Initialize App.""" | ||
self.config = config | ||
|
||
def run(self) -> None: | ||
"""Runs the application.""" | ||
click.echo("Starting the Slow Start Rewatch...") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from typing import Optional | ||
|
||
|
||
class SlowStartRewatchException(Exception): | ||
"""An exception that slow_start_rewatch can handle.""" | ||
|
||
def __init__(self, message: str, hint: Optional[str] = None, exit_code=1): | ||
"""Initialize SlowStartRewatchException.""" | ||
super().__init__(message) | ||
self.message = message | ||
self.hint = hint | ||
self.exit_code = exit_code | ||
|
||
def __str__(self): | ||
"""Return string representation of the exception.""" | ||
return self.message |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
""" | ||
This module is used to provide configuration, fixtures, and plugins for pytest. | ||
It may be also used for extending doctest's context: | ||
1. https://docs.python.org/3/library/doctest.html | ||
2. https://docs.pytest.org/en/latest/doctest.html | ||
""" | ||
|
||
from dotty_dict import dotty | ||
|
||
from slow_start_rewatch.config import Config | ||
|
||
|
||
class MockConfig(Config): | ||
"""Simplified version of the Config class.""" | ||
|
||
def __init__(self, config_data=None) -> None: | ||
"""Initialize MockConfig.""" | ||
self.config = dotty(config_data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from slow_start_rewatch.app import App | ||
from tests.conftest import MockConfig | ||
|
||
|
||
def test_run_successfully(capsys): | ||
"""Test that the App runs.""" | ||
app = App(MockConfig()) | ||
app.run() | ||
captured = capsys.readouterr() | ||
|
||
assert "Slow Start" in captured.out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters