<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>TestData/PackageA/ModuleA.py</filename>
    </added>
    <added>
      <filename>TestData/PackageA/NestedPackage/EvenMore/ModuleC.py</filename>
    </added>
    <added>
      <filename>TestData/PackageA/NestedPackage/EvenMore/__init__.py</filename>
    </added>
    <added>
      <filename>TestData/PackageA/NestedPackage/__init__.py</filename>
    </added>
    <added>
      <filename>TestData/PackageA/__init__.py</filename>
    </added>
    <added>
      <filename>TestData/PackageB/__init__.py</filename>
    </added>
    <added>
      <filename>TestData/standalone.py</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -87,11 +87,11 @@ class FunctionalTest(unittest.TestCase):
 
 
     def testMultiPackage(self):
-        if os.path.exists('Tests/PYSMELLTAGS'):
-            os.remove('Tests/PYSMELLTAGS')
-        subprocess.call([&quot;python&quot;, &quot;../pysmelltags.py&quot;, &quot;PackageA&quot;, &quot;PackageB&quot;], cwd='Tests')
-        self.assertTrue(os.path.exists('Tests/PYSMELLTAGS'))
-        PYSMELLDICT = eval(open('Tests/PYSMELLTAGS').read())
+        if os.path.exists('TestData/PYSMELLTAGS'):
+            os.remove('TestData/PYSMELLTAGS')
+        subprocess.call([&quot;python&quot;, &quot;../pysmelltags.py&quot;, &quot;PackageA&quot;, &quot;PackageB&quot;], cwd='TestData')
+        self.assertTrue(os.path.exists('TestData/PYSMELLTAGS'))
+        PYSMELLDICT = eval(open('TestData/PYSMELLTAGS').read())
         expectedDict = {}
         expectedDict.update(self.packageA)
         expectedDict['CLASSES'].update(self.packageB['CLASSES'])
@@ -102,46 +102,58 @@ class FunctionalTest(unittest.TestCase):
 
 
     def testPackageA(self):
-        if os.path.exists('Tests/PYSMELLTAGS'):
-            os.remove('Tests/PYSMELLTAGS')
-        subprocess.call([&quot;python&quot;, &quot;../pysmelltags.py&quot;, &quot;PackageA&quot;], cwd='Tests')
-        self.assertTrue(os.path.exists('Tests/PYSMELLTAGS'))
-        PYSMELLDICT = eval(open('Tests/PYSMELLTAGS').read())
+        if os.path.exists('TestData/PYSMELLTAGS'):
+            os.remove('TestData/PYSMELLTAGS')
+        subprocess.call([&quot;python&quot;, &quot;../pysmelltags.py&quot;, &quot;PackageA&quot;], cwd='TestData')
+        self.assertTrue(os.path.exists('TestData/PYSMELLTAGS'))
+        PYSMELLDICT = eval(open('TestData/PYSMELLTAGS').read())
         expectedDict = self.packageA
         self.assertDictsEqual(PYSMELLDICT, expectedDict)
 
-        foundDict = idehelper.findPYSMELLDICT(os.path.join('Tests', 'PackageA', 'something'))
+        foundDict = idehelper.findPYSMELLDICT(os.path.join('TestData', 'PackageA', 'something'))
         self.assertDictsEqual(foundDict, expectedDict)
 
 
     def testPackageB(self):
-        if os.path.exists('Tests/PYSMELLTAGS'):
-            os.remove('Tests/PYSMELLTAGS')
-        subprocess.call([&quot;python&quot;, &quot;../pysmelltags.py&quot;, &quot;PackageB&quot;], cwd='Tests')
-        self.assertTrue(os.path.exists('Tests/PYSMELLTAGS'))
-        PYSMELLDICT = eval(open('Tests/PYSMELLTAGS').read())
+        if os.path.exists('TestData/PYSMELLTAGS'):
+            os.remove('TestData/PYSMELLTAGS')
+        subprocess.call([&quot;python&quot;, &quot;../pysmelltags.py&quot;, &quot;PackageB&quot;], cwd='TestData')
+        self.assertTrue(os.path.exists('TestData/PYSMELLTAGS'))
+        PYSMELLDICT = eval(open('TestData/PYSMELLTAGS').read())
         expectedDict = self.packageB
         self.assertDictsEqual(PYSMELLDICT, expectedDict)
 
 
     def testPackageDot(self):
