Mercurial > hg > simpypi
changeset 8:15c7171941ea
more stubbing for tests
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Tue, 28 Feb 2012 13:50:28 -0800 |
parents | 5ee4fe3decd9 |
children | 9879140a2026 |
files | setup.py simpypi/handlers.py tests-require.txt tests/doctest.txt tests/test.py |
diffstat | 5 files changed, 15 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- 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 """, ) -
--- 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')
--- /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
--- 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)
--- 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