Skip to content

Commit

Permalink
Fixed all lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
tbusser committed May 8, 2013
1 parent 93cb7a5 commit b7378e5
Showing 1 changed file with 23 additions and 28 deletions.
51 changes: 23 additions & 28 deletions tests/tests.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
import unittest
import tempfile
import sys, os
import sys
import os

# append the plugin dir to system path so we can import stuff
sys.path.append(
os.path.realpath(os.path.join(os.path.dirname(os.path.realpath(__file__)), '..'))
)


# fake some modules
class sublime:
class Dummy:
@staticmethod
def folders():
return [os.environ.get("test_project_dir")]

@staticmethod
def active_window():
return sublime.Dummy()
Expand All @@ -31,9 +34,10 @@ class sublime_plugin:
LESS_FILE = "foo.less"
CSS_FILE = "bar.css"

"""
Dummy view so we can instantiate the Compiler
"""

###
### Dummy view so we can instantiate the Compiler
###
class DummyView:
def __init__(self, project_dir):
self.project_dir = project_dir
Expand All @@ -54,93 +58,84 @@ def setUp(self):
open(self.dummy_view.file_name(), 'w').close()
# the compiler
self.compiler = Compiler(self.dummy_view)


def test_absolute_path_same_name(self):
print "Running %s" % self._testMethodName
# Providing an absolute path inside the project dir
# Providing an absolute path inside the project dir
# because that's in tmp and we have write access
# but should work with any path
self.output = os.path.join(self.project_dir, 'absolute') # somthing like /tmp/tmpJshx/absolute
self.output = os.path.join(self.project_dir, 'absolute') # something like /tmp/tmpJshx/absolute
self.compiler.convertLess2Css(self.compiler.parseBaseDirs(BASE_DIR, self.output))

# open the created file
with open(os.path.join(self.output, LESS_FILE.replace(".less", ".css")), "r") as f:
self.assertIsInstance(f, file)


def test_absolute_path_provided_name(self):
print "Running %s" % self._testMethodName
# Providing an absolute path inside the project dir
# Providing an absolute path inside the project dir
# because that's in tmp and we have write access
# but should work with any path
self.output = os.path.join(self.project_dir, 'absolute') # somthing like /tmp/tmpJshx/absolute
self.output = os.path.join(self.project_dir, 'absolute') # something like /tmp/tmpJshx/absolute
self.compiler.convertLess2Css(self.compiler.parseBaseDirs(BASE_DIR, self.output), outputFile=CSS_FILE)

# open the created file
with open(os.path.join(self.output, CSS_FILE), "r") as f:
self.assertIsInstance(f, file)


def test_relative_path_same_name(self):
print "Running %s" % self._testMethodName
self.output = 'relative/path' # somthing like /tmp/tmpJshx/relative/path
self.output = 'relative/path' # something like /tmp/tmpJshx/relative/path
self.compiler.convertLess2Css(self.compiler.parseBaseDirs(BASE_DIR, self.output))

# open the created file
with open(os.path.join(self.project_dir, self.output, LESS_FILE.replace(".less", ".css")), "r") as f:
self.assertIsInstance(f, file)


def test_relative_path_provided_name(self):
print "Running %s" % self._testMethodName
self.output = 'relative/path' # somthing like /tmp/tmpJshx/relative/path
self.output = 'relative/path' # something like /tmp/tmpJshx/relative/path
self.compiler.convertLess2Css(self.compiler.parseBaseDirs(BASE_DIR, self.output), outputFile=CSS_FILE)

# open the created file
with open(os.path.join(self.project_dir, self.output, CSS_FILE), "r") as f:
self.assertIsInstance(f, file)


def test_dot_path_same_name(self):
print "Running %s" % self._testMethodName
self.output = './'
self.compiler.convertLess2Css(self.compiler.parseBaseDirs(BASE_DIR, self.output))

# open the created file
with open(os.path.join(self.project_dir, self.output, LESS_FILE.replace(".less", ".css")), "r") as f:
self.assertIsInstance(f, file)


def test_dot_path_provided_name(self):
print "Running %s" % self._testMethodName
self.output = './'
self.compiler.convertLess2Css(self.compiler.parseBaseDirs(BASE_DIR, self.output), outputFile=CSS_FILE)

# open the created file
with open(os.path.join(self.project_dir, self.output, CSS_FILE), "r") as f:
self.assertIsInstance(f, file)


def test_empty_path_same_name(self):
print "Running %s" % self._testMethodName
self.output = ''
self.compiler.convertLess2Css(self.compiler.parseBaseDirs(BASE_DIR, self.output))

# open the created file
with open(os.path.join(self.project_dir, self.output, LESS_FILE.replace(".less", ".css")), "r") as f:
self.assertIsInstance(f, file)


def test_empty_path_provided_name(self):
print "Running %s" % self._testMethodName
self.output = ''
self.compiler.convertLess2Css(self.compiler.parseBaseDirs(BASE_DIR, self.output), outputFile=CSS_FILE)

# open the created file
with open(os.path.join(self.project_dir, self.output, CSS_FILE), "r") as f:
self.assertIsInstance(f, file)


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

0 comments on commit b7378e5

Please sign in to comment.