-        if os.path.exists('Tests/PackageA/PYSMELLTAGS'):
-            os.remove('Tests/PackageA/PYSMELLTAGS')
-        subprocess.call([&quot;python&quot;, &quot;../../pysmelltags.py&quot;, &quot;.&quot;], cwd='Tests/PackageA')
-        self.assertTrue(os.path.exists('Tests/PackageA/PYSMELLTAGS'))
-        PYSMELLDICT = eval(open('Tests/PackageA/PYSMELLTAGS').read())
+        if os.path.exists('TestData/PackageA/PYSMELLTAGS'):
+            os.remove('TestData/PackageA/PYSMELLTAGS')
+        subprocess.call([&quot;python&quot;, &quot;../../pysmelltags.py&quot;, &quot;.&quot;], cwd='TestData/PackageA')
+        self.assertTrue(os.path.exists('TestData/PackageA/PYSMELLTAGS'))
+        PYSMELLDICT = eval(open('TestData/PackageA/PYSMELLTAGS').read())
         expectedDict = self.packageA
         self.assertDictsEqual(PYSMELLDICT, expectedDict)
 
 
     def testAllPackages(self):
-        self.fail(&quot;when the a dir is not a package, search for packages&quot;)
-        subprocess.call([&quot;python&quot;, &quot;pysmelltags.py&quot;, &quot;Tests&quot;]) # should generate equivalent to PackageA, PackageB
+        if os.path.exists('TestData/PYSMELLTAGS'):
+            os.remove('TestData/PYSMELLTAGS')
+        subprocess.call([&quot;python&quot;, &quot;../pysmelltags.py&quot;, &quot;.&quot;], cwd='TestData')
+        self.assertTrue(os.path.exists('TestData/PYSMELLTAGS'))
+        PYSMELLDICT = eval(open('TestData/PYSMELLTAGS').read())
+        expectedDict = {}
+        expectedDict.update(self.packageA)
+        expectedDict['CLASSES'].update(self.packageB['CLASSES'])
+        expectedDict['CONSTANTS'].extend(self.packageB['CONSTANTS'])
+        expectedDict['CONSTANTS'].append('standalone.NOPACKAGE')
+        expectedDict['FUNCTIONS'].extend(self.packageB['FUNCTIONS'])
+        expectedDict['HIERARCHY'].extend(self.packageB['HIERARCHY'])
+        expectedDict['HIERARCHY'].append('standalone')
+        self.assertDictsEqual(PYSMELLDICT, expectedDict)
 
     
     def testSingleFile(self):
         &quot;should recurse up until it doesn't find __init__.py&quot;
-        path = 'Tests/PackageA/NestedPackage/EvenMore/'
+        path = 'TestData/PackageA/NestedPackage/EvenMore/'
         if os.path.exists('%sPYSMELLTAGS' % path):
             os.remove('%sPYSMELLTAGS' % path)
         subprocess.call([&quot;python&quot;, &quot;../../../../pysmelltags.py&quot;, &quot;ModuleC.py&quot;], cwd=path)
@@ -159,7 +171,7 @@ class FunctionalTest(unittest.TestCase):
 
 
     def testSingleFilesWithPaths(self):
-        path = 'Tests'
+        path = 'TestData'
         pysmell = os.path.join(path, 'PYSMELLTAGS')
         if os.path.exists(pysmell):
             os.remove(pysmell)
@@ -179,19 +191,19 @@ class FunctionalTest(unittest.TestCase):
 
 
     def testOutputRedirect(self):
-        if os.path.exists('Tests/OUTPUTREDIR'):
-            os.remove('Tests/OUTPUTREDIR')
+        if os.path.exists('TestData/OUTPUTREDIR'):
+            os.remove('TestData/OUTPUTREDIR')
         subprocess.call([&quot;python&quot;, &quot;../pysmelltags.py&quot;, &quot;PackageA&quot;, &quot;-o&quot;,
-            &quot;OUTPUTREDIR&quot;], cwd='Tests')
-        self.assertTrue(os.path.exists('Tests/OUTPUTREDIR'))
-        PYSMELLDICT = eval(open('Tests/OUTPUTREDIR').read())
+            &quot;OUTPUTREDIR&quot;], cwd='TestData')
+        self.assertTrue(os.path.exists('TestData/OUTPUTREDIR'))
+        PYSMELLDICT = eval(open('TestData/OUTPUTREDIR').read())
         expectedDict = self.packageA
         self.assertDictsEqual(PYSMELLDICT, expectedDict)
 
-        absPath = os.path.join(os.getcwd(), 'Tests', 'OUTPUTREDIR2')
+        absPath = os.path.join(os.getcwd(), 'TestData', 'OUTPUTREDIR2')
         if os.path.exists(absPath):
             os.remove(absPath)
-        subprocess.call([&quot;python&quot;, &quot;../pysmelltags.py&quot;, &quot;PackageA&quot;, &quot;-o&quot;, absPath], cwd='Tests')
+        subprocess.call([&quot;python&quot;, &quot;../pysmelltags.py&quot;, &quot;PackageA&quot;, &quot;-o&quot;, absPath], cwd='TestData')
         self.assertTrue(os.path.exists(absPath))
         PYSMELLDICT = eval(open(absPath).read())
         expectedDict = self.packageA
@@ -220,6 +232,8 @@ class FunctionalTest(unittest.TestCase):
 
             -t        Will print timing information.
 
+            -v        Verbose mode; useful for debugging
+
         &quot;&quot;&quot;).splitlines()
         self.assertEquals(stdout.splitlines(), expected)
 </diff>
      <filename>Tests/functional_test.py</filename>
    </modified>
    <modified>
      <diff>@@ -131,14 +131,14 @@ class IDEHelperTest(unittest.TestCase):
                     self.
         
         &quot;&quot;&quot;)
-        pathParts = ['Tests', 'PackageB', 'NewModule.py'] # Tests/PackageB contains an __init__.py file
+        pathParts = ['TestData', 'PackageB', 'NewModule.py'] # TestData/PackageB contains an __init__.py file
         relPath = os.path.join(*pathParts)
         inferred, parents = inferClass(relPath, source, 3, self.nestedDict, None)
         self.assertEquals(inferred, 'PackageB.NewModule.NewClass')
         self.assertEquals(parents, ['object'])
 
         cwd = os.getcwd()
-        pathParts = [cwd, 'Tests', 'PackageB', 'NewModule.py'] # Tests/PackageB contains an __init__.py file
+        pathParts = [cwd, 'TestData', 'PackageB', 'NewModule.py'] # TestData/PackageB contains an __init__.py file
         absPath = os.path.join(*pathParts)
         inferred, parents = inferClass(absPath, source, 3, self.nestedDict, None)
         self.assertEquals(inferred, 'PackageB.NewModule.NewClass')
@@ -152,7 +152,7 @@ class IDEHelperTest(unittest.TestCase):
                     self.
         
         &quot;&quot;&quot;)
-        klass, parents = inferClass(os.path.join('Tests', 'PackageA', 'Module.py'), source,
+        klass, parents = inferClass(os.path.join('TestData', 'PackageA', 'Module.py'), source,
                             4, self.nestedDict)
         self.assertEquals(klass, 'PackageA.Module.Other')
         self.assertEquals(parents, ['Nested.Package.Module.Class'])
@@ -165,7 +165,7 @@ class IDEHelperTest(unittest.TestCase):
                     self.
         
         &quot;&quot;&quot;)
