Permalink
Browse files

Move tests from stango package to the toplevel directory

  • Loading branch information...
1 parent 710cfaf commit af823c88c1e8ac6188e08bf313e0523406d70039 @akheron committed Aug 21, 2010
View
@@ -23,8 +23,8 @@
cov.start()
# Import the Stango code down here to make coverage count the importing, too
-import stango.tests
-result = stango.tests.run(options.verbose)
+import tests
+result = tests.run(options.verbose)
if result.wasSuccessful() and options.coverage:
exclude = [
View
@@ -1,11 +0,0 @@
-def view_value(value):
- '''Construct a view that returns the given value when called'''
- def value_returner(context):
- return value
- return value_returner
-
-def view_template(template_name):
- '''Construct a view that renders the given template when called'''
- def template_renderer(context, **kwargs):
- return context.render_template(template_name, **kwargs)
- return template_renderer
@@ -43,12 +43,27 @@ def tearDown(self):
self.teardown()
+def view_value(value):
+ '''Construct a view that returns the given value when called'''
+ def value_returner(context):
+ return value
+ return value_returner
+
+
+def view_template(template_name):
+ '''Construct a view that renders the given template when called'''
+ def template_renderer(context, **kwargs):
+ return context.render_template(template_name, **kwargs)
+ return template_renderer
+
+
def make_suite(cls):
+ '''Makes a suite from all test functions in a TestCase class'''
return unittest.TestLoader().loadTestsFromTestCase(cls)
def suite():
- from stango.tests import \
+ from . import \
test_files, test_generate, test_main, test_manager, test_serve, \
test_views
suite = unittest.TestSuite()
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,12 +1,12 @@
from stango.files import Filespec, Files, files_from_dir, files_from_tar
from stango.views import file_from_tar, static_file
-from stango.tests import StangoTestCase, make_suite
import operator
import os
-def dummy_view(context):
- return ''
+from . import StangoTestCase, make_suite, view_value
+
+dummy_view = view_value('')
class FilesTestCase(StangoTestCase):
def test_Files_init(self):
@@ -4,8 +4,8 @@
from stango import Manager
from stango.files import Files
-from stango.tests import StangoTestCase, make_suite
-from stango.tests.util import view_value, view_template
+
+from . import StangoTestCase, make_suite, view_value, view_template
dummy_view = view_value('')
@@ -5,7 +5,8 @@
import stango.autoreload
import stango.main
from stango import Manager
-from stango.tests import StangoTestCase, make_suite
+
+from . import StangoTestCase, make_suite
# A fake HTTP server class whose serve_forever returns right away
class FakeHTTPServer(object):
@@ -3,7 +3,8 @@
from stango import Manager
from stango.files import Files
-from stango.tests import StangoTestCase, make_suite
+
+from . import StangoTestCase, make_suite
class ManagerTestCase(StangoTestCase):
def setup(self):
@@ -1,13 +1,13 @@
from stango import Manager
from stango.files import Files
-from stango.tests import StangoTestCase, make_suite
-from stango.tests.util import view_value, view_template
import functools
from threading import Thread
from urllib.request import urlopen
from urllib.error import HTTPError
+from . import StangoTestCase, make_suite, view_value, view_template
+
class ServeTestCase(StangoTestCase):
def setup(self):
self.manager = Manager()
@@ -1,9 +1,10 @@
from stango import Manager
from stango.files import files_from_dir, files_from_tar
-from stango.tests import StangoTestCase, make_suite
import os
+from . import StangoTestCase, make_suite
+
def filelist(path):
result = []
for dirpath, dirnames, filenames in os.walk(path):

0 comments on commit af823c8

Please sign in to comment.