Skip to content

Commit

Permalink
Todo
Browse files Browse the repository at this point in the history
  • Loading branch information
jacquev6 committed Jun 13, 2017
1 parent c26e285 commit 4fbdfd6
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 11 deletions.
1 change: 0 additions & 1 deletion ActionTree/__init__.py
Expand Up @@ -469,7 +469,6 @@ def compute(action, ordinate):
last_ordinate = compute(report._root_action, len(self.__actions) - 1)
assert last_ordinate == 0, last_ordinate

# @todo Factorize Actions
class SuccessfulAction(object):
def __init__(self, action, status):
self.__label = str(action.label)
Expand Down
16 changes: 11 additions & 5 deletions ActionTree/stock.py
Expand Up @@ -31,17 +31,17 @@ def do_execute(self):
pass


class CalledProcessError(Exception):
pass


class CallSubprocess(Action):
"""
A stock action that calls a subprocess.
Arguments are forwarded exactly to :func:`subprocess.check_call`.
@todo Document behavior in case of CalledProcessError and its rationale
Note: if the process fails,
:func:`~subprocess.check_call` raises a :exc:`subprocess.CalledProcessError`,
which `cannot be pickled <http://bugs.python.org/issue1692335>`__ in Python 2.
So, in that case, this action catches the original exception and
raises a :exc:`CalledProcessError`.
"""
def __init__(self, args, **kwds):
Action.__init__(self, " ".join(args))
Expand All @@ -57,6 +57,12 @@ def do_execute(self):
raise CalledProcessError(e.returncode, e.cmd, e.output)


class CalledProcessError(Exception):
"""
Raised by :class:`CallSubprocess`
"""


class CreateDirectory(Action):
"""
A stock action that creates a directory.
Expand Down
1 change: 0 additions & 1 deletion ActionTree/tests/gantt_chart.py
Expand Up @@ -33,4 +33,3 @@ def test(self):
chart = GanttChart(execute(c, jobs=2))
ax = unittest.mock.Mock()
chart.plot_on_mpl_axes(ax)
# @todo Assert something about calls to ax
6 changes: 4 additions & 2 deletions docs/genindex.html
Expand Up @@ -97,14 +97,16 @@ <h2 id="A">A</h2>
<h2 id="C">C</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="reference.html#ActionTree.stock.CalledProcessError">CalledProcessError</a>
</li>
<li><a href="reference.html#ActionTree.stock.CallSubprocess">CallSubprocess (class in ActionTree.stock)</a>
</li>
<li><a href="reference.html#ActionTree.ExecutionReport.ActionStatus.cancel_time">cancel_time (ActionTree.ExecutionReport.ActionStatus attribute)</a>
</li>
<li><a href="reference.html#ActionTree.ExecutionReport.ActionStatus.CANCELED">CANCELED (ActionTree.ExecutionReport.ActionStatus attribute)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="reference.html#ActionTree.ExecutionReport.ActionStatus.CANCELED">CANCELED (ActionTree.ExecutionReport.ActionStatus attribute)</a>
</li>
<li><a href="reference.html#ActionTree.CompoundException">CompoundException</a>
</li>
<li><a href="reference.html#ActionTree.stock.CopyFile">CopyFile (class in ActionTree.stock)</a>
Expand Down
Binary file modified docs/objects.inv
Binary file not shown.
12 changes: 11 additions & 1 deletion docs/reference.html
Expand Up @@ -559,7 +559,17 @@ <h1>Reference<a class="headerlink" href="#reference" title="Permalink to this he
<em class="property">class </em><code class="descclassname">ActionTree.stock.</code><code class="descname">CallSubprocess</code><span class="sig-paren">(</span><em>args</em>, <em>**kwds</em><span class="sig-paren">)</span><a class="headerlink" href="#ActionTree.stock.CallSubprocess" title="Permalink to this definition"></a></dt>
<dd><p>A stock action that calls a subprocess.</p>
<p>Arguments are forwarded exactly to <a class="reference external" href="https://docs.python.org/2/library/subprocess.html#subprocess.check_call" title="(in Python v2.7)"><code class="xref py py-func docutils literal"><span class="pre">subprocess.check_call()</span></code></a>.</p>
<p>&#64;todo Document behavior in case of CalledProcessError and its rationale</p>
<p>Note: if the process fails,
<a class="reference external" href="https://docs.python.org/2/library/subprocess.html#subprocess.check_call" title="(in Python v2.7)"><code class="xref py py-func docutils literal"><span class="pre">check_call()</span></code></a> raises a <a class="reference external" href="https://docs.python.org/2/library/subprocess.html#subprocess.CalledProcessError" title="(in Python v2.7)"><code class="xref py py-exc docutils literal"><span class="pre">subprocess.CalledProcessError</span></code></a>,
which <a class="reference external" href="http://bugs.python.org/issue1692335">cannot be pickled</a> in Python 2.
So, in that case, this action catches the original exception and
raises a <a class="reference internal" href="#ActionTree.stock.CalledProcessError" title="ActionTree.stock.CalledProcessError"><code class="xref py py-exc docutils literal"><span class="pre">CalledProcessError</span></code></a>.</p>
</dd></dl>

<dl class="exception">
<dt id="ActionTree.stock.CalledProcessError">
<em class="property">exception </em><code class="descclassname">ActionTree.stock.</code><code class="descname">CalledProcessError</code><a class="headerlink" href="#ActionTree.stock.CalledProcessError" title="Permalink to this definition"></a></dt>
<dd><p>Raised by <a class="reference internal" href="#ActionTree.stock.CallSubprocess" title="ActionTree.stock.CallSubprocess"><code class="xref py py-class docutils literal"><span class="pre">CallSubprocess</span></code></a></p>
</dd></dl>

<dl class="class">
Expand Down
2 changes: 1 addition & 1 deletion docs/searchindex.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4fbdfd6

Please sign in to comment.