old_contents: from os.path import join
  import sublime
  import sys
  from unittest import TestCase
  
  version = sublime.version()
  
  try:
      from libsass import pathutils
  except ImportError:
      from sublime_libsass.libsass import pathutils
  
  
  class TestPathutils(TestCase):
      def test_subpaths(self):
          path = join('/foo','bar','baz')
          exprmt = pathutils.subpaths(path)
          expect = [ join('/foo','bar','baz'), join('/foo','bar'), join('/foo'), join('/') ]
          self.assertEqual(exprmt, expect)
  
      def test_grep_r(self):
          pathutils.os.walk = lambda x: [('/tmp','',['file.scss'])]
  
          self.assertEqual(pathutils.find_type_dirs('anything', '.scss'), ['/tmp'])
          self.assertEqual(pathutils.find_type_dirs('anything', ['.scss', '.sass']), ['/tmp'])
          self.assertEqual(pathutils.find_type_dirs('anything', '.sass'), [])
          self.assertEqual(pathutils.find_type_dirs('anything', ['.txt', '.csv']), [])
  
new_contents: from os.path import join, realpath
  import os
  import sublime
  import sys
  from unittest import TestCase
  from functools import wraps
  
  
  def subl_patch(pkg, obj=None):
      def subl_deco(fn):
          @wraps(fn)
          def wrap(*args):
              nonlocal pkg
              o = []
              if obj != None:
                  o += [obj]
                  pkg = pkg + '.' + obj
              try:
                  mock = __import__(pkg, globals(), locals(), o, 0)
              except ImportError:
                  pkg = realpath(__file__).split(os.sep)[-3] + '.' + pkg
                  mock = __import__(pkg, globals(), locals(), o, 0)
              args += (mock,)
              fn(*args)
          return wrap
      return subl_deco
  
  
  class TestPathutils(TestCase):
      @subl_patch('libsass', 'pathutils')
      def test_subpaths(self, pathutils):
          path = join('/foo','bar','baz')
          exprmt = pathutils.subpaths(path)
          expect = [ join('/foo','bar','baz'), join('/foo','bar'), join('/foo'), join('/') ]
          self.assertEqual(exprmt, expect)
  
      @subl_patch('libsass', 'pathutils')
      def test_grep_r(self, pathutils):
          pathutils.os.walk = lambda x: [('/tmp','',['file.scss'])]
  
          self.assertEqual(pathutils.find_type_dirs('anything', '.scss'), ['/tmp'])
          self.assertEqual(pathutils.find_type_dirs('anything', ['.scss', '.sass']), ['/tmp'])
          self.assertEqual(pathutils.find_type_dirs('anything', '.sass'), [])
          self.assertEqual(pathutils.find_type_dirs('anything', ['.txt', '.csv']), [])
  
subject: Make custom patch in package to test