forked from noahgift/python-devops-course
-
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
4 changed files
with
25 additions
and
19 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,13 @@ | ||
setup: | ||
python3 -m venv ~/.myrepo | ||
|
||
install: | ||
pip install --upgrade pip &&\ | ||
pip install -r requirements.txt | ||
|
||
test: | ||
#python -m pytest test_gcli.py | ||
python -m pytest -vv --cov=gcli test_gcli.py | ||
python -m pytest -vv --cov=helloclick test_helloclick.py | ||
#python -m pytest --nbval notebook.ipynb | ||
|
||
|
||
lint: | ||
pylint --disable=R,C gcli.py hello-click.py | ||
pylint --disable=R,C,E1120 helloclick.py | ||
|
||
all: install lint test |
This file was deleted.
Oops, something went wrong.
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,15 @@ | ||
import click | ||
|
||
#var= | ||
|
||
@click.command() | ||
@click.option("--phrase", prompt="Enter a phrase", | ||
help="Phase in a phrase to tokenize: i.e. The Whale is large") | ||
def tokenize(phrase): | ||
"""This is a commandline tool that tokenizes phrases""" | ||
|
||
click.echo(f"tokenized phrase: {phrase.split()}") | ||
|
||
if __name__ == "__main__": | ||
tokenize() | ||
|
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,8 @@ | ||
from click.testing import CliRunner | ||
from helloclick import tokenize | ||
|
||
def test_helloclick(): | ||
runner = CliRunner() | ||
result = runner.invoke(tokenize, ['--phrase', 'The Whale is large']) | ||
assert result.exit_code == 0 | ||
assert 'Whale' in result.output |