From 8fb9790b29e2edcd069049dc1b3609ce25505601 Mon Sep 17 00:00:00 2001 From: pydanny Date: Mon, 14 Mar 2011 11:20:45 -0400 Subject: [PATCH] Merging in gisle's awesome work --- apps/grid/fixtures/test_initial_data.json | 5 +-- apps/homepage/fixtures/test_initial_data.json | 5 +-- apps/package/fixtures/test_initial_data.json | 5 +-- coverage/.gitignore | 3 ++ requirements/project.txt | 4 ++- settings.py | 31 ++++++++++++------- testrunner.py | 12 +++++++ 7 files changed, 41 insertions(+), 24 deletions(-) create mode 100644 coverage/.gitignore create mode 100644 testrunner.py diff --git a/apps/grid/fixtures/test_initial_data.json b/apps/grid/fixtures/test_initial_data.json index a48fe43..7fb2568 100644 --- a/apps/grid/fixtures/test_initial_data.json +++ b/apps/grid/fixtures/test_initial_data.json @@ -95,7 +95,6 @@ "participants" : "malcomt,jacobian", "pypi_downloads" : 0, "pypi_url" : "", - "pypi_version" : "", "related_packages" : [ ], "repo" : 1, "repo_commits" : 0, @@ -115,7 +114,6 @@ "participants" : "thetestman", "pypi_downloads" : 0, "pypi_url" : "", - "pypi_version" : "", "related_packages" : [ ], "repo" : 1, "repo_commits" : 0, @@ -135,7 +133,6 @@ "participants" : "pydanny", "pypi_downloads" : 0, "pypi_url" : "", - "pypi_version" : "", "related_packages" : [ ], "repo" : 1, "repo_commits" : 0, @@ -239,4 +236,4 @@ "active": true } } -] \ No newline at end of file +] diff --git a/apps/homepage/fixtures/test_initial_data.json b/apps/homepage/fixtures/test_initial_data.json index a48fe43..7fb2568 100644 --- a/apps/homepage/fixtures/test_initial_data.json +++ b/apps/homepage/fixtures/test_initial_data.json @@ -95,7 +95,6 @@ "participants" : "malcomt,jacobian", "pypi_downloads" : 0, "pypi_url" : "", - "pypi_version" : "", "related_packages" : [ ], "repo" : 1, "repo_commits" : 0, @@ -115,7 +114,6 @@ "participants" : "thetestman", "pypi_downloads" : 0, "pypi_url" : "", - "pypi_version" : "", "related_packages" : [ ], "repo" : 1, "repo_commits" : 0, @@ -135,7 +133,6 @@ "participants" : "pydanny", "pypi_downloads" : 0, "pypi_url" : "", - "pypi_version" : "", "related_packages" : [ ], "repo" : 1, "repo_commits" : 0, @@ -239,4 +236,4 @@ "active": true } } -] \ No newline at end of file +] diff --git a/apps/package/fixtures/test_initial_data.json b/apps/package/fixtures/test_initial_data.json index a48fe43..7fb2568 100644 --- a/apps/package/fixtures/test_initial_data.json +++ b/apps/package/fixtures/test_initial_data.json @@ -95,7 +95,6 @@ "participants" : "malcomt,jacobian", "pypi_downloads" : 0, "pypi_url" : "", - "pypi_version" : "", "related_packages" : [ ], "repo" : 1, "repo_commits" : 0, @@ -115,7 +114,6 @@ "participants" : "thetestman", "pypi_downloads" : 0, "pypi_url" : "", - "pypi_version" : "", "related_packages" : [ ], "repo" : 1, "repo_commits" : 0, @@ -135,7 +133,6 @@ "participants" : "pydanny", "pypi_downloads" : 0, "pypi_url" : "", - "pypi_version" : "", "related_packages" : [ ], "repo" : 1, "repo_commits" : 0, @@ -239,4 +236,4 @@ "active": true } } -] \ No newline at end of file +] diff --git a/coverage/.gitignore b/coverage/.gitignore new file mode 100644 index 0000000..1818c0c --- /dev/null +++ b/coverage/.gitignore @@ -0,0 +1,3 @@ +# +/*.html +/modules diff --git a/requirements/project.txt b/requirements/project.txt index 2076920..a1d23f1 100644 --- a/requirements/project.txt +++ b/requirements/project.txt @@ -13,4 +13,6 @@ python-dateutil==1.5 django-reversion==1.3.1 django-sorting==0.1 bzr==2.3.1 -launchpadlib==1.9.8 \ No newline at end of file +launchpadlib==1.9.8 +coverage==3.4 +django-coverage==1.1.1 diff --git a/settings.py b/settings.py index d210199..1aaa67d 100644 --- a/settings.py +++ b/settings.py @@ -146,6 +146,16 @@ "homepage.context_processors.current_path", ] +PROJECT_APPS = [ + "about", + "grid", + "homepage", + "package", + "profiles", + "searchv1", + "apiv1", +] + INSTALLED_APPS = [ # Django "django.contrib.admin", @@ -181,16 +191,7 @@ "pinax.apps.account", "pinax.apps.signup_codes", "pinax.apps.analytics", - - # project - "about", - "grid", - "homepage", - "package", - "profiles", - "searchv1", - "apiv1", -] +] + PROJECT_APPS FIXTURE_DIRS = [ os.path.join(PROJECT_ROOT, "fixtures"), @@ -250,7 +251,15 @@ 'django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader', ) - + +#TEST_RUNNER = 'testrunner.OurTestRunner' +TEST_RUNNER = 'testrunner.OurCoverageRunner' + +COVERAGE_MODULE_EXCLUDES = [ + 'tests$', 'settings$', 'urls$', 'locale$', 'migrations', 'fixtures', +] + INSTALLED_APPS[:-len(PROJECT_APPS)] +COVERAGE_REPORT_HTML_OUTPUT_DIR = "coverage" + # local_settings.py can be used to override environment-specific settings # like database and email that differ between development and production. diff --git a/testrunner.py b/testrunner.py new file mode 100644 index 0000000..4cff2d3 --- /dev/null +++ b/testrunner.py @@ -0,0 +1,12 @@ +# Make our own testrunner that by default only tests our own apps + +from django.conf import settings +from django.test.simple import DjangoTestSuiteRunner +from django_coverage.coverage_runner import CoverageRunner + +class OurTestRunner(DjangoTestSuiteRunner): + def build_suite(self, test_labels, *args, **kwargs): + return super(OurTestRunner, self).build_suite(test_labels or settings.PROJECT_APPS, *args, **kwargs) + +class OurCoverageRunner(OurTestRunner, CoverageRunner): + pass