add possibility to exclude/whitelist views belonging to specified module...#28
add possibility to exclude/whitelist views belonging to specified module...#28szelga wants to merge 1 commit intonoirbizarre:masterfrom
Conversation
…ules in javascript URL resolver.
|
I need to review in details this pull request before merging it. |
|
Tests are missing. I think it's a little bit trickier than you think :) |
$ make test
Running test suite
Creating test database for alias 'default'...
.....s.....................s................................................................................................................................EEEEE...........
======================================================================
ERROR: test (djangojs.tests.test_javascript.DjangoJsTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/szelga/soft/Projects/django.js/djangojs/runners.py", line 281, in test
self.run_suite()
File "/home/szelga/soft/Projects/django.js/djangojs/runners.py", line 166, in run_suite
self.phantomjs(self.phantomjs_runner, url, title=self.title)
File "/home/szelga/soft/Projects/django.js/djangojs/runners.py", line 139, in phantomjs
for item in parser.parse(output):
File "/home/szelga/soft/Projects/django.js/djangojs/tap.py", line 205, in parse
for line in lines:
File "/home/szelga/soft/Projects/django.js/djangojs/runners.py", line 103, in execute
process = Popen(command, stdout=PIPE, stderr=STDOUT, universal_newlines=True)
File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1249, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
======================================================================
ERROR: test (djangojs.tests.test_javascript.JasmineTemplateTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/szelga/soft/Projects/django.js/djangojs/runners.py", line 281, in test
self.run_suite()
File "/home/szelga/soft/Projects/django.js/djangojs/runners.py", line 166, in run_suite
self.phantomjs(self.phantomjs_runner, url, title=self.title)
File "/home/szelga/soft/Projects/django.js/djangojs/runners.py", line 139, in phantomjs
for item in parser.parse(output):
File "/home/szelga/soft/Projects/django.js/djangojs/tap.py", line 205, in parse
for line in lines:
File "/home/szelga/soft/Projects/django.js/djangojs/runners.py", line 103, in execute
process = Popen(command, stdout=PIPE, stderr=STDOUT, universal_newlines=True)
File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1249, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
======================================================================
ERROR: test (djangojs.tests.test_javascript.JasmineTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/szelga/soft/Projects/django.js/djangojs/runners.py", line 281, in test
self.run_suite()
File "/home/szelga/soft/Projects/django.js/djangojs/runners.py", line 166, in run_suite
self.phantomjs(self.phantomjs_runner, url, title=self.title)
File "/home/szelga/soft/Projects/django.js/djangojs/runners.py", line 139, in phantomjs
for item in parser.parse(output):
File "/home/szelga/soft/Projects/django.js/djangojs/tap.py", line 205, in parse
for line in lines:
File "/home/szelga/soft/Projects/django.js/djangojs/runners.py", line 103, in execute
process = Popen(command, stdout=PIPE, stderr=STDOUT, universal_newlines=True)
File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1249, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
======================================================================
ERROR: test (djangojs.tests.test_javascript.QUnitTemplateTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/szelga/soft/Projects/django.js/djangojs/runners.py", line 293, in test
self.run_suite()
File "/home/szelga/soft/Projects/django.js/djangojs/runners.py", line 166, in run_suite
self.phantomjs(self.phantomjs_runner, url, title=self.title)
File "/home/szelga/soft/Projects/django.js/djangojs/runners.py", line 139, in phantomjs
for item in parser.parse(output):
File "/home/szelga/soft/Projects/django.js/djangojs/tap.py", line 205, in parse
for line in lines:
File "/home/szelga/soft/Projects/django.js/djangojs/runners.py", line 103, in execute
process = Popen(command, stdout=PIPE, stderr=STDOUT, universal_newlines=True)
File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1249, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
======================================================================
ERROR: test (djangojs.tests.test_javascript.QUnitTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/szelga/soft/Projects/django.js/djangojs/runners.py", line 293, in test
self.run_suite()
File "/home/szelga/soft/Projects/django.js/djangojs/runners.py", line 166, in run_suite
self.phantomjs(self.phantomjs_runner, url, title=self.title)
File "/home/szelga/soft/Projects/django.js/djangojs/runners.py", line 139, in phantomjs
for item in parser.parse(output):
File "/home/szelga/soft/Projects/django.js/djangojs/tap.py", line 205, in parse
for line in lines:
File "/home/szelga/soft/Projects/django.js/djangojs/runners.py", line 103, in execute
process = Popen(command, stdout=PIPE, stderr=STDOUT, universal_newlines=True)
File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1249, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
----------------------------------------------------------------------
Ran 172 tests in 8.333s
FAILED (errors=5, skipped=2)
Destroying test database for alias 'default'...
make: *** [test] Error 1are tests relevant to this pull request passed and what should i install for erroneous tests to be passed? |
|
You need to install PhantomJS if you want to run JavaScript tests in the console. |
|
i perform checks like this: for app in settings.JS_URLS_APPS:
if mod_name[:len(app)] == app:not like this for app in settings.JS_URLS_APPS:
if mod_name == app:so that those settings extend to nested modules. that's why the last test fails (i haven't looked through the others yet). do you want me to change that? or, perhaps, i should add wildcards support (e.g., 'django.contrib.admindocs' is just for admindocs module, and 'django.contrib.admindocs.*' is for nested modules as well)? |
|
If the behavior is entirely specified and tested, you can do what you want. My personnel preference goes to no wildcard support (to have the same behavior as other settings) |
|
after some tinkering with this feature i decided that it would be too confusing to use it and i can't make it much less confusing. |
|
I agree with you ! 👍 |
add possibility to exclude/whitelist views belonging to specified modules in javascript URL resolver.
the following settings are available for this feature:
JS_URLS_APPSDefault:
NoneSerialized applications whitelist. If this setting is specified, only URLs with views belonging to modules listed in will be serialized.
JS_URLS_APPS_EXCLUDEDefault:
NoneSerialized applications blacklist.
If this setting is specified, URLs with views belonging to modules listed in will not be serialized.