summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.coveragerc5
-rw-r--r--.flake83
-rw-r--r--.travis.yml25
-rw-r--r--CONTRIBUTING.md9
-rw-r--r--pytest.ini2
-rw-r--r--requirements.txt7
-rw-r--r--test-requirements.txt4
-rw-r--r--tox.ini11
-rw-r--r--utils/.coveragerc18
l---------utils/.pylintrc1
-rw-r--r--utils/Makefile105
-rw-r--r--utils/README.md61
-rw-r--r--utils/setup.cfg27
-rw-r--r--utils/setup.py11
-rw-r--r--utils/test-requirements.txt15
-rw-r--r--utils/tox.ini19
16 files changed, 44 insertions, 279 deletions
diff --git a/.coveragerc b/.coveragerc
index ed4bca119..00f46b61b 100644
--- a/.coveragerc
+++ b/.coveragerc
@@ -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
diff --git a/.flake8 b/.flake8
index 98ddeef20..99ae3c2f0 100644
--- a/.flake8
+++ b/.flake8
@@ -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
diff --git a/.travis.yml b/.travis.yml
index f0a228c23..15fe61959 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -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:
+ - jdetiber@redhat.com
+ - sdodson@redhat.com
+ 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: ^"
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 502ef6aa5..12f3efc09 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -72,9 +72,6 @@ See the [RPM build instructions](BUILD.md).
## Running tests
-This section covers how to run tests for the root of this repo, running tests
-for the oo-install wrapper is described in [utils/README.md](utils/README.md).
-
We use [tox](http://readthedocs.org/docs/tox/) to manage virtualenvs and run
tests. Alternatively, tests can be run using
[detox](https://pypi.python.org/pypi/detox/) which allows for running tests in
@@ -120,19 +117,19 @@ detox
Running a particular test environment (python 2.7 flake8 tests in this case):
```
-tox -e py27-ansible22-flake8
+tox -e py27-flake8
```
Running a particular test environment in a clean virtualenv (python 3.5 pylint
tests in this case):
```
-tox -r -e py35-ansible22-pylint
+tox -r -e py35-pylint
```
If you want to enter the virtualenv created by tox to do additional
testing/debugging (py27-flake8 env in this case):
```
-source .tox/py27-ansible22-flake8/bin/activate
+source .tox/py27-flake8/bin/activate
```
## Submitting contributions
diff --git a/pytest.ini b/pytest.ini
index fec074f90..502fd1f46 100644
--- a/pytest.ini
+++ b/pytest.ini
@@ -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
diff --git a/requirements.txt b/requirements.txt
index 5a6a161cb..241313b6f 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -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
diff --git a/test-requirements.txt b/test-requirements.txt
index 9bb6e058c..805828e1c 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -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
diff --git a/tox.ini b/tox.ini
index 13c87f5c4..643fa774d 100644
--- a/tox.ini
+++ b/tox.ini
@@ -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
diff --git a/utils/.coveragerc b/utils/.coveragerc
deleted file mode 100644
index 551e13192..000000000
--- a/utils/.coveragerc
+++ /dev/null
@@ -1,18 +0,0 @@
-[run]
-branch = True
-omit =
- */lib/python*/site-packages/*
- */lib/python*/*
- /usr/*
- 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.
- test_*.py
- *_tests.py
-
-[report]
-fail_under = 73
-
-[html]
-directory = cover
diff --git a/utils/.pylintrc b/utils/.pylintrc
deleted file mode 120000
index 30b33b524..000000000
--- a/utils/.pylintrc
+++ /dev/null
@@ -1 +0,0 @@
-../.pylintrc \ No newline at end of file
diff --git a/utils/Makefile b/utils/Makefile
deleted file mode 100644
index e53c0e628..000000000
--- a/utils/Makefile
+++ /dev/null
@@ -1,105 +0,0 @@
-########################################################
-
-# Makefile for OpenShift: Atomic Quick Installer
-#
-# useful targets (not all implemented yet!):
-# make clean -- Clean up garbage
-# make ci ------------------- Execute CI steps (for travis or jenkins)
-
-########################################################
-
-# > VARIABLE = value
-#
-# Normal setting of a variable - values within it are recursively
-# expanded when the variable is USED, not when it's declared.
-#
-# > VARIABLE := value
-#
-# Setting of a variable with simple expansion of the values inside -
-# values within it are expanded at DECLARATION time.
-
-########################################################
-
-
-NAME := oo-install
-VENV := $(NAME)env
-SHORTNAME := ooinstall
-
-# This doesn't evaluate until it's called. The -D argument is the
-# directory of the target file ($@), kinda like `dirname`.
-ASCII2MAN = a2x -D $(dir $@) -d manpage -f manpage $<
-MANPAGES := docs/man/man1/atomic-openshift-installer.1
-# slipped into the manpage template before a2x processing
-VERSION := 1.4
-
-sdist: clean
- python setup.py sdist
- rm -fR $(SHORTNAME).egg-info
-
-clean:
- @find . -type f -regex ".*\.py[co]$$" -delete
- @find . -type f \( -name "*~" -or -name "#*" \) -delete
- @rm -fR build dist rpm-build MANIFEST htmlcov .coverage cover ooinstall.egg-info oo-install
- @rm -fR $(VENV)
- @rm -fR .tox
-
-# To force a rebuild of the docs run 'touch' on any *.in file under
-# docs/man/man1/
-docs: $(MANPAGES)
-
-# Regenerate %.1.asciidoc if %.1.asciidoc.in has been modified more
-# recently than %.1.asciidoc.
-%.1.asciidoc: %.1.asciidoc.in
- sed "s/%VERSION%/$(VERSION)/" $< > $@
-
-# Regenerate %.1 if %.1.asciidoc or VERSION has been modified more
-# recently than %.1. (Implicitly runs the %.1.asciidoc recipe)
-%.1: %.1.asciidoc
- $(ASCII2MAN)
-
-viewcover:
- xdg-open cover/index.html
-
-# Conditional virtualenv building strategy taken from this great post
-# by Marcel Hellkamp:
-# http://blog.bottlepy.org/2012/07/16/virtualenv-and-makefiles.html
-$(VENV): $(VENV)/bin/activate
-$(VENV)/bin/activate: test-requirements.txt
- @echo "#############################################"
- @echo "# Creating a virtualenv"
- @echo "#############################################"
- test -d $(VENV) || virtualenv $(VENV)
- . $(VENV)/bin/activate && pip install setuptools==17.1.1
- . $(VENV)/bin/activate && pip install -r test-requirements.txt
- touch $(VENV)/bin/activate
-# If there are any special things to install do it here
-# . $(VENV)/bin/activate && INSTALL STUFF
-
-ci-unittests: $(VENV)
- @echo "#############################################"
- @echo "# Running Unit Tests in virtualenv"
- @echo "#############################################"
- . $(VENV)/bin/activate && detox -e py27-unit,py35-unit
- @echo "VIEW CODE COVERAGE REPORT WITH 'xdg-open cover/index.html' or run 'make viewcover'"
-
-ci-pylint: $(VENV)
- @echo "#############################################"
- @echo "# Running PyLint Tests in virtualenv"
- @echo "#############################################"
- . $(VENV)/bin/activate && detox -e py27-pylint,py35-pylint
-
-ci-flake8: $(VENV)
- @echo "#############################################"
- @echo "# Running Flake8 Compliance Tests in virtualenv"
- @echo "#############################################"
- . $(VENV)/bin/activate && detox -e py27-flake8,py35-flake8
-
-ci-tox: $(VENV)
- . $(VENV)/bin/activate && detox
-
-ci: ci-tox
- @echo
- @echo "##################################################################################"
- @echo "VIEW CODE COVERAGE REPORT WITH 'xdg-open cover/index.html' or run 'make viewcover'"
- @echo "To clean your test environment run 'make clean'"
- @echo "Other targets you may run with 'make': 'ci-pylint', 'ci-tox', 'ci-unittests', 'ci-flake8'"
diff --git a/utils/README.md b/utils/README.md
index 7aa045ae4..79ea3fa9f 100644
--- a/utils/README.md
+++ b/utils/README.md
@@ -1,69 +1,14 @@
# Running Tests
-Run the command:
-
- make ci
-
-to run tests and linting tools.
-
-Underneath the covers, we use [tox](http://readthedocs.org/docs/tox/) to manage virtualenvs and run
-tests. Alternatively, tests can be run using [detox](https://pypi.python.org/pypi/detox/) which allows
-for running tests in parallel.
-
-```
-pip install tox detox
-```
-
-List the test environments available:
-
-```
-tox -l
-```
-
-Run all of the tests with:
-
-```
-tox
-```
-
-Run all of the tests in parallel with detox:
-
-```
-detox
-```
-
-Run a particular test environment:
-
-```
-tox -e py27-flake8
-```
-
-Run a particular test environment in a clean virtualenv:
-
-```
-tox -r -e py35-pylint
-```
-
-If you want to enter the virtualenv created by tox to do additional
-testing/debugging:
-
-```
-source .tox/py27-flake8/bin/activate
-```
-
-You will get errors if the log files already exist and can not be
-written to by the current user (`/tmp/ansible.log` and
-`/tmp/installer.txt`). *We're working on it.*
-
+All tests can be run by running `tox`. See [running tests](..//CONTRIBUTING.md#running-tests) for more information.
# Running From Source
You will need to setup a **virtualenv** to run from source:
$ virtualenv oo-install
- $ source ./oo-install/bin/activate
- $ virtualenv --relocatable ./oo-install/
- $ python setup.py install
+ $ source oo-install/bin/activate
+ $ python setup.py develop
The virtualenv `bin` directory should now be at the start of your
`$PATH`, and `oo-install` is ready to use from your shell.
diff --git a/utils/setup.cfg b/utils/setup.cfg
index d730cd3b4..79bc67848 100644
--- a/utils/setup.cfg
+++ b/utils/setup.cfg
@@ -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
diff --git a/utils/setup.py b/utils/setup.py
index 629d39206..6fec7b173 100644
--- a/utils/setup.py
+++ b/utils/setup.py
@@ -38,26 +38,15 @@ setup(
# 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.
diff --git a/utils/test-requirements.txt b/utils/test-requirements.txt
deleted file mode 100644
index b26e22a7e..000000000
--- a/utils/test-requirements.txt
+++ /dev/null
@@ -1,15 +0,0 @@
-ansible
-# flake8 moved to before setuptools-lint to satisfy mccabe dependency issue
-flake8
-setuptools-lint
-coverage
-mock
-PyYAML
-click
-backports.functools_lru_cache
-pyOpenSSL
-yamllint
-tox
-detox
-pytest
-pytest-cov
diff --git a/utils/tox.ini b/utils/tox.ini
deleted file mode 100644
index 2524923cb..000000000
--- a/utils/tox.ini
+++ /dev/null
@@ -1,19 +0,0 @@
-[tox]
-minversion=2.3.1
-envlist =
- py{27,35}-{flake8,unit,pylint}
-skipsdist=True
-skip_missing_interpreters=True
-
-[testenv]
-usedevelop=True
-deps =
- -rtest-requirements.txt
- py35-flake8: flake8-bugbear
-commands =
- # Needed to make detox work, since it ignores usedevelop
- # https://github.com/tox-dev/tox/issues/180
- unit: pip install -e .
- unit: pytest {posargs}
- flake8: python setup.py flake8
- pylint: python setup.py lint