Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Add test command to setup.py

Marek Brzóska17486a2a8677
diff --git a/README.md b/README.md
index 93f64d898c..c0dbc89204 100644
--- a/README.md
+++ b/README.md
@@ -9,6 +9,7 @@ Usage
1. Fork the repo on github (optionally)
1. Checkout/download
+1. If you like you can run tests - ``python setup.py test``
1. run ``python setup.py develop`` if you are going to develop or ``python setup.py install`` if you just want to install and run saleor
1. run ``saleor syncdb --migrate``
1. run ``saleor runserver`` for development server (on localhost:8000)
diff --git a/product/__init__.py b/product/__init__.py
old mode 100755
new mode 100644
diff --git a/product/migrations/0001_initial.py b/product/migrations/0001_initial.py
index 2820c513c4..2cf9363234 100644
--- a/product/migrations/0001_initial.py
+++ b/product/migrations/0001_initial.py
@@ -1,11 +1,9 @@
# -*- coding: utf-8 -*-
-import datetime
from south.db import db
from south.v2 import SchemaMigration
-from django.db import models
-class Migration(SchemaMigration):
+class Migration(SchemaMigration): # pragma: no cover
def forwards(self, orm):
# Adding model 'Category'
@@ -32,7 +30,6 @@ class Migration(SchemaMigration):
))
db.send_create_signal(u'product', ['Product'])
-
def backwards(self, orm):
# Deleting model 'Category'
db.delete_table(u'product_category')
@@ -40,7 +37,6 @@ class Migration(SchemaMigration):
# Deleting model 'Product'
db.delete_table(u'product_product')
-
models = {
u'product.category': {
'Meta': {'object_name': 'Category'},
diff --git a/product/models.py b/product/models.py
old mode 100755
new mode 100644
diff --git a/product/tests.py b/product/tests.py
old mode 100755
new mode 100644
diff --git a/product/views.py b/product/views.py
old mode 100755
new mode 100644
diff --git a/setup.cfg b/setup.cfg
new file mode 100644
index 0000000000..20bc29c9d8
--- /dev/null
+++ b/setup.cfg
@@ -0,0 +1,7 @@
+[nosetests]
+verbosity=2
+with-coverage=1
+with-doctest=1
+cover-branches=1
+cover-erase=1
+cover-package=saleor, product
diff --git a/setup.py b/setup.py
index 6bfd48cb43..b57ca08be0 100755
--- a/setup.py
+++ b/setup.py
@@ -1,5 +1,16 @@
#! /usr/bin/env python
from setuptools import setup, find_packages, Command
+from setuptools.command.test import test
+import os
+
+
+os.environ['DJANGO_SETTINGS_MODULE'] = 'saleor.settings'
+
+
+class Test(test):
+ def run(self):
+ os.environ['DJANGO_SETTINGS_MODULE'] = 'saleor.settings'
+ return test.run(self)
class Command(Command):
@@ -42,5 +53,12 @@ setup(name='saleor',
'saleor = saleor:manage'
]
},
- cmdclass={'lint': Lint},
- )
+ cmdclass={
+ 'lint': Lint,
+ 'test': Test
+ },
+ tests_require=[
+ 'coverage==3.6',
+ 'mock==1.0.1',
+ 'nose==1.2.1'],
+ test_suite='nose.collector')