Browse Source

Merge pull request #41 from vincentbernat/hyde

---

Various fixes to ensure that tests run. They now pass cleanly on my system.
main
Lakshmi Vyasarajan 13 years ago
parent
commit
51ec4bfc8a
7 changed files with 21 additions and 14 deletions
  1. +2
    -1
      hyde/ext/plugins/sorter.py
  2. +2
    -1
      hyde/tests/ext/test_less.py
  3. +1
    -1
      hyde/tests/ext/test_optipng.py
  4. +4
    -4
      hyde/tests/ext/test_sorter.py
  5. +5
    -3
      hyde/tests/ext/test_stylus.py
  6. +6
    -3
      hyde/tests/ext/test_uglify.py
  7. +1
    -1
      hyde/tests/templates/jinja2/index.html

+ 2
- 1
hyde/ext/plugins/sorter.py View File

@@ -44,7 +44,8 @@ def sort_method(node, settings=None):
if settings and hasattr(settings, 'attr') and settings.attr:
attr = settings.attr
filter_ = partial(filter_method, settings=settings)
resources = ifilter(filter_, node.walk_resources())
resources = sorted(ifilter(filter_, node.walk_resources()),
key=lambda f: f.name)
reverse = False
if settings and hasattr(settings, 'reverse'):
reverse = settings.reverse


+ 2
- 1
hyde/tests/ext/test_less.py View File

@@ -29,7 +29,8 @@ class TestLess(object):
def test_can_execute_less(self):
s = Site(TEST_SITE)
s.config.plugins = ['hyde.ext.plugins.less.LessCSSPlugin']
paths = ['/usr/local/share/npm/bin/lessc', '~/local/bin/lessc']
paths = ['/usr/local/share/npm/bin/lessc', '~/local/bin/lessc',
'/usr/bin/lessc', '~/bin/lessc']
less = [path for path in paths if File(path).exists]
if not less:
assert False, "Cannot find the lessc executable"


+ 1
- 1
hyde/tests/ext/test_optipng.py View File

@@ -31,7 +31,7 @@ class TestOptipng(object):
s = Site(TEST_SITE)
s.config.mode = "production"
s.config.plugins = ['hyde.ext.plugins.optipng.OptiPNGPlugin']
paths = ['/usr/local/bin/optipng']
paths = ['/usr/local/bin/optipng', '/usr/bin/optipng']
optipng = [path for path in paths if File(path).exists]
if not optipng:
assert False, "Cannot find the optipng executable"


+ 4
- 4
hyde/tests/ext/test_sorter.py View File

@@ -49,7 +49,7 @@ class TestSorter(object):
pages = [page.name for page in
s.content.walk_resources_sorted_by_kind()]

assert pages == sorted(expected, key=lambda f: File(f).kind)
assert pages == sorted(sorted(expected), key=lambda f: File(f).kind)

def test_walk_resources_sorted_reverse(self):
s = Site(TEST_SITE)
@@ -74,7 +74,7 @@ class TestSorter(object):
s.content.walk_resources_sorted_by_kind()]


assert pages == sorted(expected, key=lambda f: File(f).kind, reverse=True)
assert pages == sorted(sorted(expected), key=lambda f: File(f).kind, reverse=True)

def test_walk_resources_sorted_with_filters(self):
s = Site(TEST_SITE)
@@ -131,7 +131,7 @@ class TestSorter(object):

expected_sorted = [File(page).name
for page in
sorted(expected,
sorted(sorted(expected),
key=lambda p: tuple(
[File(p).kind,
File(p).parent.name]))]
@@ -269,4 +269,4 @@ class TestSorter(object):
text = target.read_all()
q = PyQuery(text)

assert q('span.latest').text() == 'YayYayYay'
assert q('span.latest').text() == 'YayYayYay'

+ 5
- 3
hyde/tests/ext/test_stylus.py View File

@@ -29,7 +29,8 @@ class TestLess(object):
def test_can_execute_stylus(self):
s = Site(TEST_SITE)
s.config.plugins = ['hyde.ext.plugins.stylus.StylusPlugin']
paths = ['/usr/local/share/npm/bin/stylus', '~/local/bin/stylus']
paths = ['/usr/local/share/npm/bin/stylus', '~/local/bin/stylus',
'~/bin/stylus']
stylus = [path for path in paths if File(path).exists]
if not stylus:
assert False, "Cannot find the stylus executable"
@@ -53,7 +54,8 @@ class TestLess(object):
s = Site(TEST_SITE)
s.config.mode = "production"
s.config.plugins = ['hyde.ext.plugins.stylus.StylusPlugin']
paths = ['/usr/local/share/npm/bin/stylus', '~/local/bin/stylus']
paths = ['/usr/local/share/npm/bin/stylus', '~/local/bin/stylus',
'~/bin/stylus']
stylus = [path for path in paths if File(path).exists]
if not stylus:
assert False, "Cannot find the stylus executable"
@@ -68,4 +70,4 @@ class TestLess(object):
assert target.exists
text = target.read_all()
expected_text = File(STYLUS_SOURCE.child('expected-site-compressed.css')).read_all()
assert text.strip() == expected_text.strip()
assert text.strip() == expected_text.strip()

+ 6
- 3
hyde/tests/ext/test_uglify.py View File

@@ -31,7 +31,8 @@ class TestLess(object):
s = Site(TEST_SITE)
s.config.plugins = ['hyde.ext.plugins.uglify.UglifyPlugin']
s.config.mode = "production"
paths = ['/usr/local/share/npm/bin/uglifyjs', '~/local/bin/uglifyjs']
paths = ['/usr/local/share/npm/bin/uglifyjs', '~/local/bin/uglifyjs',
'/usr/bin/uglifyjs', '~/bin/uglifyjs']
uglify = [path for path in paths if File(path).exists]
if not uglify:
assert False, "Cannot find the uglify executable"
@@ -52,7 +53,8 @@ class TestLess(object):
s = Site(TEST_SITE)
s.config.plugins = ['hyde.ext.plugins.uglify.UglifyPlugin']
s.config.mode = "production"
paths = ['/usr/local/share/npm/bin/uglifyjs', '~/local/bin/uglifyjs']
paths = ['/usr/local/share/npm/bin/uglifyjs', '~/local/bin/uglifyjs',
'/usr/bin/uglifyjs', '~/bin/uglifyjs']
uglify = [path for path in paths if File(path).exists]
if not uglify:
assert False, "Cannot find the uglify executable"
@@ -74,7 +76,8 @@ class TestLess(object):
s = Site(TEST_SITE)
s.config.plugins = ['hyde.ext.plugins.uglify.UglifyPlugin']
s.config.mode = "dev"
paths = ['/usr/local/share/npm/bin/uglifyjs', '~/local/bin/uglifyjs']
paths = ['/usr/local/share/npm/bin/uglifyjs', '~/local/bin/uglifyjs',
'/usr/bin/uglifyjs', '~/bin/uglifyjs']
uglify = [path for path in paths if File(path).exists]
if not uglify:
assert False, "Cannot find the uglify executable"


+ 1
- 1
hyde/tests/templates/jinja2/index.html View File

@@ -6,7 +6,7 @@
<div class="article">
<h2><a href="{{ article.href|e }}">{{ article.title|e }}</a></h2>
<p class="meta">written by <a href="{{ article.user.href|e
}}">{{ article.user.username|e }}</a> on {{ article.pub_date|dateformat }}</p>
}}">{{ article.user.username|e }}</a> on {{ article.pub_date.strftime('%Y-%m-%d') }}</p>
<div class="text">{{ article.body }}</div>
</div>
{%- endfor %}


Loading…
Cancel
Save