Skip to content

Commit

Permalink
Merge 14996ca into 75090c9
Browse files Browse the repository at this point in the history
  • Loading branch information
kersommoura authored Mar 22, 2019
2 parents 75090c9 + 14996ca commit 9dd6074
Show file tree
Hide file tree
Showing 27 changed files with 1,630 additions and 1,546 deletions.
12 changes: 12 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
repos:
- repo: https://github.com/ambv/black
rev: stable
hooks:
- id: black
args: [--line-length=79, --safe]
language_version: python3.7
- repo: https://gitlab.com/pycqa/flake8
rev: 3.7.0
hooks:
- id: flake8
language_version: python3
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
sudo: false
language: python
python:
- 3.4
- 3.5
- 3.6
# Python 3.7+ is only available on Xenial, due to dependency requirements. For
Expand All @@ -16,6 +15,8 @@ install:
# Old versions of pip can't handle extras_require in setup.py.
- pip install --upgrade pip
- pip install .[dev]
script: make all
script:
- make all
- if [[ $TRAVIS_PYTHON_VERSION == '3.7' ]]; then pre-commit run -a -v; fi
cache: pip
after_success: coveralls
54 changes: 22 additions & 32 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,25 @@ CPU_COUNT=$(shell python3 -c "from multiprocessing import cpu_count; print(cpu_c

help:
@echo "Please use \`make <target>' where <target> is one of:"
@echo " help to show this message"
@echo " all to to execute all following targets (except \`test')"
@echo " dist to generate installable Python packages"
@echo " dist-clean to remove generated Python packages"
@echo " docs-html to generate HTML documentation"
@echo " docs-clean to remove documentation"
@echo " docs-api to (re)generate .rst files for the API"
@echo " install-dev to install in editable mode with development dependencies"
@echo " lint to run all linters"
@echo " lint-flake8 to run the flake8 linter"
@echo " lint-pylint to run the pylint linter"
@echo " publish to upload dist/* to PyPi"
@echo " test to run unit tests"
@echo " test-coverage to run unit tests and measure test coverage"
@echo " help to show this message"
@echo " all to to execute all following targets (except \`test')"
@echo " dist to generate installable Python packages"
@echo " dist-clean to remove generated Python packages"
@echo " docs-html to generate HTML documentation"
@echo " docs-clean to remove documentation"
@echo " docs-api to (re)generate .rst files for the API"
@echo " install-dev to install in editable mode with development dependencies"
@echo " publish to upload dist/* to PyPi"
@echo " setup-pre-commit to setup pre-commit to run every commit."
@echo " test to run unit tests"
@echo " test-coverage to run unit tests and measure test coverage"

# Edit with caution! Travis CI uses this target. ¶ We run docs-clean before
# docs-html to ensure a complete build. (Warnings are emitted only when a file
# is compiled, and Sphinx does not needlessly recompile.) More broadly, we
# order dependencies by execution time and (anecdotal) likelihood of finding
# issues. ¶ `test-coverage` is a functional superset of `test`. Why keep both?
all: test-coverage lint docs-clean docs-html dist-clean dist
all: test-coverage docs-clean docs-html dist-clean dist

dist:
./setup.py --quiet sdist bdist_wheel --universal test
Expand All @@ -42,30 +40,22 @@ docs-api:
scripts/gen_api_docs.sh

install-dev:
pip install -q -e .[dev]

lint: lint-flake8 lint-pylint

# E501 and F401 are ignored because Pylint performs similar checks.
# W504 ignored since it requires line breaks after binary operators.
lint-flake8:
flake8 . --ignore E501,F401,W504 --exclude docs/_build

lint-pylint:
pylint -j $(CPU_COUNT) --reports=n --disable=I,unnecessary-pass \
docs/conf.py \
pulp_smash \
setup.py \
tests
pip install --upgrade pip
pip install -e .[dev]
make setup-pre-commit

publish: dist
twine upload dist/*

setup-pre-commit:
pre-commit install
pre-commit install-hooks

test:
python3 $(TEST_OPTIONS)

test-coverage:
coverage run --include 'pulp_smash/*' --omit 'pulp_smash/tests/*' $(TEST_OPTIONS)

.PHONY: help all docs-html docs-clean docs-api lint lint-flake8 lint-pylint \
test test-coverage dist-clean publish install-dev
.PHONY: help all docs-html docs-clean docs-api \
test test-coverage dist-clean publish install-dev setup-pre-commit
3 changes: 3 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ Pulp Smash
.. image:: https://coveralls.io/repos/github/PulpQE/pulp-smash/badge.svg?branch=master
:target: https://coveralls.io/github/PulpQE/pulp-smash?branch=master

.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
:target: https://github.com/ambv/black

Pulp Smash is a toolkit for testing `Pulp`.

Pulp Smash has a presence on the following websites:
Expand Down
13 changes: 7 additions & 6 deletions docs/about.rst
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ Code Standards

Please adhere to the following guidelines:

* Code should be compliant with `PEP-8`_. It is recommended to check for
compliance by running ``make lint``.
* Code should be compliant with `PEP-8`_.
* Code should follow the `Black`_ code style with a line length of 79 characters.
* Pull requests must pass the `Travis CI`_ continuous integration tests. You can
locally verify your changes before submitting a pull request by executing
``make all``.
Expand Down Expand Up @@ -195,17 +195,18 @@ Creating issues
.. [3] The "pets vs cattle" analogy is widely attributed to Bill Baker of
Microsoft.
.. _Black: https://github.com/ambv/black
.. _GNU Make: https://www.gnu.org/software/make/
.. _OpenSSH: http://www.openssh.com/
.. _PEP-8: https://www.python.org/dev/peps/pep-0008
.. _Pulp 2 Tests: https://github.com/PulpQE/pulp-2-tests
.. _Pulp Smash issues: https://github.com/PulpQE/pulp-smash/issues
.. _Travis CI: https://travis-ci.org/PulpQE/pulp-smash
.. _XDG Base Directory Specification: http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
.. _freenode: https://freenode.net/
.. _good commit messages: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
.. _labels: https://github.com/PulpQE/pulp-smash/labels
.. _pull request reviews: https://help.github.com/articles/about-pull-request-reviews/
.. _rewrite history: https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History
.. _pulp.plan.io: https://pulp.plan.io/
.. _PEP-8: https://www.python.org/dev/peps/pep-0008
.. _test case: https://pulp.plan.io/issues/4035
.. _Pulp Smash issues: https://github.com/PulpQE/pulp-smash/issues
.. _rewrite history: https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History
.. _test case: https://pulp.plan.io/issues/4035
85 changes: 46 additions & 39 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,60 +11,67 @@

# Add the Pulp Smash root directory to the system path. This allows references
# such as :mod:`pulp_smash.whatever` to be processed correctly.
ROOT_DIR = os.path.abspath(os.path.join(
os.path.dirname(__file__),
os.path.pardir
))
ROOT_DIR = os.path.abspath(
os.path.join(os.path.dirname(__file__), os.path.pardir)
)
sys.path.insert(0, ROOT_DIR)

# We pass the raw version string to Version() to ensure it is compliant with
# PEP 440. An InvalidVersion exception is raised if the version is
# non-conformant, so the act of generating documentation serves as a unit test
# for the contents of the `VERSION` file.
with open(os.path.join(ROOT_DIR, 'VERSION')) as handle:
with open(os.path.join(ROOT_DIR, "VERSION")) as handle:
VERSION = handle.read().strip()
Version(VERSION)


# Project Information ---------------------------------------------------------
# pylint:disable=invalid-name
author = 'Pulp QE'
copyright = '2015, Pulp QE' # pylint:disable=redefined-builtin
project = 'Pulp Smash'
author = "Pulp QE"
copyright = "2015, Pulp QE" # pylint:disable=redefined-builtin
project = "Pulp Smash"
version = release = VERSION


# General Configuration -------------------------------------------------------
extensions = ['sphinx.ext.autodoc']
source_suffix = '.rst'
master_doc = 'index'
exclude_patterns = ['_build']
extensions = ["sphinx.ext.autodoc"]
source_suffix = ".rst"
master_doc = "index"
exclude_patterns = ["_build"]
nitpicky = True
nitpick_ignore = [('py:class', 'type')]
autodoc_default_flags = ['members', 'show-inheritance', 'undoc-members']
nitpick_ignore = [("py:class", "type")]
autodoc_default_flags = ["members", "show-inheritance", "undoc-members"]
# Format-Specific Options -----------------------------------------------------
htmlhelp_basename = 'PulpSmashdoc'
latex_documents = [(
master_doc,
project + '.tex',
project + ' Documentation',
author,
'manual',
)]
man_pages = [(
master_doc,
'pulp-smash',
project + ' Documentation',
[author],
1, # man pages section
)]
texinfo_documents = [(
master_doc,
'PulpSmash',
project + ' Documentation',
author,
'PulpSmash',
('Pulp Smash is a Python library that facilitates functional testing of '
'Pulp.'),
'Miscellaneous'
)]
htmlhelp_basename = "PulpSmashdoc"
latex_documents = [
(
master_doc,
project + ".tex",
project + " Documentation",
author,
"manual",
)
]
man_pages = [
(
master_doc,
"pulp-smash",
project + " Documentation",
[author],
1, # man pages section
)
]
texinfo_documents = [
(
master_doc,
"PulpSmash",
project + " Documentation",
author,
"PulpSmash",
(
"Pulp Smash is a Python library that facilitates functional "
"testing of Pulp."
),
"Miscellaneous",
)
]
Loading

0 comments on commit 9dd6074

Please sign in to comment.