Eliminate references to 'greentest'

This commit is contained in:
Ryan Williams
2009-07-27 15:40:30 -07:00
parent f133d35f74
commit 91b43f7be9
26 changed files with 33 additions and 66 deletions

View File

@@ -19,7 +19,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE. # THE SOFTWARE.
# package is named greentest, not test, so it won't be confused with test in stdlib # package is named tests, not test, so it won't be confused with test in stdlib
import sys import sys
import os import os
import errno import errno

View File

@@ -152,7 +152,7 @@ class TestResult:
return '<td align=center valign=%s bgcolor=%s>%s</td>' % (valign, self.color(), text) return '<td align=center valign=%s bgcolor=%s>%s</td>' % (valign, self.color(), text)
def format_testname(changeset, test): def format_testname(changeset, test):
return '<a href="%s/src/%s/greentest/%s">%s</a>' % (REPO_URL, changeset, test, test) return '<a href="%s/src/%s/tests/%s">%s</a>' % (REPO_URL, changeset, test, test)
def format_table(table, hubs, tests, hub_stats, changeset): def format_table(table, hubs, tests, hub_stats, changeset):
r = '<table border=1>\n<tr>\n<td/>\n' r = '<table border=1>\n<tr>\n<td/>\n'

View File

@@ -219,39 +219,6 @@ SOMETIMES = RuntimeError('I fail half the time')
class TestTookTooLong(Exception): class TestTookTooLong(Exception):
pass pass
class TestFan(TestCase):
mode = 'static'
def setUp(self):
self.timer = api.exc_after(1, TestTookTooLong())
self.pool = IntPool(max_size=2)
def tearDown(self):
self.timer.cancel()
def test_with_list(self):
list_of_input = ['agent-one', 'agent-two', 'agent-three']
def my_callable(pool_item, next_thing):
## Do some "blocking" (yielding) thing
api.sleep(0.01)
return next_thing
output = self.pool.fan(my_callable, list_of_input)
self.assertEquals(list_of_input, output)
def test_all_fail(self):
def my_failure(pool_item, next_thing):
raise ALWAYS
self.assertRaises(pools.AllFailed, self.pool.fan, my_failure, range(4))
def test_some_fail(self):
def my_failing_callable(pool_item, next_thing):
if next_thing % 2:
raise SOMETIMES
return next_thing
self.assertRaises(pools.SomeFailed, self.pool.fan, my_failing_callable, range(4))
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@@ -32,7 +32,7 @@ try:
except ImportError: except ImportError:
import pysqlite2.dbapi2 as sqlite3 import pysqlite2.dbapi2 as sqlite3
import warnings import warnings
from greentest import disabled_marker from tests import disabled_marker
warnings.simplefilter('ignore') warnings.simplefilter('ignore')

View File

