This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

Jasmine integration for unittest

This package allows you to run Jasmine unit tests fully integrated with the Python standard module unittest.

The main use case is to run JavaScript tests for Python server APIs.

Quick start

To use this module, please follow these steps:

  1. Add unittest-jasmine to the tests_require parameter to setuptools.setup().
  2. Change or add the test_loader argument to setuptools.setup() to 'unittest_jasmine.SetuptoolsLoader'.
  3. Add your Jasmine specs to your test package, and make sure the file names end with spec.js.

If your project uses npm to manage dependencies, those will be automatically updated when the tests are run using npm install.

Advanced options

Pass additional options to unittest-jasmine by modifying the test_suite parameter to setuptools.setup(); append the character '|' and then the options separated by ';':

setuptools.setup(
    . . .
    test_suite='tests|option1=value1;option2={"flag":true}',
    . . .
)

The value part of an option may be either JSON or a simple string. Anything that is not parsable as JSON is treated as a simple string. A simple string is treated as a JSON string.

The following options are recognised by unittest-jasmine:

lifecycle
A module receiving notifications about the lifecycle of suites and tests. See I need to run Python code before each test or suite for more information.
spec_regex
A regular expression used to find the spec files in the test directory.
test_directory
The directory that contains the spec files. This must be an absolute path.

Any option not in this list will be passed on to the Jasmine loadConfig method.

Common tasks

My Jasmine specs are not located in the same directory as my Python tests

Override the default path to the spec files by setting the option test_directory. This must be the absolute path to the directory containing the spec files.

My Jasmine spec files do not end with spec.js

Override the regular expression used to filter spec files from the test directory by setting the option spec_regex. This is used as a regular expression to filter the files to include.

An example value is:

setuptools.setup(
    . . .
    test_suite='tests|spec_regex=.*?-test\\.js',
    . . .
)

I need to run Python code before each test or suite

Set the option lifecycle to specify a module with functions handling the setup and teardown of tests and suites.

The functions suite_setup, suite_teardown, test_setup and test_teardown, if defined, will be called with the suite or test as parameter. The functions will be called as instance methods of the respective suites and tests.

You may copy templates for these functions from .../unittest_jasmine/_setuptools.py.

An example value is:

setuptools.setup(
    . . .
    test_suite='tests|lifecycle=test._jasmine_lifecycle',
    . . .
)

I need to load Jasmine helper files

Set the option helper to a JSON encoded list of strings. The strings are interpreted by Jasmine as paths to helper files, relative to the directory containing the spec files; they must not be absolute paths.

I have specs written in CoffeeScript

To enable running tests written in CoffeeScript, first modify the option spec_regex to ensure that it also includes .coffee files, and then make sure that one of your Jasmine helper files contains the expression require("coffee-script/register"). An example value is:

setuptools.setup(
    . . .
    test_suite='tests|spec_regex=.*?spec\\.(js|coffee);helpers=["cs.js"]',
    . . .
)

Release notes

v1.0.2 - pkg_resources fixes

  • Make sure to actually include the JavaScript runner in the package.
  • Use __name__ instead of __package__ when loading runner using pkg_resources to work on Python 3.

v1.0.1 - Python 3 fixes

  • Corrected dynamic method addition to work with Python 3.
  • Allow using release maker script on Python 3.
  • Build a universal wheel when making a release.

v1.0 - Initial Release

  • Initial release
Release History

Release History

1.0.2

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
unittest_jasmine-1.0.2-py2.py3-none-any.whl (21.2 kB) Copy SHA256 Checksum SHA256 3.5 Wheel May 30, 2016
unittest_jasmine-1.0.2-py3.5.egg (34.8 kB) Copy SHA256 Checksum SHA256 3.5 Egg May 30, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting