Skip to content

Commit

Permalink
Fix cli tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rwenite committed Jun 3, 2017
1 parent 99b3342 commit 9ed68d2
Show file tree
Hide file tree
Showing 23 changed files with 495 additions and 477 deletions.
8 changes: 7 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,18 @@ Tests
*****

1. Ensure `unittest <https://docs.python.org/2.7/library/unittest.html>`_ is available
2. Run tests
2. Set your `CSE ID <https://support.google.com/customsearch/answer/2649143?hl=en>`_ and `Google API developer key <https://developers.google.com/api-client-library/python/auth/api-keys>`_
3. Run tests
4. Reset config file to defaults
5. Please note that this will use up 12 requests from your quota

::
pip install . -I
python -m search_google -s cx="your_cse_id"
python -m search_google -s build_developerKey="your_dev_key"
python -m unittest
python -m search_google -d

Documentation Maintenance
*************************
Expand Down
2 changes: 1 addition & 1 deletion docs/.buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 36b6a101fd29b483bc2d46b642123402
config: cc9fee0770fe7920a0cfbe61800b00f3
tags: 645f666f9bcd5a90fca523b33c5a78b7
Binary file modified docs/.doctrees/environment.pickle
Binary file not shown.
Binary file modified docs/.doctrees/index.doctree
Binary file not shown.
8 changes: 4 additions & 4 deletions docs/_modules/api.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>api &#8212; search_google 1.0.8 documentation</title>
<title>api &#8212; search_google 1.0.9 documentation</title>

<link rel="stylesheet" href="../_static/classic.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />

<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '1.0.8',
VERSION: '1.0.9',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true,
Expand All @@ -37,7 +37,7 @@ <h3>Navigation</h3>
<li class="right" >
<a href="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="nav-item nav-item-0"><a href="../index.html">search_google 1.0.8 documentation</a> &#187;</li>
<li class="nav-item nav-item-0"><a href="../index.html">search_google 1.0.9 documentation</a> &#187;</li>
<li class="nav-item nav-item-1"><a href="index.html" accesskey="U">Module code</a> &#187;</li>
</ul>
</div>
Expand Down Expand Up @@ -278,7 +278,7 @@ <h3>Navigation</h3>
<li class="right" >
<a href="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="nav-item nav-item-0"><a href="../index.html">search_google 1.0.8 documentation</a> &#187;</li>
<li class="nav-item nav-item-0"><a href="../index.html">search_google 1.0.9 documentation</a> &#187;</li>
<li class="nav-item nav-item-1"><a href="index.html" >Module code</a> &#187;</li>
</ul>
</div>
Expand Down
289 changes: 151 additions & 138 deletions docs/_modules/cli.html

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions docs/_modules/cse.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>cse &#8212; search_google 1.0.8 documentation</title>
<title>cse &#8212; search_google 1.0.9 documentation</title>

<link rel="stylesheet" href="../_static/classic.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />

<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '1.0.8',
VERSION: '1.0.9',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true,
Expand All @@ -37,7 +37,7 @@ <h3>Navigation</h3>
<li class="right" >
<a href="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="nav-item nav-item-0"><a href="../index.html">search_google 1.0.8 documentation</a> &#187;</li>
<li class="nav-item nav-item-0"><a href="../index.html">search_google 1.0.9 documentation</a> &#187;</li>
<li class="nav-item nav-item-1"><a href="index.html" accesskey="U">Module code</a> &#187;</li>
</ul>
</div>
Expand Down Expand Up @@ -278,7 +278,7 @@ <h3>Navigation</h3>
<li class="right" >
<a href="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="nav-item nav-item-0"><a href="../index.html">search_google 1.0.8 documentation</a> &#187;</li>
<li class="nav-item nav-item-0"><a href="../index.html">search_google 1.0.9 documentation</a> &#187;</li>
<li class="nav-item nav-item-1"><a href="index.html" >Module code</a> &#187;</li>
</ul>
</div>
Expand Down
8 changes: 4 additions & 4 deletions docs/_modules/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Overview: module code &#8212; search_google 1.0.8 documentation</title>
<title>Overview: module code &#8212; search_google 1.0.9 documentation</title>

