Skip to content
This repository has been archived by the owner on May 15, 2019. It is now read-only.

Commit

Permalink
Add Travis CI, coverage to tests and basic MakefileSigned-off-by: Owe…
Browse files Browse the repository at this point in the history
…n McGill <mcgillowen@gmail.com>
  • Loading branch information
mcgillowen committed Oct 28, 2018
1 parent 2192ff7 commit a8d9964
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 4 deletions.
9 changes: 9 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
language: python
python:
- 3.7
before_install:
- pip install poetry
install:
- poetry install
script:
- make test
13 changes: 13 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.PHONY: test clean

test:
poetry run pytest --cov=devenv tests

clean:
find . -type f -name '*.py[co]' -delete -o -type d -name __pycache__ -delete

install:
poetry install

install_poetry: install
curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py | python
24 changes: 23 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ pylint = "^2.1"
pydocstyle = "^3.0"
pytest = "^3.9"
ipython = "^7.1"
pytest-cov = "^2.6"

[build-system]
requires = ["poetry>=0.12"]
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@ class TestFROM(object):
]

@pytest.mark.parametrize("params, result", CORRECT_PARAMS)
def passes_with_correct_params(self, params: dict, result: str):
def test_passes_with_correct_params(self, params: dict, result: str):
"""Test that FROM doesn't fail with correct params."""
cmd = commands.From(**params)
assert str(cmd) == result

def raises_error_with_tag_and_digest(self):
def test_raises_error_with_tag_and_digest(self):
"""Test that FROM raises a RuntimeError when both tag and digest are given."""
with pytest.raises(RuntimeError):
commands.From(base_image="test_image", tag="stable", digest="6dae7")

def raises_error_with_no_base_image(self):
def test_raises_error_with_no_base_image(self):
"""Test that FROM raises a TypeError when no base_image is provided."""
with pytest.raises(TypeError) as exc:
commands.From()
Expand Down

0 comments on commit a8d9964

Please sign in to comment.