From 4dda62a266c2844a0851e03c10379ba5492de299 Mon Sep 17 00:00:00 2001
From: Andre Anjos <andre.dos.anjos@gmail.com>
Date: Wed, 20 Apr 2016 15:48:01 +0200
Subject: [PATCH] [testing] Remove nose runner, simplify testing

---
 .gitignore                    |  3 ++-
 README.rst                    | 15 ++++++++-------
 beat/web/settings/settings.py |  5 +----
 beat/web/settings/test.py     | 20 ++++----------------
 buildout.cfg                  |  2 --
 setup.py                      |  1 -
 6 files changed, 15 insertions(+), 31 deletions(-)

diff --git a/.gitignore b/.gitignore
index 367b4086b..9dd278fe0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -18,7 +18,8 @@ sphinx/
 .DS_Store
 beat/web/settings/settings.py
 src/
-web_dynamic_data*
+prefix/
+test_prefix/
 .nfs*
 beat/web/static/
 doc/api/api/
diff --git a/README.rst b/README.rst
index 404019df0..f629255ba 100644
--- a/README.rst
+++ b/README.rst
@@ -185,13 +185,13 @@ populate a development webserver::
   every combination of database and version you wish to support, run the
   following command::
 
-    $ ./bin/beat -p web_dynamic_data db index <name>/<version>
+    $ ./bin/beat -p prefix db index <name>/<version>
 
   Replacing the strings ``<name>`` by the name of the database you wish to dump
   the indices for, together with the version in ``<version>``. For example, to
   dump the indices for the AT&T database, version 1, do the following::
 
-    $ ./bin/beat -p web_dynamic_data db index atnt/1
+    $ ./bin/beat -p prefix db index atnt/1
 
 Once the contributions and users are in place, you're ready to start the test
 server::
@@ -287,7 +287,8 @@ You may pass filtering criteria to just launch tests for a particular set of
 
 To measure coverage, you must set an environment variable for nose::
 
-  $ NOSE_WITH_COVERAGE=1 NOSE_COVER_PACKAGE=beat.web ./bin/django test --settings=beat.web.settings.test -v 2
+  $ ./bin/coverage run --source='./beat/web' ./bin/django test --settings=beat.web.settings.test
+  $ ./bin/coverage report
 
 .. _snapshot:
 
@@ -331,7 +332,7 @@ current state of a production system.
 4. Remove the current local development database so that the restore operation
    can start from scratch::
 
-     [development]$ rm -rf django.sql3 web_dynamic_data
+     [development]$ rm -rf django.sql3 prefix
 
 
 5. Copy the backup tarball from the production server and restore it locally::
@@ -388,10 +389,10 @@ migration test loop.
    This backup will allow you to quickly test the migrations w/o having to
    checkout the production version anymore.
 
-   Also, create a temporary git repository of ``web_dynamic_data``, so you can
+   Also, create a temporary git repository of ``prefix``, so you can
    cross-check changes and reset it in case of problems::
 
-     $ cd web_dynamic_data
+     $ cd prefix
      $ git init .
      $ git add .
      $ git commit -m "Initial commit"
@@ -415,7 +416,7 @@ migration test loop.
    c. If a problem is detected, fix it and revert the state::
 
         $ cp -af django.sql3.backup django.sql3
-        $ cd web_dynamic_data && git reset --hard HEAD && git clean -fdx . & cd ..
+        $ cd prefix && git reset --hard HEAD && git clean -fdx . & cd ..
 
       .. note::
 
diff --git a/beat/web/settings/settings.py b/beat/web/settings/settings.py
index c8a9abea2..5ebdcde7c 100644
--- a/beat/web/settings/settings.py
+++ b/beat/web/settings/settings.py
@@ -133,7 +133,7 @@ STATIC_ROOT         = 'static'
 #
 ##############################################################################
 
-PREFIX           = os.path.join(os.getcwd(), 'web_dynamic_data')
+PREFIX           = os.path.join(os.getcwd(), 'prefix')
 ALGORITHMS_ROOT  = os.path.join(PREFIX, 'algorithms')
 PLOTTERS_ROOT    = os.path.join(PREFIX, 'plotters')
 LIBRARIES_ROOT   = os.path.join(PREFIX, 'libraries')
@@ -299,9 +299,6 @@ RESTRUCTUREDTEXT_FILTER_SETTINGS = {
     'raw_enabled': 0,
     }
 
-# Use nose to run tests
-TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
-
 # Where CodeMirror is installed and some other settings
 CODEMIRROR_PATH = 'codemirror' #w.r.t to STATIC_URL
 CODEMIRROR_THEME = 'default'
diff --git a/beat/web/settings/test.py b/beat/web/settings/test.py
index e7137a2fe..213c5ceae 100644
--- a/beat/web/settings/test.py
+++ b/beat/web/settings/test.py
@@ -37,15 +37,9 @@ ALLOWED_HOSTS = [
 ]
 
 # To always use a (in-memory) sqlite3 database for the tests
-DATABASES = {
-    'default': {
-        'ENGINE': 'django.db.backends.sqlite3',
-        'NAME': ':memory:',
-    },
-}
+DATABASES['default'] = { 'ENGINE': 'django.db.backends.sqlite3' }
 
-
-PREFIX           = os.path.join(os.getcwd(), 'web_dynamic_data_tests')
+PREFIX           = os.path.join(os.getcwd(), 'test_prefix')
 ALGORITHMS_ROOT  = os.path.join(PREFIX, 'algorithms')
 LIBRARIES_ROOT   = os.path.join(PREFIX, 'libraries')
 DATABASES_ROOT   = os.path.join(PREFIX, 'databases')
@@ -54,13 +48,7 @@ TOOLCHAINS_ROOT  = os.path.join(PREFIX, 'toolchains')
 EXPERIMENTS_ROOT = os.path.join(PREFIX, 'experiments')
 CACHE_ROOT       = os.path.join(PREFIX, 'cache')
 
-
 # To speed-up tests, don't put this in production
-PASSWORD_HASHERS = (
-  'django.contrib.auth.hashers.SHA1PasswordHasher',
-  'django.contrib.auth.hashers.PBKDF2PasswordHasher',
-  'django.contrib.auth.hashers.PBKDF2SHA1PasswordHasher',
-  'django.contrib.auth.hashers.BCryptPasswordHasher',
+PASSWORD_HASHERS = [
   'django.contrib.auth.hashers.MD5PasswordHasher',
-  'django.contrib.auth.hashers.CryptPasswordHasher',
-)
+]
diff --git a/buildout.cfg b/buildout.cfg
index baf669f37..1f80c7e58 100644
--- a/buildout.cfg
+++ b/buildout.cfg
@@ -19,7 +19,6 @@ versions = versions
 django = >=1.8,<1.9
 django-rest-swagger = >=0.3.2
 django-guardian = >=1.3
-django-nose = >=1.4.1
 djangorestframework = >=3.2
 
 [sysegg]
@@ -38,7 +37,6 @@ eggs = alabaster
        django-activity-stream
        django_guardian
        django-jsonfield
-       django_nose
        djangorestframework
        django-rest-swagger
        docopt
diff --git a/setup.py b/setup.py
index 205096e3a..3ddc1677a 100644
--- a/setup.py
+++ b/setup.py
@@ -55,7 +55,6 @@ setup(
         "django-activity-stream",
         "django-jsonfield",
         "django-guardian",
-        "django_nose",
         "djangorestframework",
         "django-rest-swagger",
         "docopt",
-- 
GitLab