コード例 #1
0
ファイル: test_newstuff.py プロジェクト: lebauce/artub
 def test_getsFilenamesInSubPackagesIfCtxFilenameIsInTheRoot(self):
     try:
         createPackageStructure("","")
         fnames = [f for f in
                   generateModuleFilenamesInPythonPath(pkgstructureFile0,[])]
         self.assert_(pkgstructureFile1 in fnames)
         self.assert_(pkgstructureFile2 in fnames)
     finally:
         removePackageStructure()
コード例 #2
0
ファイル: test_newstuff.py プロジェクト: tillwf/artub
 def test_doesScanFilesInTheRootDirectory(self):
     try:
         createPackageStructure("pass", "pass", "pass")
         fnames = [f for f in \
              generateModuleFilenamesInPythonPath(pkgstructureFile2,[])]
         assert pkgstructureFile0 in fnames
     finally:
         #os.remove(initfile)
         removePackageStructure()
コード例 #3
0
 def test_doesScanFilesInTheRootDirectory(self):
     try:
         createPackageStructure("pass","pass","pass")
         fnames = [f for f in \
              generateModuleFilenamesInPythonPath(pkgstructureFile2)]
         assert pkgstructureFile0 in fnames
     finally:
         #os.remove(initfile)
         removePackageStructure()
コード例 #4
0
ファイル: test_newstuff.py プロジェクト: lebauce/artub
 def test_getsAllFilenamesInSameHierarchyAsContextFile(self):
     try:
         createPackageStructure("","")
         fnames = [f for f in
                   generateModuleFilenamesInPythonPath(pkgstructureFile1,[])]
         self.assert_(pkgstructureFile0 in fnames)
         self.assert_(pkgstructureFile1 in fnames)
         self.assert_(pkgstructureFile2 in fnames)
     finally:
         removePackageStructure()
コード例 #5
0
ファイル: test_newstuff.py プロジェクト: tillwf/artub
 def test_doesntTraverseIntoNonPackagesUnderRoot(self):
     try:
         os.makedirs(pkgstructureBasedir)
         writeFile(pkgstructureFile1, "pass")
         fnames = [f for f in \
                   generateModuleFilenamesInPythonPath(pkgstructureFile2,[])]
         assert pkgstructureFile1 not in fnames
     finally:
         os.remove(pkgstructureFile1)
         os.removedirs(pkgstructureBasedir)
コード例 #6
0
 def test_doesntTraverseIntoNonPackagesUnderRoot(self):
     try:
         os.makedirs(pkgstructureBasedir)
         writeFile(pkgstructureFile1,"pass")
         fnames = [f for f in \
                   generateModuleFilenamesInPythonPath(pkgstructureFile2)]
         assert pkgstructureFile1 not in fnames
     finally:
         os.remove(pkgstructureFile1)
         os.removedirs(pkgstructureBasedir)
コード例 #7
0
ファイル: test_newstuff.py プロジェクト: lebauce/artub
 def test_returnsOtherFilesInSameNonPackageDirectory(self):
     try:
         writeTmpTestFile("")
         newtmpfile = os.path.join(tmproot,"baz.py")
         writeFile(newtmpfile, "")
         fnames = [f for f in \
                   generateModuleFilenamesInPythonPath(tmpfile,[])]
         assert newtmpfile in fnames
     finally:
         os.remove(newtmpfile)
         deleteTmpTestFile()
コード例 #8
0
ファイル: test_newstuff.py プロジェクト: tillwf/artub
 def test_returnsOtherFilesInSameNonPackageDirectory(self):
     try:
         writeTmpTestFile("")
         newtmpfile = os.path.join(tmproot, "baz.py")
         writeFile(newtmpfile, "")
         fnames = [f for f in \
                   generateModuleFilenamesInPythonPath(tmpfile,[])]
         assert newtmpfile in fnames
     finally:
         os.remove(newtmpfile)
         deleteTmpTestFile()
コード例 #9
0
ファイル: test_newstuff.py プロジェクト: tillwf/artub
 def test_getsFilenamesInSubPackagesIfCtxFilenameIsInTheRoot(self):
     try:
         createPackageStructure("", "")
         fnames = [
             f for f in generateModuleFilenamesInPythonPath(
                 pkgstructureFile0, [])
         ]
         self.assert_(pkgstructureFile1 in fnames)
         self.assert_(pkgstructureFile2 in fnames)
     finally:
         removePackageStructure()
