Add Nose Tests
This commit is contained in:
parent
c416be64bd
commit
bc3fefb45a
28
docs/dependencies.rst
Normal file
28
docs/dependencies.rst
Normal file
@ -0,0 +1,28 @@
|
||||
Dependencies
|
||||
============
|
||||
|
||||
|
||||
Python
|
||||
~~~~~~
|
||||
|
||||
|
||||
Model Mommy
|
||||
-----------
|
||||
|
||||
Install: http://model-mommy.readthedocs.io/en/latest/index.html
|
||||
|
||||
Model-mommy offers you a smart way to create fixtures for testing in Django. With a simple and powerful API you can create many objects with a single line of code.
|
||||
|
||||
Django Nose
|
||||
-----------
|
||||
|
||||
https://django-nose.readthedocs.io/en/latest/usage.html
|
||||
|
||||
django-nose provides all the goodness of nose in your Django tests.
|
||||
|
||||
Sniffer
|
||||
-------
|
||||
|
||||
https://github.com/jeffh/sniffer/
|
||||
|
||||
sniffer is a autotest tool for Python using the nosetest library.
|
@ -14,6 +14,7 @@ Contents:
|
||||
install
|
||||
deploy
|
||||
tests
|
||||
dependencies
|
||||
|
||||
|
||||
|
||||
|
@ -1,4 +1,22 @@
|
||||
Tests
|
||||
=====
|
||||
|
||||
This is where you write how to test this project.
|
||||
|
||||
Setup
|
||||
-----
|
||||
|
||||
First install the testing requirements with ``pip install -r requirements/testing.txt``
|
||||
|
||||
This will install the fake model factory generator, and test runners.
|
||||
|
||||
|
||||
Running
|
||||
-------
|
||||
|
||||
To run tests, simply use ``python manage.py test`` this will invoke Nose and pickup all the tests.
|
||||
|
||||
To start the auto testing, just run ``sniffer`` from the root project directory, this will watch all files in ``stagestatus/`` for changes, and if any ``.py`` files are changed it will re-run the tests.
|
||||
|
||||
You can pass ``-x appname`` to ``sniffer`` and it will run the appropriate tests for that app, but as of this writing, there is only one app.
|
||||
|
||||
|
||||
|
@ -2,3 +2,6 @@
|
||||
|
||||
mock
|
||||
model-mommy
|
||||
django-nose
|
||||
pyinotify
|
||||
sniffer
|
||||
|
28
scent.py
Normal file
28
scent.py
Normal file
@ -0,0 +1,28 @@
|
||||
from sniffer.api import * # import the really small API
|
||||
import os, termstyle
|
||||
|
||||
# you can customize the pass/fail colors like this
|
||||
pass_fg_color = termstyle.green
|
||||
pass_bg_color = termstyle.bg_default
|
||||
fail_fg_color = termstyle.red
|
||||
fail_bg_color = termstyle.bg_default
|
||||
|
||||
# All lists in this variable will be under surveillance for changes.
|
||||
watch_paths = ['stagestatus/',]
|
||||
|
||||
# this gets invoked on every file that gets changed in the directory. Return
|
||||
# True to invoke any runnable functions, False otherwise.
|
||||
#
|
||||
# This fires runnables only if files ending with .py extension and not prefixed
|
||||
# with a period.
|
||||
@file_validator
|
||||
def py_files(filename):
|
||||
return filename.endswith('.py') and not os.path.basename(filename).startswith('.')
|
||||
|
||||
@runnable
|
||||
def execute_nose(*args):
|
||||
from subprocess import call
|
||||
if len(args) > 1:
|
||||
return call('python manage.py test %s' % args[1], shell=True) == 0
|
||||
else:
|
||||
return call('python manage.py test', shell=True) == 0
|
@ -30,6 +30,7 @@ PROJECT_APPS = [
|
||||
'machines',
|
||||
]
|
||||
THIRD_PARTY_APPS = [
|
||||
'django_nose',
|
||||
'rest_framework',
|
||||
]
|
||||
INSTALLED_APPS += PROJECT_APPS
|
||||
@ -127,6 +128,7 @@ AUTH_PASSWORD_VALIDATORS = [
|
||||
},
|
||||
]
|
||||
|
||||
TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
|
||||
|
||||
try:
|
||||
from .local import * # noqa
|
||||
|
Loading…
Reference in New Issue
Block a user