On Tue, Dec 9, 2008 at 10:31 AM, Ondrej Certik <[EMAIL PROTECTED]> wrote: > > This is achieved by looking for the __init__.py file and if it's missing, it > means that such file cannot be imported in python using the "import something" > syntax (for example all tests in sympy are such a case). > --- > sympy/utilities/runtests.py | 15 +++++++++++++++ > 1 files changed, 15 insertions(+), 0 deletions(-) > > diff --git a/sympy/utilities/runtests.py b/sympy/utilities/runtests.py > index 3306e7e..5cd1022 100644 > --- a/sympy/utilities/runtests.py > +++ b/sympy/utilities/runtests.py > @@ -370,11 +370,26 @@ class SymPyDocTests(object): > """ > Returns the list of tests. > """ > + def importable(x): > + """ > + Is the file "x" importable?
You're not looking at if a file is importable, here you are checking to see that a directory is a module. I would probably spell it out a bit more for example: Checks if given pathname x is an importable module by checking for __init__.py file. > + > + Returns True/False. > + spelling should be __init__.py in next line. > + Currently we only test if the __init_.py file exists in the > + directory with the file "x" (in theory we should also test all > the > + parent dirs). > + """ > + init_py = os.path.dirname(x) + os.path.sep + "__init__.py" > + return os.path.exists(init_py) > + > g = [] > for x in self.get_paths(dir): > g.extend(glob(x)) > g = list(set(g)) > g.sort() > + # skip files that are not importable (i.e. missing __init__.py) > + g = [x for x in g if importable(x)] > return g > > class Reporter(object): > -- > 1.6.0.4 > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sympy-patches" group. To post to this group, send email to sympy-patches@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sympy-patches?hl=en -~----------~----~----~----~------~----~------~--~---