コード例 #10
0
 def test_getsFilenamesInSubPackagesIfCtxFilenameIsInTheRoot(self):
     try:
         oldpath = getRoot().pythonpath
         getRoot().pythonpath = []   # clear the python path
         createPackageStructure("","")
         fnames = [f for f in
                   generateModuleFilenamesInPythonPath(pkgstructureFile0)]
         self.assert_(pkgstructureFile1 in fnames)
         self.assert_(pkgstructureFile2 in fnames)
     finally:
         getRoot().pythonpath = oldpath 
         removePackageStructure()
コード例 #11
0
 def test_doesntGenerateFilenamesMoreThanOnce(self):
     try:
         createPackageStructure("pass","pass")
         newfile = os.path.join(pkgstructureChilddir,"baz.py")
         writeFile(newfile,"pass")
         fnames = [f for f in \
             generateModuleFilenamesInPythonPath(pkgstructureFile2)]
         matched = [f for f in fnames if f == newfile]
         self.assertEqual(1, len(matched))
     finally:
         os.remove(newfile)
         removePackageStructure()
コード例 #12
0
ファイル: test_newstuff.py プロジェクト: tillwf/artub
 def test_getsAllFilenamesInSameHierarchyAsContextFile(self):
     try:
         createPackageStructure("", "")
         fnames = [
             f for f in generateModuleFilenamesInPythonPath(
                 pkgstructureFile1, [])
         ]
         self.assert_(pkgstructureFile0 in fnames)
         self.assert_(pkgstructureFile1 in fnames)
         self.assert_(pkgstructureFile2 in fnames)
     finally:
         removePackageStructure()
コード例 #13
0
ファイル: test_newstuff.py プロジェクト: tillwf/artub
 def test_doesntGenerateFilenamesMoreThanOnce(self):
     try:
         createPackageStructure("pass", "pass")
         newfile = os.path.join(pkgstructureChilddir, "baz.py")
         writeFile(newfile, "pass")
         fnames = [f for f in \
             generateModuleFilenamesInPythonPath(pkgstructureFile2,[])]
         matched = [f for f in fnames if f == newfile]
         self.assertEqual(1, len(matched))
     finally:
         os.remove(newfile)
         removePackageStructure()
コード例 #14
0
 def test_getsAllFilenamesInSameHierarchyAsContextFile(self):
     try:
         oldpath = getRoot().pythonpath
         getRoot().pythonpath = []   # clear the python path
         createPackageStructure("","")
         fnames = [f for f in
                   generateModuleFilenamesInPythonPath(pkgstructureFile1)]
         self.assert_(pkgstructureFile0 in fnames)
         self.assert_(pkgstructureFile1 in fnames)
         self.assert_(pkgstructureFile2 in fnames)
     finally:
         getRoot().pythonpath = oldpath 
         removePackageStructure()
コード例 #15
0
ファイル: test_newstuff.py プロジェクト: lebauce/artub
    def test_works(self):
        try:
            createPackageStructure("pass","pass")
            fnames = [f for f in \
                 generateModuleFilenamesInPythonPath(pkgstructureFile2,[])]

            assert os.path.join(pkgstructureBasedir,"__init__.py") in fnames
            assert pkgstructureFile1 in fnames
            assert os.path.join(pkgstructureChilddir,"__init__.py") in fnames
            assert pkgstructureFile2 in fnames
            assert len(fnames) == 5
        finally:
            removePackageStructure()
コード例 #16
0
ファイル: test_newstuff.py プロジェクト: tillwf/artub
    def test_works(self):
        try:
            createPackageStructure("pass", "pass")
            fnames = [f for f in \
                 generateModuleFilenamesInPythonPath(pkgstructureFile2,[])]

            assert os.path.join(pkgstructureBasedir, "__init__.py") in fnames
            assert pkgstructureFile1 in fnames
            assert os.path.join(pkgstructureChilddir, "__init__.py") in fnames
            assert pkgstructureFile2 in fnames
            assert len(fnames) == 5
        finally:
            removePackageStructure()
コード例 #17
0
 def test_getsFilenamesInSubPackagesIfCtxFilenameIsInTheRoot(self):
     try:
         oldpath = getRoot().pythonpath
         getRoot().pythonpath = []  # clear the python path
         createPackageStructure("", "")
         fnames = [
             f
             for f in generateModuleFilenamesInPythonPath(pkgstructureFile0)
         ]
         self.assert_(pkgstructureFile1 in fnames)
         self.assert_(pkgstructureFile2 in fnames)
     finally:
         getRoot().pythonpath = oldpath
         removePackageStructure()
コード例 #18
0
 def test_getsAllFilenamesInSameHierarchyAsContextFile(self):
     try:
         oldpath = getRoot().pythonpath
         getRoot().pythonpath = []  # clear the python path
         createPackageStructure("", "")
         fnames = [
             f
             for f in generateModuleFilenamesInPythonPath(pkgstructureFile1)
         ]
         self.assert_(pkgstructureFile0 in fnames)
         self.assert_(pkgstructureFile1 in fnames)
         self.assert_(pkgstructureFile2 in fnames)
     finally:
         getRoot().pythonpath = oldpath
         removePackageStructure()
コード例 #19
0
 def test_doesntTraverseIntoNonPackages(self):
     try:
         createPackageStructure("pass","pass")
         nonPkgDir = os.path.join(pkgstructureChilddir,"c")
         newfile = os.path.join(nonPkgDir,"baz.py")
         # N.B. don't put an __init__.py in it, so isnt a package
         os.makedirs(nonPkgDir)
         writeFile(newfile,"pass")
         fnames = [f for f in \
              generateModuleFilenamesInPythonPath(pkgstructureFile2)]
         assert newfile not in fnames
     finally:
         #os.remove(initfile)
         os.remove(newfile)
         os.removedirs(nonPkgDir)
         removePackageStructure()
コード例 #20
0
ファイル: test_newstuff.py プロジェクト: tillwf/artub
 def test_doesntTraverseIntoNonPackages(self):
     try:
         createPackageStructure("pass", "pass")
         nonPkgDir = os.path.join(pkgstructureChilddir, "c")
         newfile = os.path.join(nonPkgDir, "baz.py")
         # N.B. don't put an __init__.py in it, so isnt a package
         os.makedirs(nonPkgDir)
         writeFile(newfile, "pass")
         fnames = [f for f in \
              generateModuleFilenamesInPythonPath(pkgstructureFile2,[])]
         assert newfile not in fnames
     finally:
         #os.remove(initfile)
         os.remove(newfile)
         os.removedirs(nonPkgDir)
         removePackageStructure()
コード例 #21
0
ファイル: test_newstuff.py プロジェクト: lebauce/artub
 def test_doesntTraverseOtherPackagesOffOfTheRoot(self):
     try:
         createPackageStructure("","")
         os.makedirs(os.path.join(pkgstructureRootDir, "c"))
         writeFile(os.path.join(pkgstructureRootDir, "c", "__init__.py"), "# ")
         bazfile = os.path.join(pkgstructureRootDir, "c", "baz.py")
         writeFile(bazfile, "pass")
         fnames = [f for f in
                   generateModuleFilenamesInPythonPath(pkgstructureFile1,[])]
         self.assert_(pkgstructureFile0 in fnames)
         self.assert_(pkgstructureFile1 in fnames)
         self.assert_(pkgstructureFile2 in fnames)
         self.assert_(bazfile not in fnames)
     finally:
         os.remove(os.path.join(pkgstructureRootDir, "c", "baz.py"))
         os.remove(os.path.join(pkgstructureRootDir, "c", "__init__.py"))
         os.removedirs(os.path.join(pkgstructureRootDir, "c"))
         removePackageStructure()
コード例 #22
0
ファイル: test_newstuff.py プロジェクト: tillwf/artub
 def test_doesntTraverseOtherPackagesOffOfTheRoot(self):
     try:
         createPackageStructure("", "")
         os.makedirs(os.path.join(pkgstructureRootDir, "c"))
         writeFile(os.path.join(pkgstructureRootDir, "c", "__init__.py"),
                   "# ")
         bazfile = os.path.join(pkgstructureRootDir, "c", "baz.py")
         writeFile(bazfile, "pass")
         fnames = [
             f for f in generateModuleFilenamesInPythonPath(
                 pkgstructureFile1, [])
         ]
         self.assert_(pkgstructureFile0 in fnames)
         self.assert_(pkgstructureFile1 in fnames)
         self.assert_(pkgstructureFile2 in fnames)
         self.assert_(bazfile not in fnames)
     finally:
         os.remove(os.path.join(pkgstructureRootDir, "c", "baz.py"))
         os.remove(os.path.join(pkgstructureRootDir, "c", "__init__.py"))
         os.removedirs(os.path.join(pkgstructureRootDir, "c"))
         removePackageStructure()