Skip to content
Browse files

Moved tests to own package

This stops them being packaged up for PyPI where they are not needed.
Hence django-adaptors is smaller and quicker to install.

I removed some more unnecessary files.
  • Loading branch information...
1 parent e1fa614 commit 45987149c298ff28f64d89a133084283f29ee5d8 @codeinthehole codeinthehole committed Jun 27, 2012
View
1 .gitignore
@@ -1,2 +1,3 @@
*.pyc
.idea/*
+dist
View
16 myTestModel/tests.py
@@ -1,16 +0,0 @@
-"""
-This file demonstrates writing tests using the unittest module. These will pass
-when you run "manage.py test".
-
-Replace this with more appropriate tests for your application.
-"""
-
-from django.test import TestCase
-
-
-class SimpleTest(TestCase):
- def test_basic_addition(self):
- """
- Tests that 1 + 1 always equals 2.
- """
- self.assertEqual(1 + 1, 2)
View
1 myTestModel/views.py
@@ -1 +0,0 @@
-# Create your views here.
View
12 runtests.py
@@ -12,21 +12,23 @@
}
},
INSTALLED_APPS=[
- 'myTestModel',
+ 'tests.test_app',
],
)
from django_nose import NoseTestSuiteRunner
-def run_tests(*test_args):
+def run_tests(nose_options, test_args):
if not test_args:
- test_args = ['adaptor']
- test_runner = NoseTestSuiteRunner(verbosity=1)
+ test_args = ['tests']
+ test_runner = NoseTestSuiteRunner(verbosity=nose_options.verbosity)
failures = test_runner.run_tests(test_args)
sys.exit(failures)
if __name__ == '__main__':
parser = OptionParser()
+ parser.add_option('-v', '--verbose', dest='verbosity', default=1, type=int)
(options, args) = parser.parse_args()
- run_tests(*args)
+
+ run_tests(options, args)
View
0 myTestModel/__init__.py → tests/__init__.py
File renamed without changes.
View
0 test/csv1.csv → tests/fixtures/csv1.csv
File renamed without changes.
View
0 test/csv2.csv → tests/fixtures/csv2.csv
File renamed without changes.
View
0 test/csv3.csv → tests/fixtures/csv3.csv
File renamed without changes.
View
0 test/csv4-error.csv → tests/fixtures/csv4-error.csv
File renamed without changes.
View
15 adaptor/tests.py → tests/main_tests.py
@@ -1,10 +1,10 @@
from datetime import datetime
from django.test import TestCase
-from fields import *
-from model import CsvModel, CsvDbModel, ImproperlyConfigured,\
+from adaptor.fields import *
+from adaptor.model import CsvModel, CsvDbModel, ImproperlyConfigured,\
CsvException, CsvDataException, TabularLayout, SkipRow,\
GroupedCsvModel, XMLModel,CsvFieldDataException
-from myTestModel.models import *
+from tests.test_app.models import *
class TestCsvModel(CsvModel):
@@ -138,15 +138,15 @@ def test_default_value(self):
test = TestCsvModel.import_data(data=TestCsvModel.test_data_missing)
def test_real_file(self):
- file = open("test/csv1.csv")
+ file = open("tests/fixtures/csv1.csv")
test = TestCsvModel.import_from_file(file)
line1 = test[0]
self.assertEquals(line1.nom, 'Roger')
self.assertEquals(line1.age, 10)
self.assertEquals(line1.taille, 1.8)
def test_db_model(self):
- test = TestCsvDBModel.import_from_filename("test/csv2.csv")
+ test = TestCsvDBModel.import_from_filename("tests/fixtures/csv2.csv")
self.assertEquals(MyModel.objects.all().count(), 2)
@@ -177,7 +177,7 @@ class Meta:
dbModel = MyModel
- test = TestCsvDBUnmatchingModel.import_from_filename("test/csv1.csv")
+ test = TestCsvDBUnmatchingModel.import_from_filename("tests/fixtures/csv1.csv")
self.assertEquals(MyModel.objects.all().count(), 1)
obj = test[0].get_object()
@@ -257,7 +257,7 @@ class TestCsvWithHeader(TestCsvModel):
class Meta:
dbModel = MyModel
- test = TestCsvWithHeader.import_from_filename("test/csv3.csv")
+ test = TestCsvWithHeader.import_from_filename("tests/fixtures/csv3.csv")
self.assertEquals(MyModel.objects.all().count(), 23)
def test_error_message_foreign(self):
@@ -524,6 +524,7 @@ class Meta:
MyModel.objects.create(nom="name",age=12, taille=1.2)
self.assertRaises(CsvFieldDataException, TestMatchCsv.import_data, ["name"])
+
class TestGroupCsv(TestCase):
def test_simple_group(self):
class TestCsv1(CsvModel):
View
0 tests/test_app/__init__.py
No changes.
View
0 myTestModel/models.py → tests/test_app/models.py
File renamed without changes.

0 comments on commit 4598714

Please sign in to comment.
Something went wrong with that request. Please try again.