added exit_unless_twisted function to greentest; moved my code from test_support.py to greentest/__init__.py

This commit is contained in:
Denis Bilenko
2008-12-10 16:10:48 +06:00
parent a40d7cfa52
commit 2ec37b1d82
4 changed files with 17 additions and 11 deletions

View File

@@ -1 +1,13 @@
# package is named greentest, not test, so it won't be confused with test in stdlib # package is named greentest, not test, so it won't be confused with test in stdlib
import sys
disabled_marker = '-*-*-*-*-*- disabled -*-*-*-*-*-'
def exit_disabled():
sys.exit(disabled_marker)
def exit_unless_twisted():
from eventlet.api import get_hub
if 'Twisted' not in type(get_hub()).__name__:
exit_disabled()

View File

@@ -7,7 +7,7 @@ import sys
import os import os
import sqlite3 import sqlite3
import warnings import warnings
from greentest.test_support import disabled_marker from greentest import disabled_marker
warnings.simplefilter('ignore') warnings.simplefilter('ignore')

View File

@@ -1,14 +1,12 @@
from twisted.internet import reactor
from greentest import exit_unless_twisted
exit_unless_twisted()
import sys import sys
import unittest import unittest
from twisted.internet.error import DNSLookupError from twisted.internet.error import DNSLookupError
from twisted.internet import defer from twisted.internet import defer
from twisted.python.failure import Failure from twisted.python.failure import Failure
from eventlet.twistedutil import block_on from eventlet.twistedutil import block_on
from eventlet.api import get_hub
from greentest.test_support import exit_disabled
if 'Twisted' not in type(get_hub()).__name__:
exit_disabled()
class Test(unittest.TestCase): class Test(unittest.TestCase):

View File

@@ -5,10 +5,6 @@ if __name__ != 'greentest.test_support':
import sys import sys
disabled_marker = '-*-*-*-*-*- disabled -*-*-*-*-*-'
def exit_disabled():
sys.exit(disabled_marker)
class Error(Exception): class Error(Exception):
"""Base class for regression test exceptions.""" """Base class for regression test exceptions."""