From 3547f90c7db2e5ba7b5de23d5d14139db24d7be8 Mon Sep 17 00:00:00 2001 From: Matt Jia Date: Mar 28 2017 04:25:41 +0000 Subject: [PATCH 1/2] clean up the fedmsg config file to make tox happy --- diff --git a/fedmsg.d/config.py b/fedmsg.d/config.py index f25c0ba..e2aa309 100644 --- a/fedmsg.d/config.py +++ b/fedmsg.d/config.py @@ -13,7 +13,6 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -import os import socket hostname = socket.gethostname() @@ -28,14 +27,14 @@ config = dict( high_water_mark=0, io_threads=1, - ## For the fedmsg-hub and fedmsg-relay. ## + # For the fedmsg-hub and fedmsg-relay. # # This is a status dir to keep a record of the last processed message - #status_directory=os.getcwd() + "/status", - #status_directory='/var/run/fedmsg/status', + # status_directory=os.getcwd() + "/status", + # status_directory='/var/run/fedmsg/status', # This is the URL of a datagrepper instance that we can query for backlog. - #datagrepper_url="https://apps.fedoraproject.org/datagrepper/raw", + # datagrepper_url="https://apps.fedoraproject.org/datagrepper/raw", # We almost always want the fedmsg-hub to be sending messages with zmq as # opposed to amqp or stomp. You can send with only *one* of the messaging @@ -46,12 +45,12 @@ config = dict( # On the other hand, if you wanted to use STOMP *instead* of zeromq, you # could do the following... - #zmq_enabled=False, - #stomp_uri='localhost:59597,localhost:59598', - #stomp_user='username', - #stomp_pass='password', - #stomp_ssl_crt='/path/to/an/optional.crt', - #stomp_ssl_key='/path/to/an/optional.key', + # zmq_enabled=False, + # stomp_uri='localhost:59597,localhost:59598', + # stomp_user='username', + # stomp_pass='password', + # stomp_ssl_crt='/path/to/an/optional.crt', + # stomp_ssl_key='/path/to/an/optional.key', # When subscribing to messages, we want to allow splats ('*') so we tell # the hub to not be strict when comparing messages topics to subscription @@ -119,7 +118,7 @@ config = dict( certnames={ # In prod/stg, map hostname to the name of the cert in ssldir. # Unfortunately, we can't use socket.getfqdn() - #"app01.stg": "app01.stg.phx2.fedoraproject.org", + # "app01.stg": "app01.stg.phx2.fedoraproject.org", }, # A mapping of fully qualified topics to a list of cert names for which From f2cb9e53a6330eb4fae33017b1ada4fb3c25621c Mon Sep 17 00:00:00 2001 From: Matt Jia Date: Mar 29 2017 01:51:22 +0000 Subject: [PATCH 2/2] tox: add coverage environment --- diff --git a/.gitignore b/.gitignore index 2f50910..b57d99d 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,5 @@ conf/settings.py test_env .cache docs/_build +/.coverage +/.tox/ diff --git a/requirements.txt b/requirements.txt index a201a83..a26a5b3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,6 +9,7 @@ SQLAlchemy kerberos >= 1.1.1 pytest >= 2.4.2 +coverage mock # Documentation requirements diff --git a/tox.ini b/tox.ini index d57b02a..1ef72cf 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = lint,py27,py34,py35,py36,docs +envlist = lint,py27,py34,py35,py36,docs,coverage # If the user is missing an interpreter, don't fail skip_missing_interpreters = True @@ -24,6 +24,14 @@ commands= rm -rf _build/ sphinx-build -W -b html -d {envtmpdir}/doctrees . _build/html +[testenv:coverage] +deps = + -rrequirements.txt +commands = + coverage run --parallel-mode -m pytest + coverage combine + coverage report --omit=.tox/* -m --skip-covered + [testenv:lint] deps = flake8 > 3.0 @@ -33,4 +41,4 @@ commands = [flake8] show-source = True max-line-length = 100 -exclude = .git,.tox,dist,*egg +exclude = .git,.tox,dist,*egg,env_waiverdb