# HG changeset patch # User Jeff Hammel # Date 1330465828 28800 # Node ID 15c7171941ea6e9bdd523ea4c3bffa12ec679ffe # Parent 5ee4fe3decd92537ed5550fdff3bf3f7b50030bf more stubbing for tests diff -r 5ee4fe3decd9 -r 15c7171941ea setup.py --- a/setup.py Tue Feb 28 10:30:44 2012 -0800 +++ b/setup.py Tue Feb 28 13:50:28 2012 -0800 @@ -2,7 +2,7 @@ try: description = file('README.txt').read() -except IOError: +except IOError: description = '' version = "0.0" @@ -21,7 +21,7 @@ zip_safe=False, install_requires=[ # -*- Extra requirements: -*- - 'WebOb', + 'WebOb', 'Paste', 'PasteScript', 'genshi', @@ -29,8 +29,5 @@ ], entry_points=""" # -*- Entry points: -*- - [paste.app_factory] - simpypi = simpypi.factory:factory """, ) - diff -r 5ee4fe3decd9 -r 15c7171941ea simpypi/handlers.py --- a/simpypi/handlers.py Tue Feb 28 10:30:44 2012 -0800 +++ b/simpypi/handlers.py Tue Feb 28 13:50:28 2012 -0800 @@ -81,6 +81,7 @@ methods=set(['GET', 'POST']) def Post(self): + """handle posting a package""" # get the package package = self.request.POST.get('package') diff -r 5ee4fe3decd9 -r 15c7171941ea tests-require.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests-require.txt Tue Feb 28 13:50:28 2012 -0800 @@ -0,0 +1,1 @@ +Paste diff -r 5ee4fe3decd9 -r 15c7171941ea tests/doctest.txt --- a/tests/doctest.txt Tue Feb 28 10:30:44 2012 -0800 +++ b/tests/doctest.txt Tue Feb 28 13:50:28 2012 -0800 @@ -3,14 +3,5 @@ The obligatory imports:: - >>> import shutil >>> import simpypi - >>> import tempfile - -Make a temporary package directory:: - >>> directory = tempfile.mkdtemp() - -Cleanup:: - - >>> shutil.rmtree(directory) diff -r 5ee4fe3decd9 -r 15c7171941ea tests/test.py --- a/tests/test.py Tue Feb 28 10:30:44 2012 -0800 +++ b/tests/test.py Tue Feb 28 13:50:28 2012 -0800 @@ -6,9 +6,11 @@ import doctest import os +import shutil import sys +import tempfile from optparse import OptionParser - +from paste.fixture import TestApp def run_tests(raise_on_error=False, report_first=False): @@ -28,12 +30,20 @@ # run the tests for test in tests: + + # make a temporary directory + tmpdir = tempfile.mkdtemp() + doctest_args['extraglobs']['directory'] = tmpdir + try: results[test] = doctest.testfile(test, **doctest_args) except doctest.DocTestFailure, failure: raise except doctest.UnexpectedException, failure: raise failure.exc_info[0], failure.exc_info[1], failure.exc_info[2] + finally: + if os.path.exists(tmpdir): + shutil.rmtree(tmpdir) return results