@@ -245,7 +245,7 @@ class TestSaranwrap(unittest.TestCase):
tid = make_uuid() tid = make_uuid()
self.assertEqual(tid.get_version(), uuid.uuid4().get_version()) self.assertEqual(tid.get_version(), uuid.uuid4().get_version())
def make_list(): def make_list():
from greentest import saranwrap_test from tests import saranwrap_test
prox = saranwrap.wrap(saranwrap_test.list_maker) prox = saranwrap.wrap(saranwrap_test.list_maker)
# after this function returns, prox should fall out of scope # after this function returns, prox should fall out of scope
return prox() return prox()
@@ -290,7 +290,7 @@ sys_path = sys.path""")
sys.path.remove(temp_dir) sys.path.remove(temp_dir)
def test_contention(self): def test_contention(self):
from greentest import saranwrap_test from tests import saranwrap_test
prox = saranwrap.wrap(saranwrap_test) prox = saranwrap.wrap(saranwrap_test)
pool = Pool(max_size=4) pool = Pool(max_size=4)
@@ -316,7 +316,7 @@ sys_path = sys.path""")
def test_list_of_functions(self): def test_list_of_functions(self):
return # this test is known to fail, we can implement it sometime in the future if we wish return # this test is known to fail, we can implement it sometime in the future if we wish
from greentest import saranwrap_test from tests import saranwrap_test
prox = saranwrap.wrap([saranwrap_test.list_maker]) prox = saranwrap.wrap([saranwrap_test.list_maker])
self.assertEquals(list_maker(), prox[0]()) self.assertEquals(list_maker(), prox[0]())
@@ -325,7 +325,7 @@ sys_path = sys.path""")
# a function. Then we want to saranwrap that class, have # a function. Then we want to saranwrap that class, have
# the object call the coroutine and verify that it ran # the object call the coroutine and verify that it ran
from greentest import saranwrap_test from tests import saranwrap_test
mod_proxy = saranwrap.wrap(saranwrap_test) mod_proxy = saranwrap.wrap(saranwrap_test)
obj_proxy = mod_proxy.CoroutineCallingClass() obj_proxy = mod_proxy.CoroutineCallingClass()
obj_proxy.run_coroutine() obj_proxy.run_coroutine()

View File

@@ -1,4 +1,4 @@
from greentest import LimitedTestCase from tests import LimitedTestCase
from unittest import main from unittest import main
from eventlet import api, coros, proc from eventlet import api, coros, proc

View File

@@ -21,7 +21,7 @@
import unittest import unittest
from eventlet import api, coros from eventlet import api, coros
from greentest import LimitedTestCase from tests import LimitedTestCase
class TestSemaphore(LimitedTestCase): class TestSemaphore(LimitedTestCase):

View File

@@ -22,7 +22,7 @@
import unittest import unittest
from eventlet.coros import event from eventlet.coros import event
from eventlet.api import spawn, sleep, exc_after, with_timeout from eventlet.api import spawn, sleep, exc_after, with_timeout
from greentest import LimitedTestCase from tests import LimitedTestCase
DELAY= 0.01 DELAY= 0.01

View File

@@ -24,7 +24,7 @@ To do that spawn a green server and then access it using a green socket.
If either operation blocked the whole script would block and timeout. If either operation blocked the whole script would block and timeout.
""" """
import unittest import unittest
from greentest import test_support from tests import test_support
from eventlet.green import urllib2, BaseHTTPServer from eventlet.green import urllib2, BaseHTTPServer
from eventlet.api import spawn, kill from eventlet.api import spawn, kill

View File

@@ -1,5 +1,5 @@
from eventlet import pool, coros, api from eventlet import pool, coros, api
from greentest import LimitedTestCase from tests import LimitedTestCase
from unittest import main from unittest import main
class TestCoroutinePool(LimitedTestCase): class TestCoroutinePool(LimitedTestCase):

View File

@@ -23,7 +23,7 @@ import sys
import unittest import unittest
from eventlet.api import sleep, with_timeout from eventlet.api import sleep, with_timeout
from eventlet import api, proc, coros from eventlet import api, proc, coros
from greentest import LimitedTestCase from tests import LimitedTestCase
DELAY = 0.01 DELAY = 0.01

View File

@@ -20,7 +20,7 @@
# THE SOFTWARE. # THE SOFTWARE.
from twisted.internet import reactor from twisted.internet import reactor
from greentest import exit_unless_twisted from tests import exit_unless_twisted
exit_unless_twisted() exit_unless_twisted()
import unittest import unittest
from twisted.internet.error import DNSLookupError from twisted.internet.error import DNSLookupError

View File

@@ -20,7 +20,7 @@
# THE SOFTWARE. # THE SOFTWARE.
from twisted.internet import reactor from twisted.internet import reactor
from greentest import exit_unless_twisted from tests import exit_unless_twisted
exit_unless_twisted() exit_unless_twisted()
import unittest import unittest

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python
import unittest import unittest
from greentest import test_support from tests import test_support
from eventlet.green import socket from eventlet.green import socket
from eventlet.green import select from eventlet.green import select

View File

@@ -1,7 +1,7 @@
# Test just the SSL support in the socket module, in a moderately bogus way. # Test just the SSL support in the socket module, in a moderately bogus way.
import sys import sys
from greentest import test_support from tests import test_support
from eventlet.green import socket from eventlet.green import socket
import errno import errno
import unittest import unittest

View File

@@ -1,8 +1,8 @@
# Test suite for SocketServer.py # Test suite for SocketServer.py
# converted to unittest (Denis) # converted to unittest (Denis)
from greentest import test_support from tests import test_support
from greentest.test_support import (verbose, verify, TESTFN, TestSkipped, from tests.test_support import (verbose, verify, TESTFN, TestSkipped,
reap_children) reap_children)
test_support.requires('network') test_support.requires('network')

View File

@@ -1,6 +1,6 @@
"""Supporting definitions for the Python regression tests.""" """Supporting definitions for the Python regression tests."""
if __name__ != 'greentest.test_support': if __name__ != 'tests.test_support':
raise ImportError, 'test_support must be imported from the test package' raise ImportError, 'test_support must be imported from the test package'
import sys import sys

View File

@@ -2,7 +2,7 @@
# Create a bunch of threads, let each do some work, wait until all are done # Create a bunch of threads, let each do some work, wait until all are done
from greentest.test_support import verbose from tests.test_support import verbose
import random import random
from eventlet.green import thread from eventlet.green import thread
from eventlet.green import time from eventlet.green import time

View File

@@ -1,7 +1,7 @@
# Very rudimentary test of threading module # Very rudimentary test of threading module
import greentest.test_support import tests.test_support
from greentest.test_support import verbose from tests.test_support import verbose
import random import random
import sys import sys
from eventlet.green import threading from eventlet.green import threading
@@ -299,7 +299,7 @@ class ThreadJoinOnShutdown(unittest.TestCase):
def test_main(): def test_main():
greentest.test_support.run_unittest(ThreadTests, tests.test_support.run_unittest(ThreadTests,
ThreadJoinOnShutdown) ThreadJoinOnShutdown)
if __name__ == "__main__": if __name__ == "__main__":

View File

@@ -1,6 +1,6 @@
import unittest import unittest
from doctest import DocTestSuite from doctest import DocTestSuite
from greentest import test_support from tests import test_support
class ThreadingLocalTest(unittest.TestCase): class ThreadingLocalTest(unittest.TestCase):
def test_derived(self): def test_derived(self):

View File

@@ -1,7 +1,7 @@
"""Unit tests for socket timeout feature.""" """Unit tests for socket timeout feature."""
import unittest import unittest
from greentest import test_support from tests import test_support
# This requires the 'network' resource as given on the regrtest command line. # This requires the 'network' resource as given on the regrtest command line.
skip_expected = not test_support.is_resource_enabled('network') skip_expected = not test_support.is_resource_enabled('network')

View File

@@ -1,5 +1,5 @@
import unittest import unittest
from greentest import test_support from tests import test_support
import os import os
from eventlet.green import socket from eventlet.green import socket

View File

@@ -1,12 +1,12 @@
#!/usr/bin/env python #!/usr/bin/env python
from greentest import exit_unless_25; exit_unless_25() from tests import exit_unless_25; exit_unless_25()
import sys import sys
import urlparse import urlparse
import unittest import unittest
import hashlib import hashlib
from greentest import test_support from tests import test_support
from eventlet.green import threading from eventlet.green import threading
from eventlet.green import socket from eventlet.green import socket
from eventlet.green import urllib2 from eventlet.green import urllib2

View File

@@ -165,7 +165,7 @@ class TestTpool(TestCase):
self.assertEqual(opts.n, 'foo') self.assertEqual(opts.n, 'foo')
def test_contention(self): def test_contention(self):
from greentest import tpool_test from tests import tpool_test
prox = tpool.Proxy(tpool_test) prox = tpool.Proxy(tpool_test)
pool = coros.CoroutinePool(max_size=4) pool = coros.CoroutinePool(max_size=4)

View File

@@ -98,7 +98,7 @@ elif sys.argv[1:]==['--selftest1']:
pass pass
def test_long(self): def test_long(self):
time.sleep(10) time.sleep(10)
from greentest import test_support from tests import test_support
test_support.run_unittest(Test) test_support.run_unittest(Test)
sys.exit(0) sys.exit(0)
elif sys.argv[1:]==['--selftest2']: elif sys.argv[1:]==['--selftest2']:
@@ -108,7 +108,7 @@ elif sys.argv[1:]==['--selftest2']:
fail fail
def test_long(self): def test_long(self):
time.sleep(10) time.sleep(10)
from greentest import test_support from tests import test_support
test_support.run_unittest(Test) test_support.run_unittest(Test)
sys.exit(0) sys.exit(0)

View File

@@ -29,7 +29,7 @@ from eventlet import util
from eventlet import wsgi from eventlet import wsgi
from eventlet import processes from eventlet import processes
from greentest import find_command from tests import find_command
try: try:
from cStringIO import StringIO from cStringIO import StringIO