Commit 0150e624 by Steven Bird

move run_doctests utility to top-level tools directory

parent dcd225fa
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
run the doctests in nltk.tag.tbl
"""
from __future__ import print_function
import glob, sys, subprocess, os.path
from os.path import abspath
currdir = os.getcwd()
if not currdir.endswith("nltk/tbl"):
raise RuntimeError("run me in /<PATH/TO/NLTK>/nltk/tbl/")
sys.path.insert(0, "../../..")
#a list of all the python files in this dir and two levels of subdirs
files = [pyfile for patt in ("*.py", "*/*.py", "*/*/*.py") for pyfile in glob.glob(patt)
if not abspath(__file__) == abspath(pyfile)]
for pyver in ["python2.6", "python2.7", "python3.2", "python3.3"]:
for (i, f) in enumerate(files, 1):
print(pyver, i, f, file=sys.stderr)
subprocess.call([pyver, "-m", "doctest", f])
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
run doctests
"""
from __future__ import print_function
import sys, subprocess, os
for root, dirs, filenames in os.walk('.'):
for filename in filenames:
if filename.endswith('.py'):
path = os.path.join(root, filename)
for pyver in ["python2.6", "python2.7", "python3.2"]:
print(pyver, filename, file=sys.stderr)
subprocess.call([pyver, "-m", "doctest", path])
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment