Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
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
edx
edx-platform
Commits
c0638ca9
Commit
c0638ca9
authored
Nov 21, 2017
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use file watches rather that polling for asset watching
parent
8347e6bb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
9 deletions
+8
-9
pavelib/assets.py
+3
-4
pavelib/paver_tests/test_assets.py
+5
-5
No files found.
pavelib/assets.py
View file @
c0638ca9
...
...
@@ -16,7 +16,7 @@ from paver import tasks
from
paver.easy
import
call_task
,
cmdopts
,
consume_args
,
needs
,
no_help
,
path
,
sh
,
task
from
watchdog.events
import
PatternMatchingEventHandler
from
watchdog.observers.api
import
DEFAULT_OBSERVER_TIMEOUT
from
watchdog.observers
.polling
import
Polling
Observer
from
watchdog.observers
import
Observer
from
openedx.core.djangoapps.theming.paver_helpers
import
get_theme_paths
...
...
@@ -792,7 +792,7 @@ def execute_webpack_watch(settings=None):
# from Watchdog like the other watchers do.
run_background_process
(
'STATIC_ROOT_LMS={static_root_lms} STATIC_ROOT_CMS={static_root_cms} $(npm bin)/webpack {options}'
.
format
(
options
=
'--watch --
watch-poll=200 --
config={config_path}'
.
format
(
options
=
'--watch --config={config_path}'
.
format
(
config_path
=
Env
.
get_django_setting
(
"WEBPACK_CONFIG_PATH"
,
"lms"
,
settings
=
settings
)
),
static_root_lms
=
Env
.
get_django_setting
(
"STATIC_ROOT"
,
"lms"
,
settings
=
settings
),
...
...
@@ -852,7 +852,6 @@ def watch_assets(options):
themes
=
get_parsed_option
(
options
,
'themes'
)
theme_dirs
=
get_parsed_option
(
options
,
'theme_dirs'
,
[])
# wait comes in as a list of strings, define the default value similarly for convenience.
default_wait
=
[
unicode
(
DEFAULT_OBSERVER_TIMEOUT
)]
wait
=
float
(
get_parsed_option
(
options
,
'wait'
,
default_wait
)[
0
])
...
...
@@ -863,7 +862,7 @@ def watch_assets(options):
theme_dirs
=
[
path
(
_dir
)
for
_dir
in
theme_dirs
]
sass_directories
=
get_watcher_dirs
(
theme_dirs
,
themes
)
observer
=
Polling
Observer
(
timeout
=
wait
)
observer
=
Observer
(
timeout
=
wait
)
CoffeeScriptWatcher
()
.
register
(
observer
)
SassWatcher
()
.
register
(
observer
,
sass_directories
)
...
...
pavelib/paver_tests/test_assets.py
View file @
c0638ca9
...
...
@@ -6,7 +6,7 @@ from unittest import TestCase
import
ddt
from
mock
import
patch
from
paver.easy
import
call_task
,
path
from
watchdog.observers
.polling
import
Polling
Observer
from
watchdog.observers
import
Observer
from
pavelib.assets
import
COLLECTSTATIC_LOG_DIR_ARG
,
collect_assets
...
...
@@ -221,7 +221,7 @@ class TestPaverWatchAssetTasks(TestCase):
Test the "compile_sass" task.
"""
with
patch
(
'pavelib.assets.SassWatcher.register'
)
as
mock_register
:
with
patch
(
'pavelib.assets.
Polling
Observer.start'
):
with
patch
(
'pavelib.assets.Observer.start'
):
with
patch
(
'pavelib.assets.execute_webpack_watch'
)
as
mock_webpack
:
call_task
(
'pavelib.assets.watch_assets'
,
...
...
@@ -232,7 +232,7 @@ class TestPaverWatchAssetTasks(TestCase):
sass_watcher_args
=
mock_register
.
call_args_list
[
0
][
0
]
self
.
assertIsInstance
(
sass_watcher_args
[
0
],
Polling
Observer
)
self
.
assertIsInstance
(
sass_watcher_args
[
0
],
Observer
)
self
.
assertIsInstance
(
sass_watcher_args
[
1
],
list
)
self
.
assertItemsEqual
(
sass_watcher_args
[
1
],
self
.
expected_sass_directories
)
...
...
@@ -248,7 +248,7 @@ class TestPaverWatchAssetTasks(TestCase):
])
with
patch
(
'pavelib.assets.SassWatcher.register'
)
as
mock_register
:
with
patch
(
'pavelib.assets.
Polling
Observer.start'
):
with
patch
(
'pavelib.assets.Observer.start'
):
with
patch
(
'pavelib.assets.execute_webpack_watch'
)
as
mock_webpack
:
call_task
(
'pavelib.assets.watch_assets'
,
...
...
@@ -262,7 +262,7 @@ class TestPaverWatchAssetTasks(TestCase):
self
.
assertEqual
(
mock_webpack
.
call_count
,
1
)
sass_watcher_args
=
mock_register
.
call_args_list
[
0
][
0
]
self
.
assertIsInstance
(
sass_watcher_args
[
0
],
Polling
Observer
)
self
.
assertIsInstance
(
sass_watcher_args
[
0
],
Observer
)
self
.
assertIsInstance
(
sass_watcher_args
[
1
],
list
)
self
.
assertItemsEqual
(
sass_watcher_args
[
1
],
self
.
expected_sass_directories
)
...
...
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