<link rel="stylesheet" href="../_static/classic.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />

<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '1.0.8',
VERSION: '1.0.9',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true,
Expand All @@ -37,7 +37,7 @@ <h3>Navigation</h3>
<li class="right" >
<a href="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="nav-item nav-item-0"><a href="../index.html">search_google 1.0.8 documentation</a> &#187;</li>
<li class="nav-item nav-item-0"><a href="../index.html">search_google 1.0.9 documentation</a> &#187;</li>
</ul>
</div>

Expand Down Expand Up @@ -80,7 +80,7 @@ <h3>Navigation</h3>
<li class="right" >
<a href="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="nav-item nav-item-0"><a href="../index.html">search_google 1.0.8 documentation</a> &#187;</li>
<li class="nav-item nav-item-0"><a href="../index.html">search_google 1.0.9 documentation</a> &#187;</li>
</ul>
</div>
<div class="footer" role="contentinfo">
Expand Down
2 changes: 1 addition & 1 deletion docs/_sources/index.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -223,5 +223,5 @@ api
cli
***

.. autofunction:: cli.main
.. autofunction:: cli.run

21 changes: 8 additions & 13 deletions docs/genindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Index &#8212; search_google 1.0.8 documentation</title>
<title>Index &#8212; search_google 1.0.9 documentation</title>

<link rel="stylesheet" href="_static/classic.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />

<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '1.0.8',
VERSION: '1.0.9',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true,
Expand All @@ -38,7 +38,7 @@ <h3>Navigation</h3>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">search_google 1.0.8 documentation</a> &#187;</li>
<li class="nav-item nav-item-0"><a href="index.html">search_google 1.0.9 documentation</a> &#187;</li>
</ul>
</div>

Expand All @@ -55,7 +55,6 @@ <h1 id="index">Index</h1>
| <a href="#D"><strong>D</strong></a>
| <a href="#G"><strong>G</strong></a>
| <a href="#L"><strong>L</strong></a>
| <a href="#M"><strong>M</strong></a>
| <a href="#P"><strong>P</strong></a>
| <a href="#R"><strong>R</strong></a>
| <a href="#S"><strong>S</strong></a>
Expand Down Expand Up @@ -93,14 +92,6 @@ <h2 id="L">L</h2>
</ul></td>
</tr></table>

<h2 id="M">M</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#cli.main">main() (in module cli)</a>
</li>
</ul></td>
</tr></table>

<h2 id="P">P</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
Expand All @@ -113,6 +104,10 @@ <h2 id="R">R</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#api.results">results (class in api)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#cli.run">run() (in module cli)</a>
</li>
</ul></td>
</tr></table>
Expand Down Expand Up @@ -162,7 +157,7 @@ <h3>Navigation</h3>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">search_google 1.0.8 documentation</a> &#187;</li>
<li class="nav-item nav-item-0"><a href="index.html">search_google 1.0.9 documentation</a> &#187;</li>
</ul>
</div>
<div class="footer" role="contentinfo">
Expand Down
48 changes: 30 additions & 18 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>search_google &#8212; search_google 1.0.8 documentation</title>
<title>search_google &#8212; search_google 1.0.9 documentation</title>

<link rel="stylesheet" href="_static/classic.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />

<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '1.0.8',
VERSION: '1.0.9',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true,
Expand All @@ -37,7 +37,7 @@ <h3>Navigation</h3>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="nav-item nav-item-0"><a href="#">search_google 1.0.8 documentation</a> &#187;</li>
<li class="nav-item nav-item-0"><a href="#">search_google 1.0.9 documentation</a> &#187;</li>
</ul>
</div>

