Skip to content

Commit

Permalink
Consolidate root/utils tests
Browse files Browse the repository at this point in the history
- Consolidate tests between the root of the repo and utils
  • Loading branch information
detiber committed Mar 6, 2017
1 parent c84081d commit fda3b43
Show file tree
Hide file tree
Showing 13 changed files with 38 additions and 110 deletions.
5 changes: 3 additions & 2 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@ omit =
*/lib/python*/site-packages/*
*/lib/python*/*
/usr/*
setup.py
*/setup.py
# TODO(rhcarvalho): this is used to ignore test files from coverage report.
# We can make this less generic when we stick with a single test pattern in
# the repo.
*/conftest.py
*/test_*.py
*/*_tests.py
*/test/*

[report]
fail_under = 25
fail_under = 29

[html]
directory = cover
3 changes: 2 additions & 1 deletion .flake8
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[flake8]
exclude=.tox,utils,inventory
# TODO: cleanup flake8 issues with utils/test/*
exclude=.tox,inventory,utils/test
max_line_length = 120
ignore = E501,T003
25 changes: 21 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,34 @@ sudo: false
cache:
- pip

before_cache:
- rm ~/.cache/pip/log/debug.log

language: python
python:
- "2.7"
- "3.5"

install:
- pip install -r requirements.txt
- pip install tox-travis

script:
# TODO(rhcarvalho): check syntax of other important entrypoint playbooks
- ansible-playbook --syntax-check playbooks/byo/config.yml
- tox
- cd utils && tox

notifications:
email:
recipients:
- [email protected]
- [email protected]
on_success: change
on_failure: always
irc:
channels:
- chat.freenode.net#openshift-dev
on_success: change
on_failure: always
template:
- "%{repository}#%{build_number} (%{branch} - %{commit} : %{author}): %{message}"
- "Change view : %{compare_url}"
- "Build details : %{build_url}"
- "sdodson jdetiber: ^"
2 changes: 0 additions & 2 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ norecursedirs =
__pycache__
cover
docs
# utils has it's own config
utils
python_files =
# TODO(rhcarvalho): rename test files to follow a single pattern. "test*.py"
# is Python unittest's default, while pytest discovers both "test_*.py" and
Expand Down
7 changes: 4 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
ansible>=2.2
six
click
pyOpenSSL
PyYAML
ruamel.yaml
# We need to disable ruamel.yaml for now because of test failures
#ruamel.yaml
six
4 changes: 1 addition & 3 deletions test-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
six
pyOpenSSL
# flake8 must be listed before pylint to avoid dependency conflicts
flake8
flake8-mutable
flake8-print
pylint
setuptools-lint
PyYAML
yamllint
coverage
mock
Expand Down
11 changes: 7 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
[tox]
minversion=2.3.1
envlist =
py{27,35}-ansible22-{pylint,unit,flake8,yamllint,generate_validation}
py{27,35}-{flake8,pylint,unit}
py27-{yamllint,ansible_syntax,generate_validation}
skipsdist=True
skip_missing_interpreters=True

[testenv]
skip_install=True
deps =
-rrequirements.txt
-rtest-requirements.txt
py35-flake8: flake8-bugbear
ansible22: ansible~=2.2

commands =
unit: pip install -e utils
unit: pytest {posargs}
flake8: flake8 {posargs}
pylint: python setup.py lint
yamllint: python setup.py yamllint
generate_validation: python setup.py generate_validation


# TODO(rhcarvalho): check syntax of other important entrypoint playbooks
ansible_syntax: ansible-playbook --syntax-check playbooks/byo/config.yml
18 changes: 0 additions & 18 deletions utils/.coveragerc

This file was deleted.

1 change: 0 additions & 1 deletion utils/.pylintrc

This file was deleted.

27 changes: 0 additions & 27 deletions utils/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,3 @@
# 3. If at all possible, it is good practice to do this. If you cannot, you
# will need to generate wheels for each Python version that you support.
universal=1

[aliases]
test=pytest

[flake8]
max-line-length=120
exclude=test/*,setup.py,oo-installenv
ignore=E501

[lint]
lint_disable=fixme,locally-disabled,file-ignored,duplicate-code

[tool:pytest]
testpaths = test
norecursedirs =
.*
__pycache__
python_files =
# TODO(rhcarvalho): rename test files to follow a single pattern. "test*.py"
# is Python unittest's default, while pytest discovers both "test_*.py" and
# "*_test.py" by default.
test_*.py
*_tests.py
addopts =
--cov=.
--cov-report=term
--cov-report=html
11 changes: 0 additions & 11 deletions utils/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,26 +38,15 @@

# You can just specify the packages manually here if your project is
# simple. Or you can use find_packages().
#packages=find_packages(exclude=['contrib', 'docs', 'tests*']),
packages=['ooinstall'],
package_dir={'': 'src'},


# List run-time dependencies here. These will be installed by pip when
# your project is installed. For an analysis of "install_requires" vs pip's
# requirements files see:
# https://packaging.python.org/en/latest/requirements.html
install_requires=['click', 'PyYAML', 'ansible'],

# List additional groups of dependencies here (e.g. development
# dependencies). You can install these using the following syntax,
# for example:
# $ pip install -e .[dev,test]
#extras_require={
# 'dev': ['check-manifest'],
# 'test': ['coverage'],
#},

# If there are data files included in your packages that need to be
# installed, specify them here. If using Python 2.6 or less, then these
# have to be included in MANIFEST.in as well.
Expand Down
15 changes: 0 additions & 15 deletions utils/test-requirements.txt

This file was deleted.

19 changes: 0 additions & 19 deletions utils/tox.ini

This file was deleted.

0 comments on commit fda3b43

Please sign in to comment.