zc.customdoctests-1.0.1/0000755000000000000000000000000013020144270013676 5ustar rootrootzc.customdoctests-1.0.1/src/0000755000000000000000000000000013020144270014465 5ustar rootrootzc.customdoctests-1.0.1/src/zc/0000755000000000000000000000000013020144270015101 5ustar rootrootzc.customdoctests-1.0.1/src/zc/customdoctests/0000755000000000000000000000000013020144270020164 5ustar rootrootzc.customdoctests-1.0.1/src/zc/customdoctests/README.txt0000664000000000000000000000161612107105602021671 0ustar rootrootCustom doctest parsers ---------------------- zc.customdoctests provides a little bit of help with creating custom doctest parsers that work pretty muct like regular doctests, but that use an alternate means of evaluating examples. To use it, you call zc.customdoctests.DocTestParser and pass any of the following options: ps1 The first-line prompt, which defaultd to ``'>>>'``. This must be a regular expression that matches exactly 3 characters. (Note that you can't override the second-line prompt.) comment_prefix The comment prefix regular expression, which defaults to '#'. transform A function used to transform example source, which defaults to a no-operation function. The js module provides support for using JavaScript in doctests using `python-spidermonkey `_. It provides some examples of defining custom doctest parsers. zc.customdoctests-1.0.1/src/zc/customdoctests/__init__.py0000664000000000000000000000427312107105602022306 0ustar rootroot############################################################################## # # Copyright (c) 2011 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## import doctest import re import sys class DocTestParser(doctest.DocTestParser): "Doctest parser that creates calls into JavaScript." def __init__(self, *args, **kw): ps1 = kw.pop('ps1', '>>>') comment_prefix = kw.pop('comment_prefix', '#') self.transform = kw.pop('transform', lambda s: s) try: getattr( doctest.DocTestParser, '__init__', lambda : None)(*args, **kw) except TypeError: # Python 3 support. super(doctest.DocTestParser, self).__init__(*args, **kw) self._EXAMPLE_RE = re.compile( r''' # Source consists of a PS1 line followed by zero or more PS2 lines. (?P (?:^(?P [ ]*) %(ps1)s .*) # PS1 line (?:\n [ ]* \.\.\. .*)*) # PS2 lines \n? # Want consists of any non-blank lines that do not start with PS1. (?P (?:(?![ ]*$) # Not a blank line (?![ ]*%(ps1)s) # Not a line starting with PS1 .*$\n? # But any other line )*) ''' % dict(ps1=ps1), re.MULTILINE | re.VERBOSE) self._OPTION_DIRECTIVE_RE = re.compile( comment_prefix +r'\s*doctest:\s*([^\n\'"]*)$', re.MULTILINE) def parse(self, string, name=''): r =doctest.DocTestParser.parse(self, string, name) for s in r: if isinstance(s, doctest.Example): s.source = self.transform(s.source) return r zc.customdoctests-1.0.1/src/zc/customdoctests/tests.py0000664000000000000000000000421412107105602021704 0ustar rootroot############################################################################## # # Copyright (c) 2010 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## # from zope.testing import setupstack # import manuel.capture # import manuel.doctest # import manuel.testing import unittest import doctest import zc.customdoctests.js def custom_doctest_parser(): r""" >>> [e] = zc.customdoctests.DocTestParser().get_examples(''' ... ... >>> 2 + 2 # doctest: +ELLIPSIS ... 5 ... ... ''') >>> e.source, e.want, e.options == {doctest.ELLIPSIS: True} ('2 + 2 # doctest: +ELLIPSIS\n', '5\n', True) >>> [e] = zc.customdoctests.DocTestParser( ... ps1='js>', comment_prefix='//', transform=lambda s: 'JS(%r)' % s ... ).get_examples(''' ... ... js> 2 + ... ... 2 // doctest: +ELLIPSIS ... 5 ... ... >>> x ... 1 ... ... ''') >>> e.source, e.want, e.options == {doctest.ELLIPSIS: True} ("JS('2 +\\n2 // doctest: +ELLIPSIS\\n')", '5\n', True) """ def test_suite(): suite = unittest.TestSuite([doctest.DocTestSuite()]) try: import spidermonkey except ImportError: pass else: import manuel.capture import manuel.doctest import manuel.testing suite.addTest( manuel.testing.TestSuite( manuel.doctest.Manuel(parser=zc.customdoctests.js.parser) + manuel.doctest.Manuel(parser=zc.customdoctests.js.eq_parser) + manuel.doctest.Manuel() + manuel.capture.Manuel(), 'spidermonkey.txt', setUp=zc.customdoctests.js.spidermonkeySetUp) ) return suite zc.customdoctests-1.0.1/src/zc/customdoctests/spidermonkey.txt0000664000000000000000000000547012107105602023447 0ustar rootrootJavascript and Python-Spidermonkey support ------------------------------------------ .. This file shows some examples of using spidermonkey APIs in doctests. To wire this up, you'd use something like:: import doctest, zc.customdoctests.js test_suite = doctest.DocTestSuite( parser=zc.customdoctests.js.parser, setUp=zc.customdoctests.js.spidermonkeySetUp) Or, with manuel:: test_suite = manuel.testing.TestSuite( manuel.doctest.Manuel(parser=zc.customdoctests.js.parser) + manuel.doctest.Manuel(parser=zc.customdoctests.js.eq_parser) + manuel.doctest.Manuel() + manuel.capture.Manuel(), 'spidermonkey.txt', setUp=zc.customdoctests.js.spidermonkeySetUp) Note that zc.customdoctests doesn't require spidermonkey, so you need to install spidermonkey seperately if you want to use it. An advantage of using manuel is that you can use multiple parsers in the same document. In the example, above, 2 javascript example syntaxes (described below) as well as the standard doctest syntax are supported. This document is run with manuel to allow all 3 syntaxes. For the rest of this document, we'll show examples of JavaScript doctests as well as helper APIs used to support JavaScript and to integrate JavaScript and Python. Javascript doctests use a "js>" prompt (as used in rhino and the spidermonkey interpreter):: js> 2 + ... 'Hi world' // doctest: +ELLIPSIS u'2Hi... Assignments return values. This can generate annoying output in doctests:: js> ob = {a: 1, b: 2} [object Object] If you're using manuel, you can avoid this by using js!:: js! x = 3 which suppresses expression values. load and print functions (similar to those found in rhino) are provided. For example, given a javascript file, double.js:: function double (x) { return x*2; } .. -> src >>> with open('double.js', 'w') as f: ... f.write(src) We can load the file:: js> load('double.js') js> double(10) 20 We can print values:: js> print('Hi') Hi A python object provides access to the open function and the os module:: js> python.os.path.exists('double.js') True js! f = python.open('double.js') js> print(f.read()) function double (x) { return x*2; } js> f.close() If you're using manuel, you can intermix Python and and JavaScript examples and there are a number of APIs to facilitate using Python and JavaScript together. There's an add_js_global function to copy data from Python:: >>> add_js_global('y', 1) js> y 1 There's also a js object that provides attribute access to js globals:: >>> js.x 3 >>> js.z = 4 js> z 4 You can also call this to run JS code without returning the resulting value:: >>> js('a = x + y') js> a 4 zc.customdoctests-1.0.1/src/zc/customdoctests/js.py0000664000000000000000000000674412107105602021170 0ustar rootroot############################################################################## # # Copyright (c) 2011 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## import doctest import os import re import sys import zc.customdoctests run_time = None def transform(s, f='JS'): if s[-1] == '\n': return (r'%s(r"""%s"""+"\n")' % (f, s)) + '\n' else: return r'%s(r"""%s""")' % (f, s) parser = zc.customdoctests.DocTestParser( ps1='js>', comment_prefix='//', transform=transform) # parser_ is like parser, except adds: var _ = to # the fron of the executed code. eq_parser = zc.customdoctests.DocTestParser( ps1='js!', comment_prefix='//', transform=lambda s: transform(s, 'JS_')) # spidermonkey hacks below: class JavaScriptError(Exception): def __str__(self): try: return "%s\nJS Traceback:%s" % ( self.args[0].message, '\n'.join(reversed(self.args[0].stack.split('\n'))) ) except: return str(self.args[0]) class ContextConvenience(object): def __init__(self, context): object.__setattr__(self, '_context', context) def __getattr__(self, name): return self._context.execute(name) def __setattr__(self, name, v): self._context.add_global(name, v) def __call__(self, src): self._context.execute(load_template % src) if self.spidermonkey_error is not None: raise JavaScriptError(self.spidermonkey_error) def spidermonkeySetUp(test_or_self=None): global run_time if run_time is None: import spidermonkey run_time = spidermonkey.Runtime() cx = run_time.new_context() JS = cx.execute js = ContextConvenience(cx) if test_or_self is not None: globs = getattr(test_or_self, 'globs', test_or_self.__dict__) globs['JS'] = JS globs['JS_'] = js globs['js'] = js globs['add_js_global'] = cx.add_global def load_(name): if name.startswith('file://'): name = name[7:] return JS(load_template % open(name).read(), name) # Rhino & spidermonkey/js compatability functions cx.add_global('python', dict( os = os, open = open, )) cx.add_global('load_', load_) JS(load_js) cx.add_global('print', lambda *s: sys.stdout.write(('%s\n' % ' '.join(map(unicode, s))).encode('utf-8')) ) cx.add_global('printe', lambda *s: sys.stderr.write('%s\n' % ' '.join(map(unicode, s))) ) return js load_template = ("spidermonkey_error = undefined; " "try { %s } catch (e) {spidermonkey_error = e;}") load_js = """ function load(p) { if (p.slice(0, 7) == 'file://') { p = p.slice(7); } try { console.debug('loading', p); } catch (e) {} if (! python.os.path.exists(p)) { throw "Doesn't exist: "+p; } var result = load_(p); if (spidermonkey_error) { throw spidermonkey_error; } return result; } """ zc.customdoctests-1.0.1/src/zc/__init__.py0000664000000000000000000000025012107105602017212 0ustar rootroottry: __import__('pkg_resources').declare_namespace(__name__) except ImportError: from pkgutil import extend_path __path__ = extend_path(__path__, __name__) zc.customdoctests-1.0.1/src/zc.customdoctests.egg-info/0000755000000000000000000000000013020144270021655 5ustar rootrootzc.customdoctests-1.0.1/src/zc.customdoctests.egg-info/top_level.txt0000664000000000000000000000000312107106242024404 0ustar rootrootzc zc.customdoctests-1.0.1/src/zc.customdoctests.egg-info/namespace_packages.txt0000664000000000000000000000000312107106242026205 0ustar rootrootzc zc.customdoctests-1.0.1/src/zc.customdoctests.egg-info/SOURCES.txt0000664000000000000000000000107212107106242023545 0ustar rootrootCHANGES.txt MANIFEST.in README.txt buildout.cfg setup.py tox.ini src/zc/__init__.py src/zc.customdoctests.egg-info/PKG-INFO src/zc.customdoctests.egg-info/SOURCES.txt src/zc.customdoctests.egg-info/dependency_links.txt src/zc.customdoctests.egg-info/namespace_packages.txt src/zc.customdoctests.egg-info/not-zip-safe src/zc.customdoctests.egg-info/requires.txt src/zc.customdoctests.egg-info/top_level.txt src/zc/customdoctests/README.txt src/zc/customdoctests/__init__.py src/zc/customdoctests/js.py src/zc/customdoctests/spidermonkey.txt src/zc/customdoctests/tests.pyzc.customdoctests-1.0.1/src/zc.customdoctests.egg-info/requires.txt0000664000000000000000000000010012107106242024250 0ustar rootrootsetuptools [test] zope.testing manuel [js] python-spidermonkeyzc.customdoctests-1.0.1/src/zc.customdoctests.egg-info/not-zip-safe0000664000000000000000000000000112107105602024106 0ustar rootroot zc.customdoctests-1.0.1/src/zc.customdoctests.egg-info/PKG-INFO0000664000000000000000000001576212107106242022771 0ustar rootrootMetadata-Version: 1.1 Name: zc.customdoctests Version: 1.0.1 Summary: ===================================================== Home-page: http://pypi.python.org/pypi/zc.customdoctests Author: Jim Fulton Author-email: jim@zope.com License: ZPL 2.1 Description: ===================================================== zc.customdoctests -- Use doctest with other languages ===================================================== doctest (and recently manuel) provide hooks for using custom doctest parsers. `zc.customdoctests` helps to leverage this to support other languages, such as JavaScript:: js> function double (x) { ... return x*2; ... } js> double(2) 4 And with `manuel `_, it facilitates doctests that mix multiple languages, such as Python, JavaScript, and sh. .. contents:: Detailed documentation ====================== Custom doctest parsers ---------------------- zc.customdoctests provides a little bit of help with creating custom doctest parsers that work pretty muct like regular doctests, but that use an alternate means of evaluating examples. To use it, you call zc.customdoctests.DocTestParser and pass any of the following options: ps1 The first-line prompt, which defaultd to ``'>>>'``. This must be a regular expression that matches exactly 3 characters. (Note that you can't override the second-line prompt.) comment_prefix The comment prefix regular expression, which defaults to '#'. transform A function used to transform example source, which defaults to a no-operation function. The js module provides support for using JavaScript in doctests using `python-spidermonkey `_. It provides some examples of defining custom doctest parsers. Javascript and Python-Spidermonkey support ------------------------------------------ .. This file shows some examples of using spidermonkey APIs in doctests. To wire this up, you'd use something like:: import doctest, zc.customdoctests.js test_suite = doctest.DocTestSuite( parser=zc.customdoctests.js.parser, setUp=zc.customdoctests.js.spidermonkeySetUp) Or, with manuel:: test_suite = manuel.testing.TestSuite( manuel.doctest.Manuel(parser=zc.customdoctests.js.parser) + manuel.doctest.Manuel(parser=zc.customdoctests.js.eq_parser) + manuel.doctest.Manuel() + manuel.capture.Manuel(), 'spidermonkey.txt', setUp=zc.customdoctests.js.spidermonkeySetUp) Note that zc.customdoctests doesn't require spidermonkey, so you need to install spidermonkey seperately if you want to use it. An advantage of using manuel is that you can use multiple parsers in the same document. In the example, above, 2 javascript example syntaxes (described below) as well as the standard doctest syntax are supported. This document is run with manuel to allow all 3 syntaxes. For the rest of this document, we'll show examples of JavaScript doctests as well as helper APIs used to support JavaScript and to integrate JavaScript and Python. Javascript doctests use a "js>" prompt (as used in rhino and the spidermonkey interpreter):: js> 2 + ... 'Hi world' // doctest: +ELLIPSIS u'2Hi... Assignments return values. This can generate annoying output in doctests:: js> ob = {a: 1, b: 2} [object Object] If you're using manuel, you can avoid this by using js!:: js! x = 3 which suppresses expression values. load and print functions (similar to those found in rhino) are provided. For example, given a javascript file, double.js:: function double (x) { return x*2; } .. -> src >>> with open('double.js', 'w') as f: ... f.write(src) We can load the file:: js> load('double.js') js> double(10) 20 We can print values:: js> print('Hi') Hi A python object provides access to the open function and the os module:: js> python.os.path.exists('double.js') True js! f = python.open('double.js') js> print(f.read()) function double (x) { return x*2; } js> f.close() If you're using manuel, you can intermix Python and and JavaScript examples and there are a number of APIs to facilitate using Python and JavaScript together. There's an add_js_global function to copy data from Python:: >>> add_js_global('y', 1) js> y 1 There's also a js object that provides attribute access to js globals:: >>> js.x 3 >>> js.z = 4 js> z 4 You can also call this to run JS code without returning the resulting value:: >>> js('a = x + y') js> a 4 Changelog ========= 1.0.1 (2013-02-14) ------------------ - Nothing changed yet. 1.0.0 (2013-02-13) ------------------ - Added Python 3.3 support. - Cleanup `setup.py`, add `tox.ini` and manifest. 0.1.0 (2011-05-19) ------------------ - Initial release Platform: UNKNOWN Classifier: Development Status :: 4 - Beta Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: Zope Public License Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 2.6 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.3 Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Natural Language :: English Classifier: Operating System :: OS Independent Classifier: Topic :: Software Development zc.customdoctests-1.0.1/src/zc.customdoctests.egg-info/dependency_links.txt0000664000000000000000000000000112107106242025727 0ustar rootroot zc.customdoctests-1.0.1/buildout.cfg0000664000000000000000000000046312107105602016214 0ustar rootroot[buildout] develop = . parts = test test3 py [test] recipe = zc.recipe.testrunner eggs = zc.customdoctests [test,js] [test3] # python-spidermonkey does not run on Python 3 yet. recipe = zc.recipe.testrunner eggs = zc.customdoctests [test] [py] recipe = zc.recipe.egg eggs = ${test:eggs} interpreter = py zc.customdoctests-1.0.1/PKG-INFO0000664000000000000000000001576212107106252015013 0ustar rootrootMetadata-Version: 1.1 Name: zc.customdoctests Version: 1.0.1 Summary: ===================================================== Home-page: http://pypi.python.org/pypi/zc.customdoctests Author: Jim Fulton Author-email: jim@zope.com License: ZPL 2.1 Description: ===================================================== zc.customdoctests -- Use doctest with other languages ===================================================== doctest (and recently manuel) provide hooks for using custom doctest parsers. `zc.customdoctests` helps to leverage this to support other languages, such as JavaScript:: js> function double (x) { ... return x*2; ... } js> double(2) 4 And with `manuel `_, it facilitates doctests that mix multiple languages, such as Python, JavaScript, and sh. .. contents:: Detailed documentation ====================== Custom doctest parsers ---------------------- zc.customdoctests provides a little bit of help with creating custom doctest parsers that work pretty muct like regular doctests, but that use an alternate means of evaluating examples. To use it, you call zc.customdoctests.DocTestParser and pass any of the following options: ps1 The first-line prompt, which defaultd to ``'>>>'``. This must be a regular expression that matches exactly 3 characters. (Note that you can't override the second-line prompt.) comment_prefix The comment prefix regular expression, which defaults to '#'. transform A function used to transform example source, which defaults to a no-operation function. The js module provides support for using JavaScript in doctests using `python-spidermonkey `_. It provides some examples of defining custom doctest parsers. Javascript and Python-Spidermonkey support ------------------------------------------ .. This file shows some examples of using spidermonkey APIs in doctests. To wire this up, you'd use something like:: import doctest, zc.customdoctests.js test_suite = doctest.DocTestSuite( parser=zc.customdoctests.js.parser, setUp=zc.customdoctests.js.spidermonkeySetUp) Or, with manuel:: test_suite = manuel.testing.TestSuite( manuel.doctest.Manuel(parser=zc.customdoctests.js.parser) + manuel.doctest.Manuel(parser=zc.customdoctests.js.eq_parser) + manuel.doctest.Manuel() + manuel.capture.Manuel(), 'spidermonkey.txt', setUp=zc.customdoctests.js.spidermonkeySetUp) Note that zc.customdoctests doesn't require spidermonkey, so you need to install spidermonkey seperately if you want to use it. An advantage of using manuel is that you can use multiple parsers in the same document. In the example, above, 2 javascript example syntaxes (described below) as well as the standard doctest syntax are supported. This document is run with manuel to allow all 3 syntaxes. For the rest of this document, we'll show examples of JavaScript doctests as well as helper APIs used to support JavaScript and to integrate JavaScript and Python. Javascript doctests use a "js>" prompt (as used in rhino and the spidermonkey interpreter):: js> 2 + ... 'Hi world' // doctest: +ELLIPSIS u'2Hi... Assignments return values. This can generate annoying output in doctests:: js> ob = {a: 1, b: 2} [object Object] If you're using manuel, you can avoid this by using js!:: js! x = 3 which suppresses expression values. load and print functions (similar to those found in rhino) are provided. For example, given a javascript file, double.js:: function double (x) { return x*2; } .. -> src >>> with open('double.js', 'w') as f: ... f.write(src) We can load the file:: js> load('double.js') js> double(10) 20 We can print values:: js> print('Hi') Hi A python object provides access to the open function and the os module:: js> python.os.path.exists('double.js') True js! f = python.open('double.js') js> print(f.read()) function double (x) { return x*2; } js> f.close() If you're using manuel, you can intermix Python and and JavaScript examples and there are a number of APIs to facilitate using Python and JavaScript together. There's an add_js_global function to copy data from Python:: >>> add_js_global('y', 1) js> y 1 There's also a js object that provides attribute access to js globals:: >>> js.x 3 >>> js.z = 4 js> z 4 You can also call this to run JS code without returning the resulting value:: >>> js('a = x + y') js> a 4 Changelog ========= 1.0.1 (2013-02-14) ------------------ - Nothing changed yet. 1.0.0 (2013-02-13) ------------------ - Added Python 3.3 support. - Cleanup `setup.py`, add `tox.ini` and manifest. 0.1.0 (2011-05-19) ------------------ - Initial release Platform: UNKNOWN Classifier: Development Status :: 4 - Beta Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: Zope Public License Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 2.6 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.3 Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Natural Language :: English Classifier: Operating System :: OS Independent Classifier: Topic :: Software Development zc.customdoctests-1.0.1/setup.cfg0000664000000000000000000000007312107106252015524 0ustar rootroot[egg_info] tag_build = tag_date = 0 tag_svn_revision = 0 zc.customdoctests-1.0.1/CHANGES.txt0000664000000000000000000000040612107105602015512 0ustar rootrootChangelog ========= 1.0.1 (2013-02-14) ------------------ - Nothing changed yet. 1.0.0 (2013-02-13) ------------------ - Added Python 3.3 support. - Cleanup `setup.py`, add `tox.ini` and manifest. 0.1.0 (2011-05-19) ------------------ - Initial release zc.customdoctests-1.0.1/setup.py0000664000000000000000000000471312107105602015420 0ustar rootroot############################################################################## # # Copyright (c) Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## import os from setuptools import setup, find_packages here = os.path.dirname(__file__) def read(filename): with open(os.path.join(here, filename)) as f: return f.read() install_requires = ['setuptools'] extras_require = dict( test=['zope.testing', 'manuel'], js=['python-spidermonkey'], ) setup( name='zc.customdoctests', version='1.0.1', url='http://pypi.python.org/pypi/zc.customdoctests', license='ZPL 2.1', description=read('README.txt').splitlines(False)[0], author='Jim Fulton', author_email='jim@zope.com', classifiers=[ 'Development Status :: 4 - Beta', 'Intended Audience :: Developers', 'License :: OSI Approved :: Zope Public License', 'Programming Language :: Python', 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: Implementation :: CPython', 'Natural Language :: English', 'Operating System :: OS Independent', 'Topic :: Software Development', ], long_description=''.join([ read('README.txt'), '\n\n' 'Detailed documentation\n' '======================\n\n', read('src/zc/customdoctests/README.txt'), '\n\n', read('src/zc/customdoctests/spidermonkey.txt'), '\n\n', read('CHANGES.txt'), ]), packages=find_packages('src'), package_dir={'': 'src'}, namespace_packages=['zc',], install_requires=install_requires, package_data={'zc.customdoctests': ['*.txt']}, extras_require=extras_require, tests_require=extras_require['test'], test_suite='zc.customdoctests.tests.test_suite', zip_safe=False, ) zc.customdoctests-1.0.1/README.txt0000664000000000000000000000111112107105602015371 0ustar rootroot===================================================== zc.customdoctests -- Use doctest with other languages ===================================================== doctest (and recently manuel) provide hooks for using custom doctest parsers. `zc.customdoctests` helps to leverage this to support other languages, such as JavaScript:: js> function double (x) { ... return x*2; ... } js> double(2) 4 And with `manuel `_, it facilitates doctests that mix multiple languages, such as Python, JavaScript, and sh. .. contents:: zc.customdoctests-1.0.1/tox.ini0000664000000000000000000000115412107105602015215 0ustar rootroot[tox] envlist = py26,py27,py33 [testenv] commands = python setup.py test -q # without explicit deps, setup.py test will download a bunch of eggs into $PWD deps = manuel zope.testrunner zope.testing [testenv:coverage] basepython = python2.7 commands = # The installed version messes up nose's test discovery / coverage reporting # So, we uninstall that from the environment, and then install the editable # version, before running nosetests. pip uninstall -y zc.customdoctests pip install -e . nosetests --with-xunit --with-xcoverage deps = nose coverage nosexcover zc.customdoctests-1.0.1/MANIFEST.in0000664000000000000000000000020512107105602015434 0ustar rootrootinclude *.rst include *.txt include tox.ini include bootstrap.py include buildout.cfg recursive-include src * global-exclude *.pyc