Skip to content

Instantly share code, notes, and snippets.

@rudylattae
Created January 27, 2011 06:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rudylattae/798158 to your computer and use it in GitHub Desktop.
Save rudylattae/798158 to your computer and use it in GitHub Desktop.
Setup dev environment for peon -- Windows

Setup dev environment for peon -- Windows

I'm trying to hack on Peon, so far I've not been able to successfuly run the tests.

Here are the steps I took to setup my dev environment to start hacking on peon. Just in case someone else needs them.

Note

These steps were attempted on my Windows 7 (x64) machine. YMMV.

These steps assume that you are on a windows dev machine and that you have cloned the peon repo and that you are in the repo working directory. e.g:

C:\Users\Me\Projects\peon

Idealy

FYI: If the specloud dependencies were easier to install on Windows, the setup would be simpler. i.e. ideally the project would have a requirements file (dev-requirements.txt) like:

Contents of dev-requirements.txt:

# for running the BDD style specs
# this would install nose, figleaf and pinocchio
specloud 

# for rspec "should" style BDD assertions
should-dsl

# for isolating file io in tests
ScriptTest

I would then install all the dependencies for development like so:

> pip install -E \path\to\my\peon\venv -r dev-requirements.txt

Then I would install peon in development mode:

> python setup.py develop

And finally, I would run the specs/tests from the project root like so:

> specloud
...
----------------------------------------------------------------------
Ran X tests in 0.220s

Sweet! :)

The real world

Alas, this is not a perfect world. I've not been able to successfully install and run the pinocchio plugin for nose on Windows. So I used a workaround to get up an running. Note that these steps only got me as far as seeing two failing tests. Here are my setup steps:

  1. Create and activate a virtualenv for peon:

    > virtualenv \path\to\my\peon\venv --no-site-packages 
    > peon\venv\Scripts\activate

Now the rest of these steps take place in the peon virtualenv

  1. Install peon in development mode:

    > python setup.py develop

3. Create spec-runner command/batch file in project root to implement a stripped down version of specloud:

Contents of spec-runner.cmd:

nosetests -i "^(it|ensure|must|should|specs?|examples?|deve)" -i "(specs?(.py)?|examples?(.py)?)$"

Extra, extra

I noticed that the tests/base.py module, attempts to add the peon directory to the python path (so that it can be imported). Instead of doing this:

package_dir = os.path.dirname(here)
peon_src_dir = os.path.join(package_dir, 'peon')

It should rather be this:

package_dir = os.path.dirname(here)
peon_src_dir = os.path.join(package_dir, '..', 'peon') # go up on step!

In any case this does not matter if peon has been installed in development mode.

# for running the BDD style specs
# this would install nose, figleaf and pinocchio
specloud
# for rspec "should" style BDD assertions
should-dsl
# for isolating file io in tests
ScriptTest
@echo off
:: this is a simple "stand-in" for specloud -- minus the '--with-spec' and '--spec-color' options
nosetests -i "^(it|ensure|must|should|specs?|examples?|deve)" -i "(specs?(.py)?|examples?(.py)?)$"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment