Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pystache_custom
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
pystache_custom
Commits
f9a5b3d2
Commit
f9a5b3d2
authored
Apr 07, 2012
by
Chris Jerdonek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tests now working after making tests directory a sub-package.
parent
15fbaa53
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
33 additions
and
26 deletions
+33
-26
pystache/tests/common.py
+5
-1
pystache/tests/test_context.py
+1
-1
pystache/tests/test_examples.py
+2
-2
pystache/tests/test_loader.py
+1
-4
pystache/tests/test_locator.py
+2
-2
pystache/tests/test_renderengine.py
+1
-1
pystache/tests/test_renderer.py
+3
-3
pystache/tests/test_simple.py
+2
-2
pystache/tests/test_spec.py
+8
-3
pystache/tests/test_template_spec.py
+8
-7
No files found.
pystache/tests/common.py
View file @
f9a5b3d2
...
@@ -8,10 +8,14 @@ Provides test-related code that can be used by all tests.
...
@@ -8,10 +8,14 @@ Provides test-related code that can be used by all tests.
import
os
import
os
import
examples
import
examples
import
pystache
DATA_DIR
=
'tests/data'
_TESTS_DIR
=
os
.
path
.
dirname
(
pystache
.
tests
.
__file__
)
DATA_DIR
=
os
.
path
.
join
(
_TESTS_DIR
,
'data'
)
# i.e. 'pystache/tests/data'.
EXAMPLES_DIR
=
os
.
path
.
dirname
(
examples
.
__file__
)
EXAMPLES_DIR
=
os
.
path
.
dirname
(
examples
.
__file__
)
SPEC_TEST_DIR
=
os
.
path
.
join
(
os
.
path
.
dirname
(
pystache
.
__file__
),
'..'
,
'ext'
,
'spec'
,
'specs'
)
def
get_data_path
(
file_name
):
def
get_data_path
(
file_name
):
...
...
pystache/tests/test_context.py
View file @
f9a5b3d2
...
@@ -11,7 +11,7 @@ import unittest
...
@@ -11,7 +11,7 @@ import unittest
from
pystache.context
import
_NOT_FOUND
from
pystache.context
import
_NOT_FOUND
from
pystache.context
import
_get_value
from
pystache.context
import
_get_value
from
pystache.context
import
Context
from
pystache.context
import
Context
from
tests.common
import
AssertIsMixin
from
pystache.
tests.common
import
AssertIsMixin
class
SimpleObject
(
object
):
class
SimpleObject
(
object
):
...
...
pystache/tests/test_examples.py
View file @
f9a5b3d2
...
@@ -12,8 +12,8 @@ from examples.unicode_output import UnicodeOutput
...
@@ -12,8 +12,8 @@ from examples.unicode_output import UnicodeOutput
from
examples.unicode_input
import
UnicodeInput
from
examples.unicode_input
import
UnicodeInput
from
examples.nested_context
import
NestedContext
from
examples.nested_context
import
NestedContext
from
pystache
import
Renderer
from
pystache
import
Renderer
from
tests.common
import
EXAMPLES_DIR
from
pystache.
tests.common
import
EXAMPLES_DIR
from
tests.common
import
AssertStringMixin
from
pystache.
tests.common
import
AssertStringMixin
class
TestView
(
unittest
.
TestCase
,
AssertStringMixin
):
class
TestView
(
unittest
.
TestCase
,
AssertStringMixin
):
...
...
pystache/tests/test_loader.py
View file @
f9a5b3d2
...
@@ -9,14 +9,11 @@ import os
...
@@ -9,14 +9,11 @@ import os
import
sys
import
sys
import
unittest
import
unittest
from
tests.common
import
AssertStringMixin
from
pystache.tests.common
import
AssertStringMixin
,
DATA_DIR
from
pystache
import
defaults
from
pystache
import
defaults
from
pystache.loader
import
Loader
from
pystache.loader
import
Loader
DATA_DIR
=
'tests/data'
class
LoaderTests
(
unittest
.
TestCase
,
AssertStringMixin
):
class
LoaderTests
(
unittest
.
TestCase
,
AssertStringMixin
):
def
test_init__extension
(
self
):
def
test_init__extension
(
self
):
...
...
pystache/tests/test_locator.py
View file @
f9a5b3d2
# encoding: utf-8
# encoding: utf-8
"""
"""
Contains locator.py unit tests
.
Unit tests for locator.py
.
"""
"""
...
@@ -14,7 +14,7 @@ import unittest
...
@@ -14,7 +14,7 @@ import unittest
from
pystache.loader
import
Loader
as
Reader
from
pystache.loader
import
Loader
as
Reader
from
pystache.locator
import
Locator
from
pystache.locator
import
Locator
from
tests.common
import
DATA_DIR
from
pystache.
tests.common
import
DATA_DIR
from
data.views
import
SayHello
from
data.views
import
SayHello
...
...
pystache/tests/test_renderengine.py
View file @
f9a5b3d2
...
@@ -11,7 +11,7 @@ import unittest
...
@@ -11,7 +11,7 @@ import unittest
from
pystache.context
import
Context
from
pystache.context
import
Context
from
pystache.parser
import
ParsingError
from
pystache.parser
import
ParsingError
from
pystache.renderengine
import
RenderEngine
from
pystache.renderengine
import
RenderEngine
from
tests.common
import
AssertStringMixin
from
pystache.
tests.common
import
AssertStringMixin
class
RenderEngineTestCase
(
unittest
.
TestCase
):
class
RenderEngineTestCase
(
unittest
.
TestCase
):
...
...
pystache/tests/test_renderer.py
View file @
f9a5b3d2
...
@@ -15,9 +15,9 @@ from pystache import Renderer
...
@@ -15,9 +15,9 @@ from pystache import Renderer
from
pystache
import
TemplateSpec
from
pystache
import
TemplateSpec
from
pystache.loader
import
Loader
from
pystache.loader
import
Loader
from
tests.common
import
get_data_path
from
pystache.
tests.common
import
get_data_path
from
tests.common
import
AssertStringMixin
from
pystache.
tests.common
import
AssertStringMixin
from
tests.data.views
import
SayHello
from
pystache.
tests.data.views
import
SayHello
class
RendererInitTestCase
(
unittest
.
TestCase
):
class
RendererInitTestCase
(
unittest
.
TestCase
):
...
...
pystache/tests/test_simple.py
View file @
f9a5b3d2
...
@@ -8,8 +8,8 @@ from examples.lambdas import Lambdas
...
@@ -8,8 +8,8 @@ from examples.lambdas import Lambdas
from
examples.template_partial
import
TemplatePartial
from
examples.template_partial
import
TemplatePartial
from
examples.simple
import
Simple
from
examples.simple
import
Simple
from
tests.common
import
EXAMPLES_DIR
from
pystache.
tests.common
import
EXAMPLES_DIR
from
tests.common
import
AssertStringMixin
from
pystache.
tests.common
import
AssertStringMixin
class
TestSimple
(
unittest
.
TestCase
,
AssertStringMixin
):
class
TestSimple
(
unittest
.
TestCase
,
AssertStringMixin
):
...
...
pystache/tests/test_spec.py
View file @
f9a5b3d2
...
@@ -24,12 +24,16 @@ import glob
...
@@ -24,12 +24,16 @@ import glob
import
os.path
import
os.path
import
unittest
import
unittest
import
pystache
from
pystache.renderer
import
Renderer
from
pystache.renderer
import
Renderer
from
tests.common
import
AssertStringMixin
from
pystache.tests.common
import
AssertStringMixin
,
SPEC_TEST_DIR
root_path
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'..'
,
'ext'
,
'spec'
,
'specs'
)
spec_paths
=
glob
.
glob
(
os
.
path
.
join
(
SPEC_TEST_DIR
,
'*.json'
))
spec_paths
=
glob
.
glob
(
os
.
path
.
join
(
root_path
,
'*.json'
))
if
len
(
spec_paths
)
==
0
:
raise
Exception
(
"""Spec tests not found in:
%
s
Consult the README file on how to add the spec tests."""
%
repr
(
SPEC_TEST_DIR
))
# TODO: give this a name better than MustacheSpec.
# TODO: give this a name better than MustacheSpec.
...
@@ -92,6 +96,7 @@ def buildTest(testData, spec_filename):
...
@@ -92,6 +96,7 @@ def buildTest(testData, spec_filename):
return
test
return
test
for
spec_path
in
spec_paths
:
for
spec_path
in
spec_paths
:
file_name
=
os
.
path
.
basename
(
spec_path
)
file_name
=
os
.
path
.
basename
(
spec_path
)
...
...
pystache/tests/test_template_spec.py
View file @
f9a5b3d2
...
@@ -19,12 +19,12 @@ from pystache import TemplateSpec
...
@@ -19,12 +19,12 @@ from pystache import TemplateSpec
from
pystache.locator
import
Locator
from
pystache.locator
import
Locator
from
pystache.loader
import
Loader
from
pystache.loader
import
Loader
from
pystache.spec_loader
import
SpecLoader
from
pystache.spec_loader
import
SpecLoader
from
tests.common
import
DATA_DIR
from
pystache.
tests.common
import
DATA_DIR
from
tests.common
import
EXAMPLES_DIR
from
pystache.
tests.common
import
EXAMPLES_DIR
from
tests.common
import
AssertIsMixin
from
pystache.
tests.common
import
AssertIsMixin
from
tests.common
import
AssertStringMixin
from
pystache.
tests.common
import
AssertStringMixin
from
tests.data.views
import
SampleView
from
pystache.
tests.data.views
import
SampleView
from
tests.data.views
import
NonAscii
from
pystache.
tests.data.views
import
NonAscii
class
Thing
(
object
):
class
Thing
(
object
):
...
@@ -46,7 +46,8 @@ class ViewTestCase(unittest.TestCase, AssertStringMixin):
...
@@ -46,7 +46,8 @@ class ViewTestCase(unittest.TestCase, AssertStringMixin):
self
.
assertRaises
(
IOError
,
renderer
.
render
,
view
)
self
.
assertRaises
(
IOError
,
renderer
.
render
,
view
)
view
.
template_rel_directory
=
"../examples"
# TODO: change this test to remove the following brittle line.
view
.
template_rel_directory
=
"../../examples"
actual
=
renderer
.
render
(
view
)
actual
=
renderer
.
render
(
view
)
self
.
assertEquals
(
actual
,
"No tags..."
)
self
.
assertEquals
(
actual
,
"No tags..."
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment