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
f2366b5e
Commit
f2366b5e
authored
Feb 26, 2016
by
David Trowbridge
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #544 from slafs/slafs/test-against-older-djangos
Add support for older Djangos
parents
8b304364
235a226a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
72 additions
and
3 deletions
+72
-3
.travis.yml
+6
-0
tests/tests/test_storage.py
+7
-1
tests/utils.py
+56
-1
tox.ini
+3
-1
No files found.
.travis.yml
View file @
f2366b5e
...
...
@@ -3,6 +3,12 @@ python:
-
3.5
sudo
:
false
env
:
-
TOXENV=py27-django16
-
TOXENV=py34-django16
-
TOXENV=pypy-django16
-
TOXENV=py27-django17
-
TOXENV=py34-django17
-
TOXENV=pypy-django17
-
TOXENV=py27-django18
-
TOXENV=pypy-django18
-
TOXENV=py34-django18
...
...
tests/tests/test_storage.py
View file @
f2366b5e
...
...
@@ -4,7 +4,13 @@ from django.contrib.staticfiles import finders
from
django.contrib.staticfiles.storage
import
staticfiles_storage
from
django.core.management
import
call_command
from
django.test
import
TestCase
from
django.test.utils
import
override_settings
,
modify_settings
from
django.test.utils
import
override_settings
try
:
from
django.test.utils
import
modify_settings
except
ImportError
:
# Django < 1.7
from
tests.utils
import
modify_settings
from
pipeline.collector
import
default_collector
from
pipeline.storage
import
PipelineStorage
...
...
tests/utils.py
View file @
f2366b5e
import
os
from
django.test
import
override_settings
from
django.conf
import
settings
from
django.utils
import
six
try
:
from
django.test
import
override_settings
except
ImportError
:
# Django < 1.7
from
django.test.utils
import
override_settings
def
_
(
path
):
...
...
@@ -11,3 +18,51 @@ def _(path):
class
pipeline_settings
(
override_settings
):
def
__init__
(
self
,
**
kwargs
):
self
.
options
=
{
'PIPELINE'
:
kwargs
}
# Django < 1.7 (copy-pasted from Django 1.7)
class
modify_settings
(
override_settings
):
"""
Like override_settings, but makes it possible to append, prepend or remove
items instead of redefining the entire list.
"""
def
__init__
(
self
,
*
args
,
**
kwargs
):
if
args
:
# Hack used when instantiating from SimpleTestCase._pre_setup.
assert
not
kwargs
self
.
operations
=
args
[
0
]
else
:
assert
not
args
self
.
operations
=
list
(
kwargs
.
items
())
def
save_options
(
self
,
test_func
):
if
test_func
.
_modified_settings
is
None
:
test_func
.
_modified_settings
=
self
.
operations
else
:
# Duplicate list to prevent subclasses from altering their parent.
test_func
.
_modified_settings
=
list
(
test_func
.
_modified_settings
)
+
self
.
operations
def
enable
(
self
):
self
.
options
=
{}
for
name
,
operations
in
self
.
operations
:
try
:
# When called from SimpleTestCase._pre_setup, values may be
# overridden several times; cumulate changes.
value
=
self
.
options
[
name
]
except
KeyError
:
value
=
list
(
getattr
(
settings
,
name
,
[]))
for
action
,
items
in
operations
.
items
():
# items my be a single value or an iterable.
if
isinstance
(
items
,
six
.
string_types
):
items
=
[
items
]
if
action
==
'append'
:
value
=
value
+
[
item
for
item
in
items
if
item
not
in
value
]
elif
action
==
'prepend'
:
value
=
[
item
for
item
in
items
if
item
not
in
value
]
+
value
elif
action
==
'remove'
:
value
=
[
item
for
item
in
value
if
item
not
in
items
]
else
:
raise
ValueError
(
"Unsupported action:
%
s"
%
action
)
self
.
options
[
name
]
=
value
super
(
modify_settings
,
self
)
.
enable
()
tox.ini
View file @
f2366b5e
[tox]
envlist
=
{py27,pypy,py34}-django{18,19},py35-django19,docs
{py27,pypy,py34}-django{1
6,17,1
8,19},py35-django19,docs
[testenv]
basepython
=
...
...
@@ -11,6 +11,8 @@ basepython =
deps
=
py{27,py}:
mock
py{27,py}:
futures
django16:
Django>=1.6,<1.7
django17:
Django>=1.7,<1.8
django18:
Django>=1.8,<1.9
django19:
Django>=1.9,<1.10
jinja2
...
...
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