import unittest
import collectr


class CollectrTest(unittest.TestCase):
    """
    Tests for the collectr library.
    """
    def setUp(self):
        self.dir = collectr.StaticDir('test/fixtures/dirB')

    def tearDown(self):
        self.dir = None

    def test_enumerate_files(self):
        result = ['test/fixtures/dirA/css/css1.css',
                  'test/fixtures/dirA/css/css2.css',
                  'test/fixtures/dirA/js/script1.js',
                  'test/fixtures/dirA/js/script2.js']
        files = self.dir.enumerate_files('test/fixtures/dirA')
        self.assertEqual(files, result)

    def test_enumerate_files_with_filter(self):
        result = ['test/fixtures/dirB/img/img1.jpg',
                  'test/fixtures/dirB/img/img3.tiff']
        self.dir.ignore = ['.*\.png']
        files = self.dir.enumerate_files('test/fixtures/dirB')
        self.assertEqual(files, result)


if __name__ == '__main__':
    unittest.main()

import unittest
import collectr


class CollectrTest(unittest.TestCase):
    """
    Tests for the collectr library.
    """
    def setUp(self):
        self.dir = collectr.StaticDir('test/fixtures/dirB')

    def tearDown(self):
        self.dir = None

        try:          # Delete the files if they exist, otherwise mask failure.
            self.old_call('rm -rf test/fixtures/dirB/css')
            self.old_call('rm -rf test/fixtures/dirB/js')
        except OSError:
            pass

    def test_enumerate_files(self):
        result = ['test/fixtures/dirA/css/css1.css',
                  'test/fixtures/dirA/css/css2.css',
                  'test/fixtures/dirA/js/script1.js',
                  'test/fixtures/dirA/js/script2.js']
        files = self.dir.enumerate_files('test/fixtures/dirA')
        self.assertEqual(files, result)

    def test_enumerate_files_with_filter(self):
        result = ['test/fixtures/dirB/img/img1.jpg',
                  'test/fixtures/dirB/img/img3.tiff']
        self.dir.ignore = ['.*\.png']
        files = self.dir.enumerate_files('test/fixtures/dirB')
        self.assertEqual(files, result)


if __name__ == '__main__':
    unittest.main()

Delete any files that get moved.
Delete any files that get moved.

  import unittest
  import collectr
  
  
  class CollectrTest(unittest.TestCase):
      """
      Tests for the collectr library.
      """
      def setUp(self):
          self.dir = collectr.StaticDir('test/fixtures/dirB')
  
      def tearDown(self):
          self.dir = None
+ 
+         try:          # Delete the files if they exist, otherwise mask failure.
+             self.old_call('rm -rf test/fixtures/dirB/css')
+             self.old_call('rm -rf test/fixtures/dirB/js')
+         except OSError:
+             pass
  
      def test_enumerate_files(self):
          result = ['test/fixtures/dirA/css/css1.css',
                    'test/fixtures/dirA/css/css2.css',
                    'test/fixtures/dirA/js/script1.js',
                    'test/fixtures/dirA/js/script2.js']
          files = self.dir.enumerate_files('test/fixtures/dirA')
          self.assertEqual(files, result)
  
      def test_enumerate_files_with_filter(self):
          result = ['test/fixtures/dirB/img/img1.jpg',
                    'test/fixtures/dirB/img/img3.tiff']
          self.dir.ignore = ['.*\.png']
          files = self.dir.enumerate_files('test/fixtures/dirB')
          self.assertEqual(files, result)
  
  
  if __name__ == '__main__':
      unittest.main()
  
Delete any files that get moved.
## Code Before:
import unittest
import collectr


class CollectrTest(unittest.TestCase):
    """
    Tests for the collectr library.
    """
    def setUp(self):
        self.dir = collectr.StaticDir('test/fixtures/dirB')

    def tearDown(self):
        self.dir = None

    def test_enumerate_files(self):
        result = ['test/fixtures/dirA/css/css1.css',
                  'test/fixtures/dirA/css/css2.css',
                  'test/fixtures/dirA/js/script1.js',
                  'test/fixtures/dirA/js/script2.js']
        files = self.dir.enumerate_files('test/fixtures/dirA')
        self.assertEqual(files, result)

    def test_enumerate_files_with_filter(self):
        result = ['test/fixtures/dirB/img/img1.jpg',
                  'test/fixtures/dirB/img/img3.tiff']
        self.dir.ignore = ['.*\.png']
        files = self.dir.enumerate_files('test/fixtures/dirB')
        self.assertEqual(files, result)


if __name__ == '__main__':
    unittest.main()

## Instruction:
Delete any files that get moved.
## Code After:
import unittest
import collectr


class CollectrTest(unittest.TestCase):
    """
    Tests for the collectr library.
    """
    def setUp(self):
        self.dir = collectr.StaticDir('test/fixtures/dirB')

    def tearDown(self):
        self.dir = None

        try:          # Delete the files if they exist, otherwise mask failure.
            self.old_call('rm -rf test/fixtures/dirB/css')
            self.old_call('rm -rf test/fixtures/dirB/js')
        except OSError:
            pass

    def test_enumerate_files(self):
        result = ['test/fixtures/dirA/css/css1.css',
                  'test/fixtures/dirA/css/css2.css',
                  'test/fixtures/dirA/js/script1.js',
                  'test/fixtures/dirA/js/script2.js']
        files = self.dir.enumerate_files('test/fixtures/dirA')
        self.assertEqual(files, result)

    def test_enumerate_files_with_filter(self):
        result = ['test/fixtures/dirB/img/img1.jpg',
                  'test/fixtures/dirB/img/img3.tiff']
        self.dir.ignore = ['.*\.png']
        files = self.dir.enumerate_files('test/fixtures/dirB')
        self.assertEqual(files, result)


if __name__ == '__main__':
    unittest.main()
