Browse Source

Preparing for OpenStack testing environment

Renamed logging.py to log.py. I was getting import errors because it conflicts
with logging in the stdlib.
tags/1.0.0
Josh Gachnang 5 years ago
parent
commit
ce8bc60414
12 changed files with 75 additions and 34 deletions
  1. 1
    0
      .gitignore
  2. 4
    0
      .testr.conf
  3. 8
    5
      .travis.yml
  4. 0
    8
      dev-requirements.txt
  5. 1
    0
      requirements.txt
  6. 16
    0
      setup.cfg
  7. 2
    2
      teeth_agent/cmd/agent.py
  8. 0
    0
      teeth_agent/log.py
  9. 1
    0
      teeth_agent/shell/__init__.py
  10. 3
    3
      teeth_agent/tests/log.py
  11. 8
    5
      test-requirements.txt
  12. 31
    11
      tox.ini

+ 1
- 0
.gitignore View File

@@ -9,3 +9,4 @@ ChangeLog
devenv/*
.coverage
coverage.xml
.testrepository

+ 4
- 0
.testr.conf View File

@@ -0,0 +1,4 @@
[DEFAULT]
test_command=OS_STDOUT_CAPTURE=1 OS_STDERR_CAPTURE=1 OS_TEST_TIMEOUT=60 ${PYTHON:-python} -m subunit.run discover -s teeth_agent/tests/ -p "*.py" $LISTOPT $IDOPTION
test_id_option=--load-list $IDFILE
test_list_option=--list

+ 8
- 5
.travis.yml View File

@@ -1,12 +1,15 @@
language: python
python: 2.7
env:
- TOX_ENV=py26
- TOX_ENV=py27
- TOX_ENV=pep8

install:
- pip install tox
- pip install tox
script:
- tox
branches:
only:
- master
- tox -vv -e $TOX_ENV

notifications:
irc:
channels:

+ 0
- 8
dev-requirements.txt View File

@@ -1,8 +0,0 @@
pep257==0.2.4
plumbum==1.3.0
pep8==1.4.6
pyflakes==0.7.3
junitxml==0.7
python-subunit==0.0.15
mock==1.0.1
coverage==3.6

+ 1
- 0
requirements.txt View File

@@ -3,3 +3,4 @@ requests==2.0.0
cherrypy==3.2.4
stevedore==0.14
-e git+https://github.com/racker/teeth-rest.git@e876c0fddd5ce2f5223ab16936f711b0d57e19c4#egg=teeth_rest
structlog

+ 16
- 0
setup.cfg View File

@@ -24,3 +24,19 @@ teeth_agent.modes =

teeth_agent.hardware_managers =
generic = teeth_agent.hardware:GenericHardwareManager

[pbr]
autodoc_index_modules = True

[build_sphinx]
all_files = 1
build-dir = doc/build
source-dir = doc/source

[egg_info]
tag_build =
tag_date = 0
tag_svn_revision = 0

[wheel]
universal = 1

+ 2
- 2
teeth_agent/cmd/agent.py View File

@@ -17,7 +17,7 @@ limitations under the License.
import argparse

from teeth_agent import agent
from teeth_agent import logging
from teeth_agent import log


def run():
@@ -40,7 +40,7 @@ def run():
help='The port to listen on')

args = parser.parse_args()
logging.configure()
log.configure()
agent.build_agent(args.api_url,
args.listen_host,
args.listen_port).run()

teeth_agent/logging.py → teeth_agent/log.py View File


+ 1
- 0
teeth_agent/shell/__init__.py View File

@@ -0,0 +1 @@
__author__ = 'joshgachnang'

teeth_agent/tests/logging.py → teeth_agent/tests/log.py View File

@@ -17,7 +17,7 @@ limitations under the License.
import structlog
import unittest

import teeth_agent.logging
import teeth_agent.log


def _return_event_processor(logger, method, event):
@@ -26,7 +26,7 @@ def _return_event_processor(logger, method, event):

class EventLogger(unittest.TestCase):
def test_format_event_basic(self):
processors = [teeth_agent.logging._format_event,
processors = [teeth_agent.log._format_event,
_return_event_processor]
structlog.configure(processors=processors)
log = structlog.wrap_logger(structlog.ReturnLogger())
@@ -37,7 +37,7 @@ class EventLogger(unittest.TestCase):
"""Check that we get an exception if you don't provide enough keys to
format a log message requiring format
"""
processors = [teeth_agent.logging._format_event,
processors = [teeth_agent.log._format_event,
_return_event_processor]
structlog.configure(processors=processors)
log = structlog.wrap_logger(structlog.ReturnLogger())

+ 8
- 5
test-requirements.txt View File

@@ -1,5 +1,8 @@
mock
httmock
coverage
nose
hacking
hacking>=0.8.0,<0.9
coverage>=3.6
discover
mock>=1.0
testrepository>=0.0.18
testtools>=0.9.34
python-subunit>=0.0.18
httmock

+ 31
- 11
tox.ini View File

@@ -1,18 +1,38 @@
[tox]
envlist = flake8, unit
minversion = 1.6
skipsdist = True
envlist = py26,py27,pep8

[testenv]
deps =
-rrequirements.txt
-rtest-requirements.txt
usedevelop = True
install_command = pip install --allow-external -U {opts} {packages}
setenv = VIRTUAL_ENV={envdir}
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
commands =
python setup.py testr --slowest --testr-args='{posargs:}'

[testenv:flake8]
commands = flake8 teeth_agent
[tox:jenkins]
downloadcache = ~/cache/pip

[testenv:unit]
[testenv:pep8]
commands =
nosetests --all-modules --with-coverage --cover-package=teeth_agent --cover-xml teeth_agent
flake8 {posargs:teeth_agent}

[testenv:devenv]
envdir = devenv
usedevelop = True
[testenv:cover]
setenv = VIRTUAL_ENV={envdir}
commands =
python setup.py testr --coverage {posargs:teeth_agent}

[testenv:venv]
commands = {posargs:}

[flake8]
# E711: ignored because it is normal to use "column == None" in sqlalchemy

ignore = E12,E711
builtins = _
exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,*ironic/nova*,tools

[hacking]
import_exceptions = ironic.openstack.common.gettextutils._,testtools.matchers

Loading…
Cancel
Save