diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 0000000..611707a --- /dev/null +++ b/.coveragerc @@ -0,0 +1,11 @@ +[run] +source= + ./couchpotato/ +omit = + ./libs/* + ./node_modules/* +[report] +omit = + */python?.?/* + ./libs/* + ./node_modules/* diff --git a/.gitignore b/.gitignore index 666da1a..d53d129 100644 --- a/.gitignore +++ b/.gitignore @@ -4,5 +4,9 @@ /_source/ .project .pydevproject -node_modules -.tmp +/node_modules/ +/.tmp/ +/.sass-cache/ +.coverage +coverage.xml +nosetests.xml diff --git a/.nosetestsrc b/.nosetestsrc new file mode 100644 index 0000000..df77787 --- /dev/null +++ b/.nosetestsrc @@ -0,0 +1,2 @@ +[nosetests] +where=couchpotato diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..43f3b09 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,34 @@ +language: python +sudo: false +python: + # - "2.6" + - "2.7" + # - "3.2" + # - "3.3" + # - "3.4" + # - "3.5" + # - "3.5-dev" # 3.5 development branch + # - "nightly" # currently points to 3.6-dev + +cache: + pip: true + directories: + - node_modules + +# command to install dependencies +install: + - npm install + - pip install --upgrade pip + - pip install coverage + - pip install coveralls + # disabled, since we don't require colors for tests on travis + - pip install --upgrade nose + # - pip install rednose + +# command to run tests +script: + - grunt test + - grunt coverage + +after_success: + coveralls \ No newline at end of file diff --git a/Gruntfile.js b/Gruntfile.js index a571c1d..e0a7f54 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -9,6 +9,8 @@ module.exports = function(grunt){ // Configurable paths var config = { python: grunt.file.exists('./_env/bin/python') ? './_env/bin/python' : 'python', + // colorful output on travis is not required, so disable it there, using travic'es env var : + colorful_tests_output: ! process.env.TRAVIS, tmp: '.tmp', base: 'couchpotato', css_dest: 'couchpotato/static/style/combined.min.css', @@ -176,6 +178,49 @@ module.exports = function(grunt){ } }, + // TEST TASKS ============================================================== + env: { + options: { + }, + + test:{ + concat: { + PYTHONPATH: { + 'value' : './libs', + 'delimiter' : ':', + } + } + } + }, + + // for python tests + nose: { + options: { + verbosity: 2, + exe: true, + config: './.nosetestsrc', + // 'rednose' is a colored output for nose test-runner. But we do not requre colors on travis-ci + rednose: config.colorful_tests_output, + externalNose: true + }, + + test: { + }, + + coverage: { + options:{ + with_coverage: true, + cover_package: "couchpotato", + cover_branches: true, + cover_xml: true, + with_doctest: true, + with_xunit: true, + cover_tests: false, + cover_erase: true, + } + }, + }, + concurrent: { options: { logConcurrentOutput: true @@ -185,6 +230,12 @@ module.exports = function(grunt){ }); + // testing task + grunt.registerTask('test', ['env:test', 'nose:test']); + + // currently, coverage does not generate local html report, but it is useful and possible + grunt.registerTask('coverage', ['env:test', 'nose:coverage']); + grunt.registerTask('default', [ 'clean:server', 'sass:server', @@ -195,5 +246,4 @@ module.exports = function(grunt){ 'uglify:plugins', 'concurrent' ]); - }; diff --git a/README.md b/README.md index 44cf646..2e1299a 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ CouchPotato ===== [![Join the chat at https://gitter.im/RuudBurger/CouchPotatoServer](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/RuudBurger/CouchPotatoServer?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) +[![Build Status](https://travis-ci.org/maxkoryukov/CouchPotatoServer.svg?branch=feature%2Fci)](https://travis-ci.org/maxkoryukov/CouchPotatoServer) CouchPotato (CP) is an automatic NZB and torrent downloader. You can keep a "movies I want"-list and it will search for NZBs/torrents of these movies every X hours. Once a movie is found, it will send it to SABnzbd or download the torrent to a specified directory. diff --git a/do.tests.sh b/do.tests.sh deleted file mode 100755 index 5c8045f..0000000 --- a/do.tests.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -PYTHONPATH=./libs python -m unittest discover -v -s ./couchpotato/ diff --git a/package.json b/package.json index 1bd208c..45f1851 100644 --- a/package.json +++ b/package.json @@ -1,26 +1,30 @@ { - "name": "couchpotato_develop", - "repository": { - "type": "git", - "url": "" - }, - "scripts": { - "start": "grunt" - }, - "dependencies": {}, - "devDependencies": { - "grunt": "~0.4.5", - "grunt-autoprefixer": "^3.0.3", - "grunt-concurrent": "~2.1.0", - "grunt-contrib-clean": "^0.7.0", - "grunt-contrib-cssmin": "~0.14.0", - "grunt-contrib-jshint": "~0.11.2", - "grunt-contrib-sass": "^0.9.2", - "grunt-contrib-uglify": "~0.11.0", - "grunt-contrib-watch": "~0.6.1", - "grunt-shell-spawn": "^0.3.8", - "jit-grunt": "^0.9.1", - "jshint-stylish": "^2.0.1", - "time-grunt": "^1.2.1" - } + "name": "couchpotato_develop", + "repository": { + "type": "git", + "url": "" + }, + "scripts": { + "start": "grunt", + "test": "grunt test" + }, + "license": "GPL-3.0", + "dependencies": {}, + "devDependencies": { + "grunt": "~0.4.5", + "grunt-autoprefixer": "^3.0.3", + "grunt-concurrent": "~2.1.0", + "grunt-contrib-clean": "^0.7.0", + "grunt-contrib-cssmin": "~0.14.0", + "grunt-contrib-jshint": "~0.11.2", + "grunt-contrib-sass": "^0.9.2", + "grunt-contrib-uglify": "~0.11.0", + "grunt-contrib-watch": "~0.6.1", + "grunt-env": "^0.4.4", + "grunt-nose": "^1.0.0", + "grunt-shell-spawn": "^0.3.8", + "jit-grunt": "^0.9.1", + "jshint-stylish": "^2.0.1", + "time-grunt": "^1.2.1" + } }