Add Tox file for testing

pull/435/head
Nicolargo 2014-10-02 22:13:48 +02:00
parent 6915cf887d
commit 736c8ec7ae
4 changed files with 33 additions and 3 deletions

3
.gitignore vendored
View File

@ -40,3 +40,6 @@ local.properties
# Sphinx
_build
# Tox
.tox/

23
tox.ini Normal file
View File

@ -0,0 +1,23 @@
# Tox (http://tox.testrun.org/) is a tool for running tests
# Install:
# pip install tox
# Run:
# tox
[tox]
envlist = py27, py34
[testenv]
deps =
flake8
requests
psutil
bottle
batinfo
https://bitbucket.org/gleb_zhulik/py3sensors/get/tip.tar.gz
commands =
python unitest.py
python unitest-restful.py
python unitest-xmlrpc.py
#flake8 --exclude=build,.tox,.git

View File

@ -123,7 +123,7 @@ class TestGlances(unittest.TestCase):
plist = requests.get("%s/%s" % (URL, method))
print plist.json()
print(plist.json())
for p in plist.json():
print("HTTP RESTFul request: %s/%s" % (URL, p))

View File

@ -27,9 +27,13 @@ import time
import unittest
import shlex
import subprocess
import xmlrpclib
import json
import types
try:
from xmlrpc.client import ServerProxy
except ImportError:
# Python 2
from xmlrpclib import ServerProxy
from glances.core.glances_globals import (
appname,
@ -68,7 +72,7 @@ from glances.core.glances_stats import GlancesStats
stats = GlancesStats()
# Init the XML/RCP client
client = xmlrpclib.ServerProxy(URL)
client = ServerProxy(URL)
# Unitest class
# ==============