Skip to main content

This is a thin python wrapper around the envjasmine JavaScript testing framework.

Installation

You can install pyenvjasmine using pip:

pip install pyenvjasmine

Or you can grab the latest sources using Mercurial from https://code.codigo23.net/hg/pyenvjasmine:

hg clone https://code.codigo23.net/hg/pyenvjasmine

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):

pip install -e .

Running pyenvjasmine tests

To run the tests on this code here (as opposed to your JavaScript code you want to test), install pyenvjasmine (and phantomjs) and then run:

py.test

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 pytest
from pyenvjasmine.runner import Runner

class TestJavaScript(object):
    def test_my_javascript(self):
        runner = Runner(
            testdir='/path/to/my/testdir',
            configfile='relative/path/to/configfile',
            testing_environment='phantomjs')
        success, stdout = runner.run()
        # assert on success, will be true if tests passed, False if any
        # test failed
        assert success, "One or more javascript tests have failed"
        # you can inspect stdout if you want to get more info, but it
        # will be printed to the console stdout anyway
        assert b'Total: 120' in stdout

In this example, the phantomjs browse/engine is used, replace that with rhino to run tests on rhino + jasmine 1.x.

Release files for pyenvjasmine 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyenvjasmine 0.3.1
File Size Uploaded
pyenvjasmine-0.3.1.tar.gz 2.3 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyenvjasmine 0.3.1
File Interpreter ABI Platform
pyenvjasmine-0.3.1-py3-none-any.whl Python 3 none any Details

Total release size: 4.7 MB

Release files / pyenvjasmine-0.3.1.tar.gz

Download URL pyenvjasmine-0.3.1.tar.gz
Size 2.3 MB
Tags Source
SHA-256 checksum
How to use checksums
f716488a27a77d53136fef21c2e7326c4903252ebe041b22931b164e186b2569
BLAKE2b-256 checksum
How to use checksums
d2430f1ec5a7d0173bf916163a0e98f6497e5b3fb18ec4dc0d3ffe98f5dae863
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.6.8

Release files / pyenvjasmine-0.3.1-py3-none-any.whl

Download URL pyenvjasmine-0.3.1-py3-none-any.whl
Size 2.4 MB
Tags Python 3
SHA-256 checksum
How to use checksums
11ca88a7a096f44d3d9b20359643314037bdb7b378e924a46b0942ca010f6d2c
BLAKE2b-256 checksum
How to use checksums
d91069653d3ca04775f9d8caf726a22f9581a82623c553013653773419088a79
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.6.8

Release history Release notifications | RSS feed

This release

0.3.1 This release

2 release files

0.3.0

1 release file

0.2.1

1 release file

0.2

1 release file

0.1.7

1 release file

0.1.6

1 release file

0.1.5

1 release file

0.1.4

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page