-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fbdd323
commit 4abed00
Showing
7 changed files
with
102 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
import re | ||
import subprocess as sp | ||
from pathlib import Path | ||
from tempfile import gettempdir | ||
|
||
|
||
EXTENSION_PATT = re.compile('(?:extends|include)\s+(.+)') | ||
PUG_CLI_PATH = str(Path(sp.Popen(('which', 'pug'), stdout=sp.PIPE).communicate()[0].decode('utf8').strip()).absolute()) \ | ||
if sp.Popen(('which', 'npm'), stdout=sp.DEVNULL).wait() == 0 else None | ||
TEMPDIR = Path(gettempdir(), '.ninjadog/') | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
from pprint import pprint | ||
|
||
from webtest import TestApp as _TestApp | ||
|
||
import pytest | ||
|
||
|
||
@pytest.fixture | ||
def settings(): | ||
from textwrap import dedent | ||
from configparser import ConfigParser | ||
|
||
config_ini = dedent(""" | ||
[app:main] | ||
pyramid.reload_templates = true | ||
pug.static_only = false | ||
""") | ||
config = ConfigParser() | ||
config.read_string(config_ini) | ||
return dict(config.items('app:main')) | ||
|
||
@pytest.fixture | ||
def testapp(settings): | ||
from pyramid.config import Configurator | ||
with Configurator(settings={'pug.static_only': True}) as config: | ||
config.include('ninjadog') | ||
config.add_route('home', '/') | ||
config.add_view( | ||
lambda request: {'title': 'title', 'subtitle': 'subtitle', 'content': 'This is a paragraph'}, | ||
route_name='home', | ||
renderer='./templates/child.pug', | ||
) | ||
app = config.make_wsgi_app() | ||
|
||
#pprint(config.registry.settings) | ||
|
||
yield _TestApp(app) | ||
|
||
|
||
def test_rendering(testapp): | ||
response = testapp.get('/', status=200) | ||
assert b'title' in response.body | ||
assert b'subtitle' in response.body | ||
assert b'This is a paragraph' in response.body |
This file was deleted.
Oops, something went wrong.