Skip to content

Commit

Permalink
Ignore __main__ modules.
Browse files Browse the repository at this point in the history
  • Loading branch information
thefunny42 committed Jul 23, 2010
1 parent 3102d22 commit a0cb009
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 2 deletions.
5 changes: 4 additions & 1 deletion CHANGES.txt
Expand Up @@ -4,7 +4,10 @@ CHANGES
0.13 (unreleased)
=================

- Nothing changed yet.
Feature changes
---------------

* Ignore all __main__ modules.


0.12 (2009-06-29)
Expand Down
2 changes: 1 addition & 1 deletion src/martian/scan.py
Expand Up @@ -83,7 +83,7 @@ def getSubModuleInfos(self):
entry_path = os.path.join(directory, entry)
name, ext = os.path.splitext(entry)
dotted_name = self.dotted_name + '.' + name
if self.exclude_filter(name):
if self.exclude_filter(name) or name == '__main__':
continue
if self.ignore_nonsource:
if ext in ['.pyo', '.pyc']:
Expand Down
8 changes: 8 additions & 0 deletions src/martian/scan.txt
Expand Up @@ -197,6 +197,14 @@ nor 'ftests' we could do::
>>> print module_info.getSubModuleInfos()
[<ModuleInfo object for 'martian.tests.withtestsmodules.subpackage'>]

By default __main__ packages are always ignored::

>>> module_info = module_info_from_dotted_name(
... 'martian.tests.with__main__')
>>> print module_info.getSubModuleInfos()
[<ModuleInfo object for 'martian.tests.with__main__.package'>]


Non-modules that look like modules
----------------------------------

Expand Down
1 change: 1 addition & 0 deletions src/martian/tests/with__main__/__init__.py
@@ -0,0 +1 @@
# this is a package
6 changes: 6 additions & 0 deletions src/martian/tests/with__main__/__main__.py
@@ -0,0 +1,6 @@

def main():
print "Hello"

main()

3 changes: 3 additions & 0 deletions src/martian/tests/with__main__/package.py
@@ -0,0 +1,3 @@

class Package(object):
pass

0 comments on commit a0cb009

Please sign in to comment.