-        klass, parents = inferClass(os.path.join('Tests', 'PackageA', 'Module.py'), source,
+        klass, parents = inferClass(os.path.join('TestData', 'PackageA', 'Module.py'), source,
                             4, self.nestedDict)
         self.assertEquals(klass, 'PackageA.Module.Bother')
         self.assertEquals(parents, ['Nested.Package.Module.Class'])
@@ -179,7 +179,7 @@ class IDEHelperTest(unittest.TestCase):
                     self.
         
         &quot;&quot;&quot;)
-        klass, parents = inferClass(os.path.join('Tests', 'PackageA', 'Module.py'), source,
+        klass, parents = inferClass(os.path.join('TestData', 'PackageA', 'Module.py'), source,
                             4, self.nestedDict)
         self.assertEquals(klass, 'PackageA.Module.Bother')
         self.assertEquals(parents, ['Nested.Package.Module.Class'])
@@ -256,7 +256,7 @@ class IDEHelperTest(unittest.TestCase):
                     self.
         
         &quot;&quot;&quot;)
-        options = detectCompletionType(os.path.join('Tests', 'PackageA', 'Module.py'), source,
+        options = detectCompletionType(os.path.join('TestData', 'PackageA', 'Module.py'), source,
                             &quot;%sself.&quot; % (' ' * 8), 4, 13, '', self.nestedDict)
         expected = CompletionOptions(isAttrLookup=True,
                             klass='PackageA.Module.Other', parents=['Nested.Package.Module.Class'],
@@ -270,7 +270,7 @@ class IDEHelperTest(unittest.TestCase):
             
         &quot;&quot;&quot;)
         line = &quot;from Nested.Package.Mo&quot;
-        options = detectCompletionType(os.path.join('Tests', 'PackageA', 'Module.py'), source,
+        options = detectCompletionType(os.path.join('TestData', 'PackageA', 'Module.py'), source,
                                         line, 1, len(line), '', self.nestedDict)
         expected = CompletionOptions(isAttrLookup=False,
                             klass=None, parents=None,
@@ -296,7 +296,7 @@ class IDEHelperTest(unittest.TestCase):
             
         &quot;&quot;&quot;)
         line = &quot;from Nested.Package import &quot;
-        options = detectCompletionType(os.path.join('Tests', 'PackageA', 'Module.py'), source,
+        options = detectCompletionType(os.path.join('TestData', 'PackageA', 'Module.py'), source,
                                             line, 1, len(line), '', self.nestedDict)
         expected = CompletionOptions(isAttrLookup=False,
                             klass=None, parents=None,
@@ -309,7 +309,7 @@ class IDEHelperTest(unittest.TestCase):
             
         &quot;&quot;&quot;)
         line = &quot;from Nested import &quot;
-        options = detectCompletionType(os.path.join('Tests', 'PackageA', 'Module.py'), source,
+        options = detectCompletionType(os.path.join('TestData', 'PackageA', 'Module.py'), source,
                                             line, 1, len(line), '', self.nestedDict)
         expected = CompletionOptions(isAttrLookup=False,
                             klass=None, parents=None,
@@ -322,7 +322,7 @@ class IDEHelperTest(unittest.TestCase):
             
         &quot;&quot;&quot;)
         line = &quot;from Nested import Pack&quot;
-        options = detectCompletionType(os.path.join('Tests', 'PackageA', 'Module.py'), source,
+        options = detectCompletionType(os.path.join('TestData', 'PackageA', 'Module.py'), source,
                                             line, 1, len(line), '', self.nestedDict)
         expected = CompletionOptions(isAttrLookup=False,
                             klass=None, parents=None,
@@ -337,7 +337,7 @@ class IDEHelperTest(unittest.TestCase):
             
         &quot;&quot;&quot;)
         line = &quot;import Nested.Package.&quot;
-        options = detectCompletionType(os.path.join('Tests', 'PackageA', 'Module.py'), source,
+        options = detectCompletionType(os.path.join('TestData', 'PackageA', 'Module.py'), source,
                                             line, 1, len(line), '', self.nestedDict)
         expected = CompletionOptions(isAttrLookup=False,
                             klass=None, parents=None,</diff>
      <filename>Tests/test_idehelper.py</filename>
    </modified>
    <modified>
      <diff>@@ -157,9 +157,18 @@ class CodeFinder(BaseVisitor):
         BaseVisitor.__init__(self)
         self.modules = ModuleDict()
         self.module = '__module__'
-        self.package = '__package__'
+        self.__package = '__package__'
         self.path = '__path__'
 
+    
+    def __setPackage(self, package):
+        if package:
+            self.__package = package + '.'
+        else:
+            self.__package = ''
+
+    package = property(lambda s: s.__package, __setPackage)
+
     @property
     def inClass(self):
         return (len(self.scope) &gt; 0 and (isinstance(self.scope[-1], ast.Class)
@@ -187,9 +196,9 @@ class CodeFinder(BaseVisitor):
 
     def visitModule(self, node):
         if self.module == '__init__':
-            self.modules.enterModule('%s' % self.package)
+            self.modules.enterModule('%s' % self.package[:-1]) # remove dot
         else:
-            self.modules.enterModule('%s.%s' % (self.package, self.module))
+            self.modules.enterModule('%s%s' % (self.package, self.module))
         self.visit(node.node)
         self.modules.exitModule()
 
@@ -222,7 +231,7 @@ class CodeFinder(BaseVisitor):
             asName = name[1] or name[0]
             imported = name[0]
             if self.isRelativeImport(node.modname):
-                imported = &quot;%s.%s.%s&quot; % (self.package, node.modname, imported)
+                imported = &quot;%s%s.%s&quot; % (self.package, node.modname, imported)
             else:
                 imported = &quot;%s.%s&quot; % (node.modname, imported)
             self.modules.addPointer(&quot;%s.%s&quot; % (self.modules.currentModule, asName), imported)
@@ -233,7 +242,7 @@ class CodeFinder(BaseVisitor):
             asName = name[1] or name[0]
             imported = name[0]
             if self.isRelativeImport(imported):
-                imported = &quot;%s.%s&quot; % (self.package, imported)
+                imported = &quot;%s%s&quot; % (self.package, imported)
             self.modules.addPointer(&quot;%s.%s&quot; % (self.modules.currentModule, asName), imported)
 
     def isRelativeImport(self, imported):</diff>
      <filename>codefinder.py</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>Tests/PackageA/ModuleA.py</filename>
    </removed>
    <removed>
      <filename>Tests/PackageA/NestedPackage/EvenMore/ModuleC.py</filename>
    </removed>
    <removed>
      <filename>Tests/PackageA/NestedPackage/EvenMore/__init__.py</filename>
    </removed>
    <removed>
      <filename>Tests/PackageA/NestedPackage/__init__.py</filename>
    </removed>
    <removed>
      <filename>Tests/PackageA/__init__.py</filename>
    </removed>
    <removed>
      <filename>Tests/PackageB/__init__.py</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>be511d0cae4837c97571eea98338f0da98d89464</id>
    </parent>
  </parents>
  <author>
    <name>Orestis Markou</name>
    <email>orestis@orestis.gr</email>
  </author>
  <url>http://github.com/orestis/pysmell/commit/32c1365ae2ae0dc4a59b3f5dacb36d74f4254af6</url>
  <id>32c1365ae2ae0dc4a59b3f5dacb36d74f4254af6</id>
  <committed-date>2008-10-12T13:20:30-07:00</committed-date>
  <authored-date>2008-10-12T13:20:30-07:00</authored-date>
  <message>Moved testdata from Tests to TestData
Added support for standalone modules (no leading dot)</message>
  <tree>05930fba8394d6782e90848021a8d6929b1413fe</tree>
  <committer>
    <name>Orestis Markou</name>
    <email>orestis@orestis.gr</email>
  </committer>
</commit>
