-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from Mierdin/ci-tools
Implement "standard" CI tools
- Loading branch information
Showing
28 changed files
with
1,389 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[run] | ||
branch = True | ||
source = pybluedot | ||
omit = pybluedot/tests/* | ||
|
||
[report] | ||
ignore-errors = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
# The format of this file isn't really documented; just use --generate-rcfile | ||
[MASTER] | ||
# Add <file or directory> to the black list. It should be a base name, not a | ||
# path. You may set this option multiple times. | ||
# | ||
# Note the 'openstack' below is intended to match only | ||
# neutron.openstack.common. If we ever have another 'openstack' | ||
# dirname, then we'll need to expand the ignore features in pylint :/ | ||
ignore=.git,tests,openstack | ||
|
||
[MESSAGES CONTROL] | ||
# NOTE(gus): This is a long list. A number of these are important and | ||
# should be re-enabled once the offending code is fixed (or marked | ||
# with a local disable) | ||
disable= | ||
# "F" Fatal errors that prevent further processing | ||
import-error, | ||
# "I" Informational noise | ||
locally-disabled, | ||
# "E" Error for important programming issues (likely bugs) | ||
access-member-before-definition, | ||
no-member, | ||
no-method-argument, | ||
no-self-argument, | ||
# "W" Warnings for stylistic problems or minor programming issues | ||
abstract-method, | ||
arguments-differ, | ||
attribute-defined-outside-init, | ||
bad-builtin, | ||
bad-indentation, | ||
broad-except, | ||
dangerous-default-value, | ||
deprecated-lambda, | ||
expression-not-assigned, | ||
fixme, | ||
global-statement, | ||
no-init, | ||
non-parent-init-called, | ||
not-callable, | ||
protected-access, | ||
redefined-builtin, | ||
redefined-outer-name, | ||
signature-differs, | ||
star-args, | ||
super-init-not-called, | ||
super-on-old-class, | ||
unpacking-non-sequence, | ||
unused-argument, | ||
unused-import, | ||
unused-variable, | ||
# "C" Coding convention violations | ||
bad-continuation, | ||
invalid-name, | ||
missing-docstring, | ||
superfluous-parens, | ||
# "R" Refactor recommendations | ||
abstract-class-little-used, | ||
abstract-class-not-used, | ||
duplicate-code, | ||
interface-not-implemented, | ||
no-self-use, | ||
too-few-public-methods, | ||
too-many-ancestors, | ||
too-many-arguments, | ||
too-many-branches, | ||
too-many-instance-attributes, | ||
too-many-lines, | ||
too-many-locals, | ||
too-many-public-methods, | ||
too-many-return-statements, | ||
too-many-statements | ||
|
||
[BASIC] | ||
# Variable names can be 1 to 31 characters long, with lowercase and underscores | ||
variable-rgx=[a-z_][a-z0-9_]{0,30}$ | ||
|
||
# Argument names can be 2 to 31 characters long, with lowercase and underscores | ||
argument-rgx=[a-z_][a-z0-9_]{1,30}$ | ||
|
||
# Method names should be at least 3 characters long | ||
# and be lowecased with underscores | ||
method-rgx=([a-z_][a-z0-9_]{2,}|setUp|tearDown)$ | ||
|
||
# Module names matching neutron-* are ok (files in bin/) | ||
module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+)|(pybluedot-[a-z0-9_-]+))$ | ||
|
||
# Don't require docstrings on tests. | ||
no-docstring-rgx=((__.*__)|([tT]est.*)|setUp|tearDown)$ | ||
|
||
[FORMAT] | ||
# Maximum number of characters on a single line. | ||
max-line-length=79 | ||
|
||
[VARIABLES] | ||
# List of additional names supposed to be defined in builtins. Remember that | ||
# you should avoid to define new builtins when possible. | ||
# _ is used by our localization | ||
additional-builtins=_ | ||
|
||
[CLASSES] | ||
# List of interface methods to ignore, separated by a comma. | ||
ignore-iface-methods= | ||
|
||
[IMPORTS] | ||
# Deprecated modules which should not be used, separated by a comma | ||
deprecated-modules= | ||
# In most openstack projects, the use of the stdlib's json package is discouraged. | ||
# However this isn't an openstack project so I'm allowing this | ||
# json | ||
|
||
|
||
[TYPECHECK] | ||
# List of module names for which member attributes should not be checked | ||
ignored-modules=six.moves,_MovedItems | ||
|
||
[REPORTS] | ||
# Tells whether to display a full report or only the messages | ||
reports=no |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[DEFAULT] | ||
test_command=OS_STDOUT_CAPTURE=1 OS_STDERR_CAPTURE=1 OS_LOG_CAPTURE=1 ${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./pybluedot/tests/unit} $LISTOPT $IDOPTION | cat | ||
test_id_option=--load-list $IDFILE | ||
test_list_option=--list |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,29 @@ | ||
random notes about contributing can go here | ||
# How to Contribute | ||
|
||
`pybluedot` uses Travis CI for Continuous Integration. This runs both unit tests as well as linting checks to ensure code quality. | ||
|
||
It's very easy to run these checks for yourself, without even having to push any code or open a PR. All you need to do is install virtualenv and tox: | ||
|
||
pip install virtualenv tox | ||
|
||
Then, you can run these three commands from inside this repository (they are the same commands that Travis will run): | ||
|
||
- `tox -epep8`: This runs PEP8 and other style checks on your code | ||
- `tox -epy27`: This runs unit tests | ||
- `tox -ecover`: This runs coverage testing | ||
|
||
If those three commands run without error, then you're ready to open a Pull Request. If not, please address those issues (of course, feel free to reach out on Slack for any assistance with this). | ||
|
||
# Tips | ||
|
||
## Cryptography Failure on OSX | ||
|
||
If you are developing on OSX and are seeing this error when running Tox: | ||
|
||
fatal error: too many errors emitted, stopping now [-ferror-limit=] | ||
|
||
20 errors generated. | ||
|
||
error: command 'cc' failed with exit status 1 | ||
|
||
Make sure you're running the latest version of virtualenv and pip, then destroy and re-run Tox, and you should be good. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +0,0 @@ | ||
""" | ||
keeping this __init__.py very light for now. We can expand later if needed. - QHM | ||
""" | ||
|
||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +0,0 @@ | ||
""" | ||
keeping this __init__.py very light for now. We can expand later if needed. - QHM | ||
""" | ||
|
||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import unittest | ||
|
||
|
||
class DietTestCase(unittest.TestCase): | ||
"""Same great taste, less filling. | ||
This class provides testing functionality that is common across all tests. | ||
""" | ||
|
||
def setUp(self): | ||
"""Perform setup activies for unit tests | ||
""" | ||
|
||
pass | ||
|
||
def tearDown(self): | ||
"""Perform teardown activies for unit tests | ||
""" | ||
|
||
pass |
This file was deleted.
Oops, something went wrong.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from pybluedot.tests import base | ||
|
||
|
||
class SampleTestSuite(base.DietTestCase): | ||
"""This test suite provides some common things relevant to the | ||
tests in this file. All tests should inherit from this class | ||
""" | ||
|
||
def setUp(self): | ||
"""Perform setup activities | ||
""" | ||
|
||
super(SampleTestSuite, self).setUp() | ||
|
||
def tearDown(self): | ||
"""Perform teardown activities | ||
""" | ||
|
||
super(SampleTestSuite, self).tearDown() | ||
|
||
|
||
class test_sample_foo(SampleTestSuite): | ||
"""This is a sample unit test. Implement the testing here | ||
""" | ||
|
||
def runTest(self): | ||
"""Runs the unit test | ||
""" | ||
|
||
self.assertTrue(True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
requests=2.12.3 | ||
requests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
[metadata] | ||
name = pybluedot | ||
version = 0.0.1 | ||
summary = pybluedot is a Python library/command-line utility that allows for easy display of NASA data | ||
description-file = | ||
README.md | ||
author = Commitmas 2016 | ||
author-email = [email protected] | ||
home-page = https://github.com/commitmas/pybluedot | ||
classifier = | ||
Environment :: MegaAwesome | ||
Intended Audience :: Information Technology | ||
Intended Audience :: System Administrators | ||
License :: OSI Approved :: Apache Software License | ||
Operating System :: POSIX :: Linux | ||
Programming Language :: Python | ||
Programming Language :: Python :: 2 | ||
Programming Language :: Python :: 2.7 | ||
Programming Language :: Python :: 3 | ||
Programming Language :: Python :: 3.4 | ||
|
||
[entry_points] | ||
console_scripts = | ||
bdot = pybluedot.cli:main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,11 @@ | ||
import os | ||
from setuptools import setup | ||
|
||
setup( | ||
name = "pybluedot", | ||
version = "0.0.1", | ||
author = "Matt Oswalt", | ||
author_email = "[email protected]", | ||
description = ("A Python library/command-line utility that allows for easy display of NASA data."), | ||
license = "Apache-2.0", | ||
url = "https://github.com/commitmas/pybluedot", | ||
packages = ['pybluedot', 'tests'], | ||
) | ||
import setuptools | ||
|
||
try: | ||
import multiprocessing | ||
except ImportError: | ||
pass | ||
|
||
setuptools.setup( | ||
setup_requires=['pbr>=1.8'], | ||
pbr=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# The order of packages is significant, because pip processes them in the order | ||
# of appearance. Changing the order has an impact on the overall integration | ||
# process, which may cause wedges in the gate later. | ||
hacking<0.11,>=0.10.0 | ||
|
||
astroid==1.3.8 | ||
cliff>=1.14.0 # Apache-2.0 | ||
coverage==3.6 | ||
fixtures>=1.3.1 | ||
mock>=1.2 | ||
python-subunit>=0.0.18 | ||
requests-mock>=0.6.0 # Apache-2.0 | ||
sphinx!=1.2.0,!=1.3b1,<1.3,>=1.1.2 | ||
oslosphinx>=2.5.0 # Apache-2.0 | ||
testrepository>=0.0.18 | ||
testtools>=1.4.0 | ||
testresources>=0.2.4 | ||
testscenarios>=0.4 | ||
WebTest>=2.0 | ||
oslotest>=1.10.0 # Apache-2.0 | ||
os-testr>=0.4.1 | ||
tempest-lib>=0.10.0 | ||
ddt>=0.7.0 | ||
pylint==1.4.4 # GNU GPL v2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations | ||
# under the License. | ||
# | ||
# WARNING! | ||
# Please do not run this script without talking to the Neutron PTL. Auto | ||
# abandoning people's changes is a good thing, but must be done with care. | ||
# | ||
# before you run this modify your .ssh/config to create a | ||
# review.openstack.org entry: | ||
# | ||
# Host review.openstack.org | ||
# User <yourgerritusername> | ||
# Port 29418 | ||
# | ||
|
||
# Note: due to gerrit bug somewhere, this double posts messages. :( | ||
|
||
# first purge the all reviews that are more than 4w old and blocked by a core -2 | ||
|
||
set -o errexit | ||
|
||
function abandon_review { | ||
local gitid=$1 | ||
shift | ||
local msg=$@ | ||
echo "Abandoning $gitid" | ||
# echo ssh review.openstack.org gerrit review $gitid --abandon --message \"$msg\" | ||
ssh review.openstack.org gerrit review $gitid --abandon --message \"$msg\" | ||
} | ||
|
||
PROJECTS="(project:openstack/neutron OR project:openstack/neutron-fwaas OR \ | ||
project:openstack/neutron-lbaas OR project:openstack/neutron-vpnaas OR \ | ||
project:openstack/python-neutronclient OR project:openstack/neutron-specs)" | ||
|
||
blocked_reviews=$(ssh review.openstack.org "gerrit query --current-patch-set --format json $PROJECTS status:open age:4w label:Code-Review<=-2" | jq .currentPatchSet.revision | grep -v null | sed 's/"//g') | ||
|
||
blocked_msg=$(cat <<EOF | ||
This review is > 4 weeks without comment and currently blocked by a | ||
core reviewer with a -2. We are abandoning this for now. | ||
Feel free to reactivate the review by pressing the restore button and | ||
contacting the reviewer with the -2 on this review to ensure you | ||
address their concerns. | ||
EOF | ||
) | ||
|
||
# For testing, put in a git rev of something you own and uncomment | ||
# blocked_reviews="b6c4218ae4d75b86c33fa3d37c27bc23b46b6f0f" | ||
|
||
for review in $blocked_reviews; do | ||
# echo ssh review.openstack.org gerrit review $review --abandon --message \"$msg\" | ||
echo "Blocked review $review" | ||
abandon_review $review $blocked_msg | ||
done | ||
|
||
# then purge all the reviews that are > 4w with no changes and Jenkins has -1ed | ||
|
||
failing_reviews=$(ssh review.openstack.org "gerrit query --current-patch-set --format json $PROJECTS status:open age:4w NOT label:Verified>=1,jenkins" | jq .currentPatchSet.revision | grep -v null | sed 's/"//g') | ||
|
||
failing_msg=$(cat <<EOF | ||
This review is > 4 weeks without comment, and failed Jenkins the last | ||
time it was checked. We are abandoning this for now. | ||
Feel free to reactivate the review by pressing the restore button and | ||
leaving a 'recheck' comment to get fresh test results. | ||
EOF | ||
) | ||
|
||
for review in $failing_reviews; do | ||
echo "Failing review $review" | ||
abandon_review $review $failing_msg | ||
done |
Oops, something went wrong.