A Python wrapper for envjasmine
Project description
This is a thin python wrapper around the envjasmine JavaScript testing framework.
Installation
You can install pyenvjasmine using pip or easy_install:
pip install pyenvjasmine
easy_install pyenvjasmine
Or you can grab the latest sources and install it from there:
python setup.py install
Also, you can use it directly from the sources directory, in development mode (useful if you want to contribute to the project):
python setup.py develop
Running pyenvjasmine tests
To run the tests on this code here (as opposed to your JavaScript code you want to test), install pyenvjasmine and then run:
nosetests --cover-package=pyenvjasmine --cover-erase \ --with-coverage --with-doctest $*
Run your own tests
The easiest way is to put your “specs” (JavaScript tests) into some directory in your code, then in your python tests, add a new TestCase with just one test that runs all your JavaScript tests.
The simplest solution is to set capture_output to False, so you see the output from the js tests on the console. Something like this:
import unittest
from pyenvjasmine.runner import TestRunner
class JavaScriptTests(unittest.TestCase):
def test_my_javascript(self):
runner = TestRunner(
testdir='/path/to/my/testdir',
configfile='relative/path/to/configfile')
runner.run(capture_output=False)
If you want a more integrated test control, you could set capture_output to True, then parse the test output that is returned from the run() method, with something like this:
import unittest
from pyenvjasmine.runner import TestRunner
class JavaScriptTests(unittest.TestCase):
def test_my_javascript_no_output(self):
runner = TestRunner(
testdir='/path/to/my/testdir',
configfile='relative/path/to/configfile')
res = runner.run(capture_output=True)
lines = res.splitlines()
self.assertTrue('Failed: 0' in lines)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file pyenvjasmine-0.1.2.tar.gz.
File metadata
- Download URL: pyenvjasmine-0.1.2.tar.gz
- Upload date:
- Size: 1.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e4943b8e8e79f81a2d12b8b5e6690abddc895a3286c1225c3393ae651618f386
|
|
| MD5 |
957f946c58a52cfbc26cb15cc6241c3e
|
|
| BLAKE2b-256 |
3be9ef9dcb2170a32f002163bca7dd4a5c6eb2d7153af42510fc21c04a33b1a1
|