Expand Down Expand Up @@ -424,8 +424,8 @@ <h2>Modules<a class="headerlink" href="#modules" title="Permalink to this headli
<div class="section" id="cli">
<h3>cli<a class="headerlink" href="#cli" title="Permalink to this headline"></a></h3>
<dl class="function">
<dt id="cli.main">
<code class="descclassname">cli.</code><code class="descname">main</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/cli.html#main"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#cli.main" title="Permalink to this definition"></a></dt>
<dt id="cli.run">
<code class="descclassname">cli.</code><code class="descname">run</code><span class="sig-paren">(</span><em>argv=['C:\\Tools\\Anaconda3\\Scripts\\sphinx-build-script.py', '-b', 'html', 'docs/source', 'docs']</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cli.html#run"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#cli.run" title="Permalink to this definition"></a></dt>
<dd><p>Runs the search_google command line tool.</p>
<p>This function runs the search_google command line tool
in a terminal. It was intended for use inside a py file
Expand All @@ -438,26 +438,38 @@ <h3>cli<a class="headerlink" href="#cli" title="Permalink to this headline">¶</
</ul>
<p>For distribution, this function must be defined in the following files:</p>
<div class="last highlight-default"><div class="highlight"><pre><span></span><span class="c1"># In &#39;search_google/search_google/__main__.py&#39;</span>
<span class="kn">from</span> <span class="nn">.cli</span> <span class="k">import</span> <span class="n">main</span>
<span class="n">main</span><span class="p">()</span>
<span class="kn">from</span> <span class="nn">.cli</span> <span class="k">import</span> <span class="n">run</span>
<span class="n">run</span><span class="p">()</span>

<span class="c1"># In &#39;search_google/search_google.py&#39;</span>
<span class="kn">from</span> <span class="nn">search_google.cli</span> <span class="k">import</span> <span class="n">main</span>
<span class="kn">from</span> <span class="nn">search_google.cli</span> <span class="k">import</span> <span class="n">run</span>
<span class="k">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s1">&#39;__main__&#39;</span><span class="p">:</span>
<span class="n">main</span><span class="p">()</span>
<span class="n">run</span><span class="p">()</span>

<span class="c1"># In &#39;search_google/setup.py&#39;</span>
<span class="n">setup</span><span class="p">(</span>
<span class="o">...</span>
<span class="n">entry_points</span><span class="o">=</span><span class="p">{</span>
<span class="s1">&#39;console_scripts&#39;</span> <span class="p">:</span> <span class="p">[</span><span class="s1">&#39;search_google=search_google.cli:main&#39;</span><span class="p">]</span>
<span class="p">}</span>
<span class="o">...</span>
<span class="p">)</span>
<span class="c1"># In &#39;search_google/__init__.py&#39;</span>
<span class="n">__entry_points__</span> <span class="o">=</span> <span class="p">{</span><span class="s1">&#39;console_scripts&#39;</span><span class="p">:</span> <span class="p">[</span><span class="s1">&#39;search_google=search_google.cli:run&#39;</span><span class="p">]}</span>
</pre></div>
</div>
</dd>
</dl>
<p>Examples:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="c1"># Import google_streetview for the cli module</span>
<span class="kn">import</span> <span class="nn">search_google.cli</span>

<span class="c1"># Create command line arguments</span>
<span class="n">argv</span> <span class="o">=</span> <span class="p">[</span>
<span class="s1">&#39;cli.py&#39;</span><span class="p">,</span>
<span class="s1">&#39;google&#39;</span><span class="p">,</span>
<span class="s1">&#39;--searchType=image&#39;</span><span class="p">,</span>
<span class="s1">&#39;--build_developerKey=your_dev_key&#39;</span><span class="p">,</span>
<span class="s1">&#39;--cx=your_cx_id&#39;</span>
<span class="s1">&#39;--num=1&#39;</span>
<span class="p">]</span>

<span class="c1"># Run command line</span>
<span class="n">search_google</span><span class="o">.</span><span class="n">cli</span><span class="o">.</span><span class="n">run</span><span class="p">(</span><span class="n">argv</span><span class="p">)</span>
</pre></div>
</div>
</dd></dl>

</div>
Expand Down Expand Up @@ -526,7 +538,7 @@ <h3>Navigation</h3>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="nav-item nav-item-0"><a href="#">search_google 1.0.8 documentation</a> &#187;</li>
<li class="nav-item nav-item-0"><a href="#">search_google 1.0.9 documentation</a> &#187;</li>
</ul>
</div>
<div class="footer" role="contentinfo">
Expand Down
6 changes: 3 additions & 3 deletions docs/objects.inv
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Sphinx inventory version 2
# Project: search_google
# Version: 1.0.8
# Version: 1.0.9
# The remainder of this file is compressed using zlib.
xڕ��j�0 ��y
�vMX�}��=@Pl�Ul�i��mb�uk �M������!��C�Yހ��c�� /%�_��0r3Rʢi��`J����P�/m+���4����[���P2=m|ף��]VZ��H�������Ÿ�hQqM2�̀�g�+{��=��/ $�[���\Ӆ��y�~0� ��p4}�BpB��at�S}]����^~%+�g���Qu�i��
xڕ�M��0 F�9�`�M�n{�.
=@Pm�1Ul�i{�&1�B����@�,���:1�/X��T5��O���[uKi�#,�����أ�ٺ�$�$���!�{�D�z��. ��������=}w�d j��Rr#�ON���2�����%\Ӊ��8wL{5BD$�TS�S1��?��\^Y��/��só�� o���Ё
Expand Down
8 changes: 4 additions & 4 deletions docs/py-modindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Python Module Index &#8212; search_google 1.0.8 documentation</title>
<title>Python Module Index &#8212; search_google 1.0.9 documentation</title>

<link rel="stylesheet" href="_static/classic.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />

<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '1.0.8',
VERSION: '1.0.9',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true,
Expand Down Expand Up @@ -44,7 +44,7 @@ <h3>Navigation</h3>
<li class="right" >
<a href="#" title="Python Module Index"
>modules</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">search_google 1.0.8 documentation</a> &#187;</li>
<li class="nav-item nav-item-0"><a href="index.html">search_google 1.0.9 documentation</a> &#187;</li>
</ul>
</div>

Expand Down Expand Up @@ -100,7 +100,7 @@ <h3>Navigation</h3>
<li class="right" >
<a href="#" title="Python Module Index"
>modules</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">search_google 1.0.8 documentation</a> &#187;</li>
<li class="nav-item nav-item-0"><a href="index.html">search_google 1.0.9 documentation</a> &#187;</li>
</ul>
</div>
<div class="footer" role="contentinfo">
Expand Down
8 changes: 4 additions & 4 deletions docs/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Search &#8212; search_google 1.0.8 documentation</title>
<title>Search &#8212; search_google 1.0.9 documentation</title>

<link rel="stylesheet" href="_static/classic.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />

<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '1.0.8',
VERSION: '1.0.9',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true,
Expand Down Expand Up @@ -45,7 +45,7 @@ <h3>Navigation</h3>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">search_google 1.0.8 documentation</a> &#187;</li>
<li class="nav-item nav-item-0"><a href="index.html">search_google 1.0.9 documentation</a> &#187;</li>
</ul>
</div>

Expand Down Expand Up @@ -96,7 +96,7 @@ <h3>Navigation</h3>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">search_google 1.0.8 documentation</a> &#187;</li>
<li class="nav-item nav-item-0"><a href="index.html">search_google 1.0.9 documentation</a> &#187;</li>
</ul>
</div>
<div class="footer" role="contentinfo">
Expand Down
Loading

0 comments on commit 9ed68d2

Please sign in to comment.