Browse Source

Merge pull request #274 from hyde/feature/update-tests

updated unittests
main
Jordi Llonch 9 years ago
parent
commit
8b8581d6e0
9 changed files with 28 additions and 26 deletions
  1. +1
    -1
      hyde/ext/plugins/css.py
  2. +1
    -1
      hyde/generator.py
  3. +8
    -2
      hyde/site.py
  4. +6
    -7
      hyde/tests/ext/scss/expected-site.css
  5. +1
    -1
      hyde/tests/ext/scss/site.scss
  6. +1
    -4
      hyde/tests/ext/stylus/expected-site-compressed.css
  7. +2
    -2
      hyde/tests/ext/test_stylus.py
  8. +4
    -4
      hyde/tests/ext/uglify/expected-jquery-nc.js
  9. +4
    -4
      hyde/tests/ext/uglify/expected-jquery.js

+ 1
- 1
hyde/ext/plugins/css.py View File

@@ -218,7 +218,6 @@ class StylusPlugin(CLTransformer):
return return
stylus = self.app stylus = self.app
source = File.make_temp(text.strip()) source = File.make_temp(text.strip())
target = source
supported = [("compress", "c"), ("include", "I")] supported = [("compress", "c"), ("include", "I")]


args = [unicode(stylus)] args = [unicode(stylus)]
@@ -231,6 +230,7 @@ class StylusPlugin(CLTransformer):
"Cannot process %s. Error occurred when " "Cannot process %s. Error occurred when "
"processing [%s]" % (stylus.name, resource.source_file), "processing [%s]" % (stylus.name, resource.source_file),
sys.exc_info()) sys.exc_info())
target = File(source.path + '.css')
return target.read_all() return target.read_all()






+ 1
- 1
hyde/generator.py View File

@@ -307,7 +307,7 @@ class Generator(object):
for node in node.walk(): for node in node.walk():
logger.debug("Generating Node [%s]", node) logger.debug("Generating Node [%s]", node)
self.events.begin_node(node) self.events.begin_node(node)
for resource in node.resources:
for resource in sorted(node.resources):
self.__generate_resource__(resource, incremental) self.__generate_resource__(resource, incremental)
self.events.node_complete(node) self.events.node_complete(node)




+ 8
- 2
hyde/site.py View File

@@ -45,6 +45,12 @@ class Processable(object):
def __repr__(self): def __repr__(self):
return self.path return self.path


def __lt__(self, other):
return self.source.path < other.source.path

def __gt__(self, other):
return self.source.path > other.source.path

@property @property
def path(self): def path(self):
""" """
@@ -188,7 +194,7 @@ class Node(Processable):
yielding the child nodes depth-first. yielding the child nodes depth-first.
""" """
yield self yield self
for child in self.child_nodes:
for child in sorted([node for node in self.child_nodes]):
for node in child.walk(): for node in child.walk():
yield node yield node


@@ -207,7 +213,7 @@ class Node(Processable):
Walks the resources in this hierarchy. Walks the resources in this hierarchy.
""" """
for node in self.walk(): for node in self.walk():
for resource in node.resources:
for resource in sorted([resource for resource in node.resources]):
yield resource yield resource


@property @property


+ 6
- 7
hyde/tests/ext/scss/expected-site.css View File

@@ -1,16 +1,15 @@
* {
border: 0;
padding: 0;
margin: 0;
}
@import "inc/reset.css";

#header { #header {
color: #333333;
color: #333;
border-left: 1px; border-left: 1px;
border-right: 2px; border-right: 2px;
} }

#footer { #footer {
color: #333333;
color: #333;
} }

#content { #content {
-webkit-border-radius: 10px; -webkit-border-radius: 10px;
-moz-border-radius: 10px; -moz-border-radius: 10px;


+ 1
- 1
hyde/tests/ext/scss/site.scss View File

@@ -1,4 +1,4 @@
@option compress: no;
@option style: expanded;


@import "inc/mixin"; @import "inc/mixin";
@import "inc/vars"; @import "inc/vars";


+ 1
- 4
hyde/tests/ext/stylus/expected-site-compressed.css View File

@@ -1,4 +1 @@
*{border:0;padding:0;margin:0}
#header{color:#333;border-left:1px;border-right:2px}
#footer{color:#333}
#content{-webkit-border-radius:10px;-moz-border-radius:10px;border-radius:10px}
*{border:0;padding:0;margin:0}#header{color:#333;border-left:1px;border-right:2px}#footer{color:#333}#content{-webkit-border-radius:10px;-moz-border-radius:10px;border-radius:10px}

+ 2
- 2
hyde/tests/ext/test_stylus.py View File

@@ -29,7 +29,7 @@ class TestStylus(object):
def test_can_execute_stylus(self): def test_can_execute_stylus(self):
s = Site(TEST_SITE) s = Site(TEST_SITE)
s.config.plugins = ['hyde.ext.plugins.css.StylusPlugin'] s.config.plugins = ['hyde.ext.plugins.css.StylusPlugin']
paths = ['/usr/local/share/npm/bin/stylus']
paths = ['/usr/local/bin/stylus', '/usr/local/share/npm/bin/stylus']
for path in paths: for path in paths:
if File(path).exists: if File(path).exists:
s.config.stylus = Expando(dict(app=path)) s.config.stylus = Expando(dict(app=path))
@@ -47,7 +47,7 @@ class TestStylus(object):
s = Site(TEST_SITE) s = Site(TEST_SITE)
s.config.mode = "production" s.config.mode = "production"
s.config.plugins = ['hyde.ext.plugins.css.StylusPlugin'] s.config.plugins = ['hyde.ext.plugins.css.StylusPlugin']
paths = ['/usr/local/share/npm/bin/stylus']
paths = ['/usr/local/bin/stylus', '/usr/local/share/npm/bin/stylus']
for path in paths: for path in paths:
if File(path).exists: if File(path).exists:
s.config.stylus = Expando(dict(app=path)) s.config.stylus = Expando(dict(app=path))


+ 4
- 4
hyde/tests/ext/uglify/expected-jquery-nc.js
File diff suppressed because it is too large
View File


+ 4
- 4
hyde/tests/ext/uglify/expected-jquery.js
File diff suppressed because it is too large
View File


Loading…
Cancel
Save