Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-pipeline
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
django-pipeline
Commits
37d913db
Commit
37d913db
authored
Jan 15, 2017
by
Timothée Peignier
Committed by
GitHub
Jan 15, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #610 from chipx86/fix-copy-file-regression
Fix a regression in determining when to collect static files.
parents
dbf66e6e
d79be259
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
1 deletions
+24
-1
pipeline/collector.py
+1
-1
tests/tests/test_collector.py
+23
-0
No files found.
pipeline/collector.py
View file @
37d913db
...
@@ -78,7 +78,7 @@ class Collector(object):
...
@@ -78,7 +78,7 @@ class Collector(object):
else
:
else
:
try
:
try
:
# When was the source file modified last time?
# When was the source file modified last time?
source_last_modified
=
self
.
_get_modified_time
(
source_storage
,
p
refixed_p
ath
)
source_last_modified
=
self
.
_get_modified_time
(
source_storage
,
path
)
except
(
OSError
,
NotImplementedError
,
AttributeError
):
except
(
OSError
,
NotImplementedError
,
AttributeError
):
pass
pass
else
:
else
:
...
...
tests/tests/test_collector.py
View file @
37d913db
...
@@ -3,12 +3,17 @@ from __future__ import unicode_literals
...
@@ -3,12 +3,17 @@ from __future__ import unicode_literals
import
os
import
os
from
django.contrib.staticfiles
import
finders
from
django.contrib.staticfiles
import
finders
from
django.core.files.storage
import
FileSystemStorage
from
django.test
import
TestCase
from
django.test
import
TestCase
from
pipeline.collector
import
default_collector
from
pipeline.collector
import
default_collector
from
pipeline.finders
import
PipelineFinder
from
pipeline.finders
import
PipelineFinder
def
local_path
(
path
):
return
os
.
path
.
abspath
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'..'
,
path
))
class
CollectorTest
(
TestCase
):
class
CollectorTest
(
TestCase
):
def
tearDown
(
self
):
def
tearDown
(
self
):
super
(
CollectorTest
,
self
)
.
tearDown
()
super
(
CollectorTest
,
self
)
.
tearDown
()
...
@@ -31,6 +36,24 @@ class CollectorTest(TestCase):
...
@@ -31,6 +36,24 @@ class CollectorTest(TestCase):
'pipeline/js/second.js'
,
'pipeline/js/second.js'
,
]))
]))
def
test_delete_file_with_modified
(
self
):
list
(
default_collector
.
collect
())
storage
=
FileSystemStorage
(
local_path
(
'assets'
))
new_mtime
=
os
.
path
.
getmtime
(
storage
.
path
(
'js/first.js'
))
-
1000
os
.
utime
(
default_collector
.
storage
.
path
(
'pipeline/js/first.js'
),
(
new_mtime
,
new_mtime
))
self
.
assertTrue
(
default_collector
.
delete_file
(
'js/first.js'
,
'pipeline/js/first.js'
,
storage
))
def
test_delete_file_with_unmodified
(
self
):
list
(
default_collector
.
collect
(
files
=
[
'pipeline/js/first.js'
]))
self
.
assertFalse
(
default_collector
.
delete_file
(
'js/first.js'
,
'pipeline/js/first.js'
,
FileSystemStorage
(
local_path
(
'assets'
))))
def
_get_collectable_files
(
self
):
def
_get_collectable_files
(
self
):
for
finder
in
finders
.
get_finders
():
for
finder
in
finders
.
get_finders
():
if
not
isinstance
(
finder
,
PipelineFinder
):
if
not
isinstance
(
finder
,
PipelineFinder
):
...
...
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