Code Monkey home page Code Monkey logo

bazinga's Introduction

Bazinga

Bazinga is a nose plugin that does dependency analysis to run incremental tests.

Motivation

Running the complete test suite on large projects can take a significantly large time. This can affect your work flow, specially if you are doing TDD. Some people choose to run only a subset of the tests, specifying them explicitly on the command line, but you can easily forget to run affected tests after any particular change and things can break unnoticed. Using "bazinga" you can rest assured that all (and only) the affected tests will be run. It was inspired by the continuous integration system that Google built: http://googletesting.blogspot.com/2011/06/testing-at-speed-and-scale-of-google.html.

How it works

Statically inspecting what is imported by each module, "bazinga" recursively detects what are the dependencies for each test. Only tests that failed, were modified, or had a file that they depend on changed, are run. Each time nose is run with bazinga, a md5 hash for each module that your project depends on will be stored on a file named .nosebazinga on the working directory. This file also contains a dependency graph that is used as cache. Bazinga will run all the tests that are needed if a third party package is updated, but the standard library is considered "stable" and is not checked for modifications.

Installation

pip install Bazinga

Usage

nosetests --with-bazinga

Debugging

nosetests --with-bazinga --debug=bazinga

Requirements

  • Nose
  • Snakefood

LICENSE

  • MIT License

bazinga's People

Contributors

jbochi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

bazinga's Issues

Detect changes using version control diffs for speedup

Right now it seems that the plugin walks all files to get modified filenames but this is slow for large projects. As an alternative (I don't know if this would fully work) it would be faster to just check the diff using whatever version control system was in use. It's pretty easy to detect the VC based on hidden dot files.

Here is an example of finding all modified files using git:

git diff --name-status | grep .py | awk '{ print $2 }'
git diff --cached --name-status | grep .py | awk '$1 != "D" { print $2 }'

This would ignore deleted files (although, hmm, maybe that should trigger tests)

empty .nosehashes file or not enough dependencies

If I run nosetests with an individual test file, bazinga seems to produce empty .nosehashes files, and will not do anything to prevent rerunning an unchanged test.

If I provide multiple files, the same thing happens.

When providing whole directories, I seem to get some entries into the .nosehashes files, but far fewer than I would expect, and far fewer than snakefood finds when running it individually.

So far, I couldn't get it to work, maybe a debug option would be nice, which allows to print information about the changed dependencies which caused a test to run.

bazinga does't appear to identify dependencies recursively ...

... when determining whether a test should be run or not.

For instance, in gitdb:

cd gitdb
nosetests-2.6 --with-bazinga test/

Runs all the tests as I would expect it.

The next time, it runs no test as I would expect it.

Now I change the file test/tes_util.py, and the tests will be rerun, as expected.

Changing a dependency of that file, util.py, will not trigger the test to be rerun though. It doesn't appear to pick up changes in files the test depends on.

See my .nosebazinga file for debugging: https://gist.github.com/1066688
I modified the file to hide portions of the paths, the actual path was absolute, not relative.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.