Skip to content

Commit

Permalink
Merge pull request #17 from adambullmer/pipenv
Browse files Browse the repository at this point in the history
Convert to pipenv
  • Loading branch information
adambullmer authored Dec 10, 2018
2 parents cce661f + cbe482e commit 6f67629
Show file tree
Hide file tree
Showing 13 changed files with 654 additions and 22 deletions.
32 changes: 32 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
defaults: &defaults
working_directory: ~/sublime_ansible_vault
docker:
- image: circleci/python:3.4

version: 2
jobs:
test:
<< : *defaults
steps:
- checkout
- run:
name: install pipenv
command: pip install pipenv
- run:
name: install dependencies
command: |
pipenv install
pipenv install --dev
- run:
name: run tests
command: pipenv run tox
- store_artifacts:
path: pytest
- store_test_results:
path: pytest

workflows:
version: 2
test:
jobs:
- test
5 changes: 5 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[run]
omit =
*/__main__.py
tests/*
__init__.py
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ nosetests.xml
coverage.xml
*,cover
.hypothesis/
pytest/

# Translations
*.mo
Expand Down
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.4.3
19 changes: 19 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]
tox = "*"
flake8 = "*"
pytest = "*"
pytest-cov = "*"
pytest-sugar = "*"
pydocstyle = "*"
codecov = "*"

[packages]
ansible = "==2.2.3"

[requires]
python_version = "3.4"
521 changes: 521 additions & 0 deletions Pipfile.lock

Large diffs are not rendered by default.

Empty file added __init__.py
Empty file.
15 changes: 0 additions & 15 deletions circle.yml

This file was deleted.

Empty file added tests/.env
Empty file.
Empty file added tests/__init__.py
Empty file.
32 changes: 32 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
from unittest.mock import MagicMock, patch
import pytest


@pytest.fixture(autouse=True)
def sublime(request):
mock = MagicMock()
patcher = patch.dict('sys.modules', {
'sublime': mock,
})
patcher.start()
request.addfinalizer(patcher.stop)

return mock


@pytest.fixture(autouse=True)
def sublime_plugin(request):
mock = MagicMock()
patcher = patch.dict('sys.modules', {
'sublime_plugin': mock,
})
patcher.start()
request.addfinalizer(patcher.stop)

return mock


@pytest.fixture()
def root_commands():
from .. import commands
return commands
2 changes: 2 additions & 0 deletions tests/test_commands.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def test_exists(root_commands):
assert root_commands
48 changes: 41 additions & 7 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,17 +1,51 @@
[tox]
envlist = style
skipsdist = True

[testenv]
install_command =
pipenv install --ignore-pipfile && \
pipenv install --dev --ignore-pipfile && \
pipenv --dev -r {packages}
list_dependencies_command = pipenv lock -r
whitelist_externals =
pipenv
rm
mkdir
setenv =
PYTHONPATH = {toxinidir}
PIPENV_DOTENV_LOCATION = {toxinidir}/tests/.env
CODECOV_ENV =
passenv = TOXENV CI CODECOV_TOKEN CODECOV_ENV

[testenv:test]
commands =
rm -rf pytest
mkdir -p pytest/coverage
pipenv run py.test
pipenv run codecov -e TOXENV

[testenv:style]
deps =
flake8
commands =
flake8 --output-file={envdir}/flake8.txt {toxinidir}/commands.py
pipenv run flake8 {toxinidir}/commands.py
pipenv run pydocstyle

[pytest]
testpaths = tests
addopts =
-v
--cov .
--cov-config .coveragerc
--cov-report term-missing
--cov-report html:pytest/coverage
--junitxml pytest/junit.xml

[flake8]
max-line-length = 120
max-complexity = 10
tee = True
count = True
statistics = True
tee = true
count = true
show-statistics = true
show-source = True

[pydocstyle]
match = '(?!test_).*\.py|(?!conftest\.py)'

0 comments on commit 6f67629

Please sign in to comment.