summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/source/debugging.rst35
-rw-r--r--doc/source/index.rst1
-rw-r--r--pycadf/audit/api.py4
-rw-r--r--pycadf/eventfactory.py2
-rw-r--r--pycadf/geolocation.py4
-rw-r--r--pycadf/metric.py4
-rw-r--r--pycadf/middleware/audit.py4
-rw-r--r--pycadf/reporterstep.py4
-rwxr-xr-xtools/debug_helper.sh17
-rw-r--r--tox.ini6
10 files changed, 69 insertions, 12 deletions
diff --git a/doc/source/debugging.rst b/doc/source/debugging.rst
new file mode 100644
index 0000000..3aca00b
--- /dev/null
+++ b/doc/source/debugging.rst
@@ -0,0 +1,35 @@
+..
+ Copyright 2014 IBM Corp.
+
+ 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.
+
+.. _debugging:
+
+===================
+ Debugging with PDB
+===================
+
+Using PDB breakpoints with tox and testr normally doesn't work since the tests
+just fail with a BdbQuit exception rather than stopping at the breakpoint.
+
+To run with PDB breakpoints during testing, use the ``debug`` tox environment
+rather than ``py27``. Here's an example, passing the name of a test since
+you'll normally only want to run the test that hits your breakpoint::
+
+ $ tox -e debug pycadf.tests.test_cadf_spec
+
+For reference, the ``debug`` tox environment implements the instructions
+here: https://wiki.openstack.org/wiki/Testr#Debugging_.28pdb.29_Tests
+The pyCADF library provides a tox environment that enables pdb based
+debugging of test cases.
+
diff --git a/doc/source/index.rst b/doc/source/index.rst
index 37c2d9d..7545376 100644
--- a/doc/source/index.rst
+++ b/doc/source/index.rst
@@ -51,6 +51,7 @@ Developer Documentation
:maxdepth: 1
contributing
+ debugging
specification/index
Code Documentation
diff --git a/pycadf/audit/api.py b/pycadf/audit/api.py
index 411e1a9..ca92b21 100644
--- a/pycadf/audit/api.py
+++ b/pycadf/audit/api.py
@@ -36,7 +36,7 @@ from pycadf import resource
from pycadf import tag
from pycadf import timestamp
-#NOTE(gordc): remove cfg once we move over to this middleware version
+# NOTE(gordc): remove cfg once we move over to this middleware version
CONF = cfg.CONF
opts = [cfg.StrOpt('api_audit_map',
default='api_audit_map.conf',
@@ -114,7 +114,7 @@ class OpenStackAuditApi(object):
Service = collections.namedtuple('Service',
['id', 'name', 'type', 'admin_endp',
- 'public_endp', 'private_endp'])
+ 'public_endp', 'private_endp'])
def __init__(self, map_file=None):
if map_file is None:
diff --git a/pycadf/eventfactory.py b/pycadf/eventfactory.py
index fa079d0..d7cfa01 100644
--- a/pycadf/eventfactory.py
+++ b/pycadf/eventfactory.py
@@ -33,7 +33,7 @@ class EventFactory(object):
def new_event(self, eventType=cadftype.EVENTTYPE_ACTIVITY, **kwargs):
"""Create new event
- :param eventType: eventType of event. Defaults to 'activitiy'
+ :param eventType: eventType of event. Defaults to 'activity'
"""
# for now, construct a base ('activity') event as the default
diff --git a/pycadf/geolocation.py b/pycadf/geolocation.py
index fcbaee9..e9146a7 100644
--- a/pycadf/geolocation.py
+++ b/pycadf/geolocation.py
@@ -32,7 +32,7 @@ GEO_KEYNAME_ACCURACY = "accuracy"
GEO_KEYNAME_CITY = "city"
GEO_KEYNAME_STATE = "state"
GEO_KEYNAME_REGIONICANN = "regionICANN"
-#GEO_KEYNAME_ANNOTATIONS = "annotations"
+# GEO_KEYNAME_ANNOTATIONS = "annotations"
GEO_KEYNAMES = [GEO_KEYNAME_ID,
GEO_KEYNAME_LATITUDE,
@@ -42,7 +42,7 @@ GEO_KEYNAMES = [GEO_KEYNAME_ID,
GEO_KEYNAME_CITY,
GEO_KEYNAME_STATE,
GEO_KEYNAME_REGIONICANN
- #GEO_KEYNAME_ANNOTATIONS
+ # GEO_KEYNAME_ANNOTATIONS
]
diff --git a/pycadf/metric.py b/pycadf/metric.py
index e0f5fa5..817178c 100644
--- a/pycadf/metric.py
+++ b/pycadf/metric.py
@@ -27,12 +27,12 @@ TYPE_URI_METRIC = cadftype.CADF_VERSION_1_0_0 + 'metric'
METRIC_KEYNAME_METRICID = "metricId"
METRIC_KEYNAME_UNIT = "unit"
METRIC_KEYNAME_NAME = "name"
-#METRIC_KEYNAME_ANNOTATIONS = "annotations"
+# METRIC_KEYNAME_ANNOTATIONS = "annotations"
METRIC_KEYNAMES = [METRIC_KEYNAME_METRICID,
METRIC_KEYNAME_UNIT,
METRIC_KEYNAME_NAME
- #METRIC_KEYNAME_ANNOTATIONS
+ # METRIC_KEYNAME_ANNOTATIONS
]
diff --git a/pycadf/middleware/audit.py b/pycadf/middleware/audit.py
index 6234b0a..19cd025 100644
--- a/pycadf/middleware/audit.py
+++ b/pycadf/middleware/audit.py
@@ -16,8 +16,8 @@
"""
Attach open standard audit information to request.environ
-AuditMiddleware filter should be place after Keystone's auth_token middleware
-in the pipeline so that it can utilise the information Keystone provides.
+AuditMiddleware filter should be placed after Keystone's auth_token middleware
+in the pipeline so that it can utilize the information Keystone provides.
"""
from pycadf.audit import api as cadf_api
diff --git a/pycadf/reporterstep.py b/pycadf/reporterstep.py
index 232cf2e..159a7e6 100644
--- a/pycadf/reporterstep.py
+++ b/pycadf/reporterstep.py
@@ -24,13 +24,13 @@ REPORTERSTEP_KEYNAME_ROLE = "role"
REPORTERSTEP_KEYNAME_REPORTER = "reporter"
REPORTERSTEP_KEYNAME_REPORTERID = "reporterId"
REPORTERSTEP_KEYNAME_REPORTERTIME = "reporterTime"
-#REPORTERSTEP_KEYNAME_ATTACHMENTS = "attachments"
+# REPORTERSTEP_KEYNAME_ATTACHMENTS = "attachments"
REPORTERSTEP_KEYNAMES = [REPORTERSTEP_KEYNAME_ROLE,
REPORTERSTEP_KEYNAME_REPORTER,
REPORTERSTEP_KEYNAME_REPORTERID,
REPORTERSTEP_KEYNAME_REPORTERTIME,
- #REPORTERSTEP_KEYNAME_ATTACHMENTS
+ # REPORTERSTEP_KEYNAME_ATTACHMENTS
]
diff --git a/tools/debug_helper.sh b/tools/debug_helper.sh
new file mode 100755
index 0000000..0380cf7
--- /dev/null
+++ b/tools/debug_helper.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+TMP_DIR=`mktemp -d` || exit 1
+trap "rm -rf $TMP_DIR" EXIT
+
+ALL_TESTS=$TMP_DIR/all_tests
+TESTS_TO_RUN=$TMP_DIR/ks_to_run
+
+python -m testtools.run discover -t ./ ./pycadf/tests --list > $ALL_TESTS
+
+if [ "$1" ]; then
+ grep "$1" < $ALL_TESTS > $TESTS_TO_RUN
+else
+ mv $ALL_TESTS $TESTS_TO_RUN
+fi
+
+STANDARD_THREADS=1 python -m testtools.run discover --load-list $TESTS_TO_RUN
diff --git a/tox.ini b/tox.ini
index 672ef57..1ab3a41 100644
--- a/tox.ini
+++ b/tox.ini
@@ -26,8 +26,12 @@ commands = python setup.py testr --coverage
[testenv:venv]
commands = {posargs}
+[testenv:debug]
+commands =
+ {toxinidir}/tools/debug_helper.sh {posargs}
+
[flake8]
show-source = True
-ignore = E128,E251,E265,H405,H904
+ignore = H405,H904
exclude = .tox,dist,doc,*.egg,build,./pycadf/openstack/common
builtins = _