Skip to content

Commit

Permalink
More toxification
Browse files Browse the repository at this point in the history
- Move pylint tests to tox
- Move yamllint tests to tox
- Create separate tox config (and setup.py) for root
- bump ansible requirement
- unify pylint config
- add docs
- remove git directory containing old testing tools
- install python-six if not present for openshift-facts
- add python-six as a dependency for openshift-ansible-utils
  • Loading branch information
detiber committed Jan 10, 2017
1 parent 9d316d3 commit be949e0
Show file tree
Hide file tree
Showing 24 changed files with 467 additions and 377 deletions.
5 changes: 5 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[run]
omit=
*/lib/python*/site-packages/*
*/lib/python*/*
/usr/*
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ ansible.cfg
.tox
.coverage
*.egg-info
.eggs
cover
173 changes: 86 additions & 87 deletions git/.pylintrc → .pylintrc
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
[MASTER]

# Specify a configuration file.
#rcfile=

# Python code to execute, usually for sys.path manipulation such as
# pygtk.require().
#init-hook=

# Profiled execution.
#profile=no

# Add files or directories to the blacklist. They should be base names, not
# paths.
ignore=CVS
ignore=CVS,setup.py

# Pickle collected data for later comparisons.
persistent=no
Expand All @@ -21,14 +17,6 @@ persistent=no
# usually to register additional checkers.
load-plugins=

# Deprecated. It was used to include message's id in output. Use --msg-template
# instead.
#include-ids=no

# Deprecated. It was used to include symbolic ids of messages in output. Use
# --msg-template instead.
#symbols=no

# Use multiple processes to speed up Pylint.
jobs=1

Expand Down Expand Up @@ -58,7 +46,8 @@ confidence=

# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
# multiple time. See also the "--disable" option for examples.
# multiple time (only on the command line, not in the configuration file where
# it should appear only once). See also the "--disable" option for examples.
#enable=

# Disable the message, report, category or checker with the given id(s). You
Expand All @@ -70,8 +59,7 @@ confidence=
# --enable=similarities". If you want to run only the classes checker, but have
# no Warning level messages displayed, use"--disable=all --enable=classes
# --disable=W"
# w0511 - fixme - disabled because TODOs are acceptable
disable=E1608,W1627,E1601,E1603,E1602,E1605,E1604,E1607,E1606,W1621,W1620,W1623,W1622,W1625,W1624,W1609,W1608,W1607,W1606,W1605,W1604,W1603,W1602,W1601,W1639,W1640,I0021,W1638,I0020,W1618,W1619,W1630,W1626,W1637,W1634,W1635,W1610,W1611,W1612,W1613,W1614,W1615,W1616,W1617,W1632,W1633,W0704,W1628,W1629,W1636,W0511,R0801,locally-disabled,file-ignored
disable=import-star-module-level,old-octal-literal,oct-method,print-statement,unpacking-in-except,parameter-unpacking,backtick,old-raise-syntax,old-ne-operator,long-suffix,dict-view-method,dict-iter-method,metaclass-assignment,next-method-called,raising-string,indexing-exception,raw_input-builtin,long-builtin,file-builtin,execfile-builtin,coerce-builtin,cmp-builtin,buffer-builtin,basestring-builtin,apply-builtin,filter-builtin-not-iterating,using-cmp-argument,useless-suppression,range-builtin-not-iterating,suppressed-message,no-absolute-import,old-division,cmp-method,reload-builtin,zip-builtin-not-iterating,intern-builtin,unichr-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,input-builtin,round-builtin,hex-method,nonzero-method,map-builtin-not-iterating


[REPORTS]
Expand All @@ -96,20 +84,24 @@ reports=no
# (RP0004).
evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)

# Add a comment according to your evaluation note. This is used by the global
# evaluation report (RP0004).
#comment=no

# Template used to display messages. This is a python new-style format string
# used to format the message information. See doc for all details
#msg-template=


[LOGGING]
[SIMILARITIES]

# Logging modules to check that the string format arguments are in logging
# function parameter format
logging-modules=logging
# Minimum lines number of a similarity.
min-similarity-lines=4

# Ignore comments when computing similarities.
ignore-comments=yes

# Ignore docstrings when computing similarities.
ignore-docstrings=yes

# Ignore imports when computing similarities.
ignore-imports=yes


[BASIC]
Expand Down Expand Up @@ -192,44 +184,23 @@ method-name-hint=[a-z_][a-z0-9_]{2,30}$

# Regular expression which should only match function or class names that do
# not require a docstring.
no-docstring-rgx=__.*__
no-docstring-rgx=^_

# Minimum line length for functions/classes that require docstrings, shorter
# ones are exempt.
docstring-min-length=-1


[SIMILARITIES]

# Minimum lines number of a similarity.
min-similarity-lines=0

# Ignore comments when computing similarities.
ignore-comments=yes

# Ignore docstrings when computing similarities.
ignore-docstrings=yes

# Ignore imports when computing similarities.
ignore-imports=yes


[VARIABLES]
[ELIF]

# Tells whether we should check for unused import in __init__ files.
init-import=no
# Maximum number of nested blocks for function / method body
max-nested-blocks=5

# A regular expression matching the name of dummy variables (i.e. expectedly
# not used).
dummy-variables-rgx=_$|dummy

# List of additional names supposed to be defined in builtins. Remember that
# you should avoid to define new builtins when possible.
additional-builtins=
[MISCELLANEOUS]

# List of strings which can identify a callback function by name. A callback
# name must start or end with one of those strings.
callbacks=cb_,_cb
# List of note tags to take in consideration, separated by a comma.
notes=FIXME,XXX,TODO


[TYPECHECK]
Expand All @@ -240,27 +211,30 @@ ignore-mixin-members=yes

# List of module names for which member attributes should not be checked
# (useful for modules/projects where namespaces are manipulated during runtime
# and thus existing member attributes cannot be deduced by static analysis
# and thus existing member attributes cannot be deduced by static analysis. It
# supports qualified module names, as well as Unix pattern matching.
ignored-modules=

# List of classes names for which member attributes should not be checked
# (useful for classes with attributes dynamically set).
ignored-classes=SQLObject

# When zope mode is activated, add a predefined set of Zope acquired attributes
# to generated-members.
#zope=no
# (useful for classes with attributes dynamically set). This supports can work
# with qualified names.
ignored-classes=

# List of members which are set dynamically and missed by pylint inference
# system, and so shouldn't trigger E0201 when accessed. Python regular
# system, and so shouldn't trigger E1101 when accessed. Python regular
# expressions are accepted.
generated-members=REQUEST,acl_users,aq_parent
generated-members=


[SPELLING]

# Spelling dictionary name. Available dictionaries: none. To make it working
# install python-enchant package.
# Spelling dictionary name. Available dictionaries: en_ZW (myspell), en_NG
# (myspell), en_NA (myspell), en_NZ (myspell), en_PH (myspell), en_AG
# (myspell), en_BW (myspell), en_IE (myspell), en_ZM (myspell), en_DK
# (myspell), en_CA (myspell), en_GH (myspell), en_IN (myspell), en_BZ
# (myspell), en_MW (myspell), en_TT (myspell), en_JM (myspell), en_GB
# (myspell), en_ZA (myspell), en_SG (myspell), en_AU (myspell), en_US
# (myspell), en_BS (myspell), en_HK (myspell).
spelling-dict=

# List of comma separated words that should not be checked.
Expand All @@ -274,12 +248,6 @@ spelling-private-dict-file=
spelling-store-unknown-words=no


[MISCELLANEOUS]

# List of note tags to take in consideration, separated by a comma.
notes=FIXME,XXX,TODO


[FORMAT]

# Maximum number of characters on a single line.
Expand All @@ -292,23 +260,67 @@ ignore-long-lines=^\s*(# )?<?https?://\S+>?$
# else.
single-line-if-stmt=no

# List of optional constructs for which whitespace checking is disabled
# List of optional constructs for which whitespace checking is disabled. `dict-
# separator` is used to allow tabulation in dicts, etc.: {1 : 1,\n222: 2}.
# `trailing-comma` allows a space between comma and closing bracket: (a, ).
# `empty-line` allows space-only lines.
no-space-check=trailing-comma,dict-separator

# Maximum number of lines in a module
max-module-lines=1000

# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1
# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1
# tab).
indent-string=' '

# Number of spaces of indent required inside a hanging or continued line.
# Number of spaces of indent required inside a hanging or continued line.
indent-after-paren=4

# Expected format of line ending, e.g. empty (any line ending), LF or CRLF.
expected-line-ending-format=


[VARIABLES]

# Tells whether we should check for unused import in __init__ files.
init-import=no

# A regular expression matching the name of dummy variables (i.e. expectedly
# not used).
dummy-variables-rgx=_$|dummy

# List of additional names supposed to be defined in builtins. Remember that
# you should avoid to define new builtins when possible.
additional-builtins=

# List of strings which can identify a callback function by name. A callback
# name must start or end with one of those strings.
callbacks=cb_,_cb


[LOGGING]

# Logging modules to check that the string format arguments are in logging
# function parameter format
logging-modules=logging


[CLASSES]

# List of method names used to declare (i.e. assign) instance attributes.
defining-attr-methods=__init__,__new__,setUp

# List of valid names for the first argument in a class method.
valid-classmethod-first-arg=cls

# List of valid names for the first argument in a metaclass class method.
valid-metaclass-classmethod-first-arg=mcs

# List of member names, which should be excluded from the protected access
# warning.
exclude-protected=_asdict,_fields,_replace,_source,_make


[DESIGN]

# Maximum number of arguments for function / method
Expand Down Expand Up @@ -342,21 +354,8 @@ min-public-methods=2
# Maximum number of public methods for a class (see R0904).
max-public-methods=20


[CLASSES]

# List of method names used to declare (i.e. assign) instance attributes.
defining-attr-methods=__init__,__new__,setUp

# List of valid names for the first argument in a class method.
valid-classmethod-first-arg=cls

# List of valid names for the first argument in a metaclass class method.
valid-metaclass-classmethod-first-arg=mcs

# List of member names, which should be excluded from the protected access
# warning.
exclude-protected=_asdict,_fields,_replace,_source,_make
# Maximum number of boolean expressions in a if statement
max-bool-expr=5


[IMPORTS]
Expand Down
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ python:

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 && make ci
File renamed without changes.
49 changes: 37 additions & 12 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,30 +66,55 @@ These are plugins used in playbooks and roles:
└── test Contains tests.
```

### Others

```
.
└── git Contains some helper scripts for repository maintenance.
```

## Building RPMs

See the [RPM build instructions](BUILD.md).

## Running tests

We use [Nose](http://readthedocs.org/docs/nose/) as a test runner. Make sure it
is installed along with other test dependencies:
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
parallel


```
pip install -r utils/test-requirements.txt
pip install tox detox
```

Run the tests with:
List the test environments available:
```
tox -l
```

Run all of the tests with:
```
tox
```

Run all of the tests in parallel with detox:
```
detox
```

Running a particular test environment (python 2.7 flake8 tests in this case):
```
tox -e py27-ansible22-flake8
```

Running a particular test environment in a clean virtualenv (python 3.5 pylint
tests in this case):
```
tox -r -e py35-ansible22-pylint
```

If you want to enter the virtualenv created by tox to do additional
testing/debugging (py27-flake8 env in this case):
```
nosetests
source .tox/py27-ansible22-flake8/bin/activate
```

## Submitting contributions
Expand Down
Loading

0 comments on commit be949e0

Please sign in to comment.