incubator-libcloud mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jerry Chen <je...@apache.org>
Subject Re: [libcloud] Libcloud Docs
Date Thu, 08 Apr 2010 15:25:53 GMT
The documentation is indeed lacking in these basic instructions.

Has anyone taken a look at the demos/ directory? I tried to minimize the barrier to entry
by explicitly forcing the search path to include the parent directory. One should be able
to edit secrets.py and run ec2_demo.py.

As for the tests, my preferred method from start to finish is as follows:

1. Clone repo to libcloud (make sure this directory doesn't exist)
$ git clone git://git.apache.org/libcloud.git libcloud
Initialized empty Git repository in /home/jerry/libcloud/.git/
remote: Counting objects: 2719, done.
remote: Compressing objects: 100% (2662/2662), done.
Receiving objects: 100% (2662/2662), done.
Resolving deltas: 100% (11/11), done.

2. Enter test directory under repository root
$ cd libcloud/test

3. Copy sample secrets.py file
$ cp secrets.py-dist secrets.py

4. Edit secrets.py file to include necessary API keys and secrets
$ emacs secrets.py

5. Run test (here, assuming you edited EC2_ACCESS_ID and EC2_SECRET
$ PYTHONPATH=.. python test_ec2.py
............
----------------------------------------------------------------------
Ran 12 tests in 0.090s

OK

As mentioned by Marsh, the PYTHONPATH environment variable affects the search path for imports.
In this case, '..' (parent directory) from the test/ directory would point to repository root
and any attempts to import from libcloud will descend correctly.

These instructions, of course, assume two things:
- you're on a Unix derivative, including OS X
- when importing from libcloud, you want the code in the repository, rather than a system-wide
available install, for example.

Hope that helps.

Top Postingly Yours,
Jerry

On Apr 8, 2010, at 9:58 AM, Kyle Marsh wrote:

> Kyle,
> 
> I was having trouble running individual unit tests myself.  I'm not
> sure from your e-mail if you've figured it out yet, but I figured that
> this should probably show up on the list for now (and hopefully be
> included in a README or something in the future).
> 
> To run an individual unit test you need to set the PYTHONPATH
> environment variable to /home/me/libcloud (or wherever you unpackaged
> the libcloud source).  Thus the command you need to run looks (in
> linux) something like this:
> 
>    `/usr/bin/env PYTHONPATH=/home/me/libcloud/ python test/test_provider.py -v`
> 
> Hope this helps people getting started writing drivers for libcloud!
> 
> ~Kyle Marsh
> 
> 
> On Wed, Apr 7, 2010 at 21:34, Kyle Murphy <kylemurph@gmail.com> wrote:
>> Hello,
>> 
>> I was hoping to help with some docs for Libcloud, I wrote up an outline of
>> what I think would help the website, mostly it's suggesting what sections we
>> could include on the 'Getting Started' page, such as a 'Testing' section.
>> Also, some errors I found while just trying to figure this stuff out, I've
>> been having a lot of trouble running the UnitTests for each provider, and
>> some example code throws some errors for me.
>> 
>> The outline is about as non-technical as these things go, but I hope it
>> helps some!
>> 
>> Thanks,
>> Kyle Murphy
>> 


Mime
View raw message