Reduce default stdout verbosity
Add OPENPHOTO_TEST_DEBUG env var for increased debug output
This commit is contained in:
parent
a2d103ec1a
commit
60c4d98b85
2 changed files with 27 additions and 8 deletions
|
@ -42,6 +42,10 @@ The easiest way to run a subset of the tests is with nose:
|
||||||
|
|
||||||
All HTTP requests and responses are recorded in the file "tests.log".
|
All HTTP requests and responses are recorded in the file "tests.log".
|
||||||
|
|
||||||
|
You can enable more verbose output to stdout with the following environment variable:
|
||||||
|
|
||||||
|
export OPENPHOTO_TEST_DEBUG=1
|
||||||
|
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
<a name="test_details"></a>
|
<a name="test_details"></a>
|
||||||
### Test Details
|
### Test Details
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import sys
|
||||||
import os
|
import os
|
||||||
import unittest
|
import unittest
|
||||||
import logging
|
import logging
|
||||||
|
@ -13,7 +14,9 @@ class TestBase(unittest.TestCase):
|
||||||
MAXIMUM_TEST_PHOTOS = 4 # Never have more the 4 photos on the test server
|
MAXIMUM_TEST_PHOTOS = 4 # Never have more the 4 photos on the test server
|
||||||
testcase_name = "(unknown testcase)"
|
testcase_name = "(unknown testcase)"
|
||||||
api_version = None
|
api_version = None
|
||||||
|
|
||||||
config_file = os.getenv("OPENPHOTO_TEST_CONFIG", "test")
|
config_file = os.getenv("OPENPHOTO_TEST_CONFIG", "test")
|
||||||
|
debug = (os.getenv("OPENPHOTO_TEST_DEBUG", "0") == "1")
|
||||||
|
|
||||||
def __init__(self, *args, **kwds):
|
def __init__(self, *args, **kwds):
|
||||||
unittest.TestCase.__init__(self, *args, **kwds)
|
unittest.TestCase.__init__(self, *args, **kwds)
|
||||||
|
@ -27,10 +30,11 @@ class TestBase(unittest.TestCase):
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
""" Ensure there is nothing on the server before running any tests """
|
""" Ensure there is nothing on the server before running any tests """
|
||||||
if cls.api_version is None:
|
if cls.debug:
|
||||||
print "\nTesting Latest %s" % cls.testcase_name
|
if cls.api_version is None:
|
||||||
else:
|
print "\nTesting Latest %s" % cls.testcase_name
|
||||||
print "\nTesting %s v%d" % (cls.testcase_name, cls.api_version)
|
else:
|
||||||
|
print "\nTesting %s v%d" % (cls.testcase_name, cls.api_version)
|
||||||
|
|
||||||
cls.client = openphoto.OpenPhoto(config_file=cls.config_file,
|
cls.client = openphoto.OpenPhoto(config_file=cls.config_file,
|
||||||
api_version=cls.api_version)
|
api_version=cls.api_version)
|
||||||
|
@ -63,8 +67,11 @@ class TestBase(unittest.TestCase):
|
||||||
"""
|
"""
|
||||||
self.photos = self.client.photos.list()
|
self.photos = self.client.photos.list()
|
||||||
if len(self.photos) != 3:
|
if len(self.photos) != 3:
|
||||||
# print self.photos
|
if self.debug:
|
||||||
print "[Regenerating Photos]"
|
print "[Regenerating Photos]"
|
||||||
|
else:
|
||||||
|
print " ",
|
||||||
|
sys.stdout.flush()
|
||||||
if len(self.photos) > 0:
|
if len(self.photos) > 0:
|
||||||
self._delete_all()
|
self._delete_all()
|
||||||
self._create_test_photos()
|
self._create_test_photos()
|
||||||
|
@ -74,7 +81,11 @@ class TestBase(unittest.TestCase):
|
||||||
if (len(self.tags) != 1 or
|
if (len(self.tags) != 1 or
|
||||||
self.tags[0].id != self.TEST_TAG or
|
self.tags[0].id != self.TEST_TAG or
|
||||||
str(self.tags[0].count) != "3"):
|
str(self.tags[0].count) != "3"):
|
||||||
print "[Regenerating Tags]"
|
if self.debug:
|
||||||
|
print "[Regenerating Tags]"
|
||||||
|
else:
|
||||||
|
print " ",
|
||||||
|
sys.stdout.flush()
|
||||||
self._delete_all()
|
self._delete_all()
|
||||||
self._create_test_photos()
|
self._create_test_photos()
|
||||||
self.photos = self.client.photos.list()
|
self.photos = self.client.photos.list()
|
||||||
|
@ -87,7 +98,11 @@ class TestBase(unittest.TestCase):
|
||||||
if (len(self.albums) != 1 or
|
if (len(self.albums) != 1 or
|
||||||
self.albums[0].name != self.TEST_ALBUM or
|
self.albums[0].name != self.TEST_ALBUM or
|
||||||
self.albums[0].count != "3"):
|
self.albums[0].count != "3"):
|
||||||
print "[Regenerating Albums]"
|
if self.debug:
|
||||||
|
print "[Regenerating Albums]"
|
||||||
|
else:
|
||||||
|
print " ",
|
||||||
|
sys.stdout.flush()
|
||||||
self._delete_all()
|
self._delete_all()
|
||||||
self._create_test_photos()
|
self._create_test_photos()
|
||||||
self.photos = self.client.photos.list()
|
self.photos = self.client.photos.list()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue