Beispiel #1
0
 def test_all(self):
     test_NoseXUnitLite.File("TEST-foo_1.py").save(self.source)
     test_NoseXUnitLite.File("TEST-foo_2.dat").save(self.source)
     test_NoseXUnitLite.File("foo_3.py").save(self.source)
     test_NoseXUnitLite.File("foo_4.dat").save(self.source)
     ntools.clean(self.source, prefix="TEST-", ext="dat")
     self.assertSet(["TEST-foo_1.py", "foo_3.py", "foo_4.dat"], os.listdir(self.source))
Beispiel #2
0
 def initialize(self):
     '''Set the environment'''
     # Check that source folder exists if specified
     if self.source and not os.path.isdir(self.source):
         # Source folder doesn't exist
         raise nexcepts.NoseXUnitError("source folder doesn't exist: %s" % self.source)
     # Create the core target folder
     ntools.create(self.core_target)
     # Clean the target folder of the core
     ntools.clean(self.core_target, nconst.PREFIX_CORE, nconst.EXT_CORE)
     # Initialize the packages
     self.packages = {}
     # Add the source folder in the path
     if self.source:
         # Get the packages
         self.packages = ntools.packages(self.source, search=self.search_source)
         # Get the folders to add in the path
         folders = []
         # Go threw the packages
         for package in self.packages.keys():
             # Check if is as sub package or a sub module
             if package.find('.') == -1:
                 # Get the folder
                 folder = os.path.dirname(self.packages[package])
                 # If not already in, add it
                 if folder not in folders: folders.append(folder)
         # Get current path
         backup = sys.path
         # Clean up
         sys.path = []
         # Add to the path
         for folder in folders:
             # Log
             logger.info('add folder in sys.path: %s' % folder)
             # Add to the path
             sys.path.append(folder)
         # Add old ones
         sys.path.extend(backup)
Beispiel #3
0
 def test_no_option(self):
     test_NoseXUnitLite.File("foo.py").save(self.source)
     ntools.clean(self.source)
     self.assertEquals([], os.listdir(self.source))
Beispiel #4
0
 def test_ext_no_check(self):
     test_NoseXUnitLite.File("foo.py").save(self.source)
     ntools.clean(self.source, ext="dat")
     self.assertEquals(["foo.py"], os.listdir(self.source))
Beispiel #5
0
 def test_prefix_no_check(self):
     test_NoseXUnitLite.File("foo.py").save(self.source)
     ntools.clean(self.source, prefix="TEST-")
     self.assertEquals(["foo.py"], os.listdir(self.source))