# Path: ice/filesystem.py
# class RealFilesystem(object):
# class FakeFilesystem(object):
#   def create_directories(self, path):
#   def path_exists(self, path):
#   def is_directory(self, path):
#   def is_file(self, path):
#   def is_writable(self, path):
#   def _paths_in_directory(self, directory, incl_subdirs=False):
#   def files_in_directory(self, directory, include_subdirectories=False):
#   def subdirectories_of_directory(self, directory, recursive=False):
#   def __init__(self, root):
#   def adjusted_path(self, path):
#   def create_directories(self, path):
#   def path_exists(self, path):
#   def is_directory(self, path):
#   def is_file(self, path):
#   def is_writable(self, path):
#   def files_in_directory(self, directory, include_subdirectories=False):
#   def subdirectories_of_directory(self, directory, recursive=False):


import os
import shutil
import sys
import tempfile
import unittest
from nose_parameterized import parameterized
from ice import filesystem
    self.touch_file(file1)
    file2 = os.path.join(self.tempdir, "redfile")
    self.touch_file(file2)
    hidden_file = os.path.join(self.tempdir, ".hidden_file")
    self.touch_file(hidden_file)
    dir1 = os.path.join(self.tempdir, "dir1")
    os.mkdir(dir1)
    dir2 = os.path.join(self.tempdir, "dir2")
    os.mkdir(dir2)
    self.assertEquals(
        self.filesystem.files_in_directory(
            self.tempdir), [
            file1, file2])

  def test_subdirectories_of_directory_asserts_when_directory_doesnt_exist(
          self):
    path = os.path.join(self.tempdir, "DNE")
    with self.assertRaises(AssertionError):
      self.filesystem.subdirectories_of_directory(path)

  def test_subdirectories_of_directory_asserts_when_given_path_is_a_file(self):
    path = os.path.join(self.tempdir, "tempfile")
    self.touch_file(path)
    with self.assertRaises(AssertionError):
      self.filesystem.subdirectories_of_directory(path)

  def test_subdirectories_of_directory_only_returns_directories(self):
    file1 = os.path.join(self.tempdir, "file1")
    self.touch_file(file1)
    file2 = os.path.join(self.tempdir, "file2")

# Path: ice/filesystem.py
# class RealFilesystem(object):
# class FakeFilesystem(object):
#   def create_directories(self, path):
#   def path_exists(self, path):
#   def is_directory(self, path):
#   def is_file(self, path):
#   def is_writable(self, path):
#   def _paths_in_directory(self, directory, incl_subdirs=False):
#   def files_in_directory(self, directory, include_subdirectories=False):
#   def subdirectories_of_directory(self, directory, recursive=False):
#   def __init__(self, root):
#   def adjusted_path(self, path):
#   def create_directories(self, path):
#   def path_exists(self, path):
#   def is_directory(self, path):
#   def is_file(self, path):
#   def is_writable(self, path):
#   def files_in_directory(self, directory, include_subdirectories=False):
#   def subdirectories_of_directory(self, directory, recursive=False):


# Path: tests/filesystem_tests.py
import os
import shutil
import sys
import tempfile
import unittest
from nose_parameterized import parameterized
from ice import filesystem

    self.touch_file(file1)
    file2 = os.path.join(self.tempdir, "redfile")
    self.touch_file(file2)
    hidden_file = os.path.join(self.tempdir, ".hidden_file")
    self.touch_file(hidden_file)
    dir1 = os.path.join(self.tempdir, "dir1")
    os.mkdir(dir1)
    dir2 = os.path.join(self.tempdir, "dir2")
    os.mkdir(dir2)
    self.assertEquals(
        self.filesystem.files_in_directory(
            self.tempdir), [
            file1, file2])

  def test_subdirectories_of_directory_asserts_when_directory_doesnt_exist(
          self):
    path = os.path.join(self.tempdir, "DNE")
    with self.assertRaises(AssertionError):
      self.filesystem.subdirectories_of_directory(path)

  def test_subdirectories_of_directory_asserts_when_given_path_is_a_file(self):
    path = os.path.join(self.tempdir, "tempfile")
    self.touch_file(path)
    with self.assertRaises(AssertionError):
      self.filesystem.subdirectories_of_directory(path)

  def test_subdirectories_of_directory_only_returns_directories(self):
    file1 = os.path.join(self.tempdir, "file1")
    self.touch_file(file1)
    file2 = os.path.join(self.tempdir, "file2")

    self.touch_file(file2)