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
1e73c246
Commit
1e73c246
authored
Aug 30, 2016
by
Timothée Peignier
Committed by
GitHub
Aug 30, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #590 from solkaz/master
Remove empty args from argument_list in SubprocessCompiler
parents
c6067eb3
f7f6b0e7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
1 deletions
+30
-1
AUTHORS
+1
-0
pipeline/compilers/__init__.py
+3
-0
tests/tests/test_compiler.py
+26
-1
No files found.
AUTHORS
View file @
1e73c246
...
@@ -59,6 +59,7 @@ or just made Pipeline more awesome.
...
@@ -59,6 +59,7 @@ or just made Pipeline more awesome.
* Jannis Leidel <jannis@leidel.info>
* Jannis Leidel <jannis@leidel.info>
* Jared Scott <jscott@convertro.com>
* Jared Scott <jscott@convertro.com>
* Jaromir Fojtu <jaromir.fojtu@gmail.com>
* Jaromir Fojtu <jaromir.fojtu@gmail.com>
* Jeff Held <jheld135@gmail.com>
* Jon Dufresne <jon.dufresne@gmail.com>
* Jon Dufresne <jon.dufresne@gmail.com>
* Josh Braegger <rckclmbr@gmail.com>
* Josh Braegger <rckclmbr@gmail.com>
* Joshua Kehn <josh@kehn.us>
* Joshua Kehn <josh@kehn.us>
...
...
pipeline/compilers/__init__.py
View file @
1e73c246
...
@@ -112,6 +112,9 @@ class SubProcessCompiler(CompilerBase):
...
@@ -112,6 +112,9 @@ class SubProcessCompiler(CompilerBase):
else
:
else
:
argument_list
.
extend
(
flattening_arg
)
argument_list
.
extend
(
flattening_arg
)
# The first element in argument_list is the program that will be executed; if it is '', then
# a PermissionError will be raised. Thus empty arguments are filtered out from argument_list
argument_list
=
filter
(
None
,
argument_list
)
stdout
=
None
stdout
=
None
try
:
try
:
# We always catch stdout in a file, but we may not have a use for it.
# We always catch stdout in a file, but we may not have a use for it.
...
...
tests/tests/test_compiler.py
View file @
1e73c246
...
@@ -42,6 +42,18 @@ class InvalidCompiler(SubProcessCompiler):
...
@@ -42,6 +42,18 @@ class InvalidCompiler(SubProcessCompiler):
)
)
return
self
.
execute_command
(
command
)
return
self
.
execute_command
(
command
)
class
CompilerWithEmptyFirstArg
(
SubProcessCompiler
):
output_extension
=
'junk'
def
match_file
(
self
,
path
):
return
path
.
endswith
(
'.coffee'
)
def
compile_file
(
self
,
infile
,
outfile
,
outdated
=
False
,
force
=
False
):
command
=
(
(
''
,
'/usr/bin/env'
,
'cat'
),
infile
,
)
return
self
.
execute_command
(
command
,
stdout_captured
=
outfile
)
class
CopyingCompiler
(
SubProcessCompiler
):
class
CopyingCompiler
(
SubProcessCompiler
):
output_extension
=
'junk'
output_extension
=
'junk'
...
@@ -149,6 +161,20 @@ class CompilerSelfWriterTest(TestCase):
...
@@ -149,6 +161,20 @@ class CompilerSelfWriterTest(TestCase):
default_collector
.
clear
()
default_collector
.
clear
()
@pipeline_settings
(
COMPILERS
=
[
'tests.tests.test_compiler.CompilerWithEmptyFirstArg'
])
class
CompilerWithEmptyFirstArgTest
(
TestCase
):
def
setUp
(
self
):
default_collector
.
collect
()
self
.
compiler
=
Compiler
()
def
test_compile
(
self
):
paths
=
self
.
compiler
.
compile
([
_
(
'pipeline/js/dummy.coffee'
)])
default_collector
.
collect
()
self
.
assertEqual
([
_
(
'pipeline/js/dummy.junk'
)],
list
(
paths
))
def
tearDown
(
self
):
default_collector
.
clear
()
@pipeline_settings
(
COMPILERS
=
[
'tests.tests.test_compiler.InvalidCompiler'
])
@pipeline_settings
(
COMPILERS
=
[
'tests.tests.test_compiler.InvalidCompiler'
])
class
InvalidCompilerTest
(
TestCase
):
class
InvalidCompilerTest
(
TestCase
):
def
setUp
(
self
):
def
setUp
(
self
):
...
@@ -158,7 +184,6 @@ class InvalidCompilerTest(TestCase):
...
@@ -158,7 +184,6 @@ class InvalidCompilerTest(TestCase):
def
test_compile
(
self
):
def
test_compile
(
self
):
with
self
.
assertRaises
(
CompilerError
)
as
cm
:
with
self
.
assertRaises
(
CompilerError
)
as
cm
:
self
.
compiler
.
compile
([
_
(
'pipeline/js/dummy.coffee'
)])
self
.
compiler
.
compile
([
_
(
'pipeline/js/dummy.coffee'
)])
e
=
cm
.
exception
e
=
cm
.
exception
self
.
assertEqual
(
self
.
assertEqual
(
e
.
command
,
e
.
command
,
...
...
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