{"action":"created","issue":{"url":"https://api.github.com/repos/django-nose/django-nose/issues/197","labels_url":"https://api.github.com/repos/django-nose/django-nose/issues/197/labels{/name}","comments_url":"https://api.github.com/repos/django-nose/django-nose/issues/197/comments","events_url":"https://api.github.com/repos/django-nose/django-nose/issues/197/events","html_url":"https://github.com/django-nose/django-nose/issues/197","id":67545958,"number":197,"title":"Django legacy transaction management deprecated","user":{"login":"brwr","id":4095660,"avatar_url":"https://avatars.githubusercontent.com/u/4095660?v=3","gravatar_id":"","url":"https://api.github.com/users/brwr","html_url":"https://github.com/brwr","followers_url":"https://api.github.com/users/brwr/followers","following_url":"https://api.github.com/users/brwr/following{/other_user}","gists_url":"https://api.github.com/users/brwr/gists{/gist_id}","starred_url":"https://api.github.com/users/brwr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brwr/subscriptions","organizations_url":"https://api.github.com/users/brwr/orgs","repos_url":"https://api.github.com/users/brwr/repos","events_url":"https://api.github.com/users/brwr/events{/privacy}","received_events_url":"https://api.github.com/users/brwr/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/django-nose/django-nose/labels/bug","name":"bug","color":"e11d21"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/django-nose/django-nose/milestones/3","html_url":"https://github.com/django-nose/django-nose/milestones/Database%20Testing","labels_url":"https://api.github.com/repos/django-nose/django-nose/milestones/3/labels","id":1087436,"number":3,"title":"Database Testing","description":"The django-nose test suite (as of v1.4, April 2015) does not include database testing. This means that features such as `REUSE_DB=1` will continue to break, and only be discovered when used against other projects.\r\n\r\nProposed steps to fix this:\r\n* Refactor test settings to use [environment variables](http://12factor.net/config), to unify the various test cases into one config.\r\n* Refactor database settings to use [dj-database-url](https://github.com/kennethreitz/dj-database-url), so that adding new database configs is straightforward.\r\n* Add models and model tests to [testapp](https://github.com/django-nose/django-nose/tree/master/testapp), so that database operations are exercised\r\n* Add test runs for `REUSE_DB=1` and similar options.","creator":{"login":"jwhitlock","id":286017,"avatar_url":"https://avatars.githubusercontent.com/u/286017?v=3","gravatar_id":"","url":"https://api.github.com/users/jwhitlock","html_url":"https://github.com/jwhitlock","followers_url":"https://api.github.com/users/jwhitlock/followers","following_url":"https://api.github.com/users/jwhitlock/following{/other_user}","gists_url":"https://api.github.com/users/jwhitlock/gists{/gist_id}","starred_url":"https://api.github.com/users/jwhitlock/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jwhitlock/subscriptions","organizations_url":"https://api.github.com/users/jwhitlock/orgs","repos_url":"https://api.github.com/users/jwhitlock/repos","events_url":"https://api.github.com/users/jwhitlock/events{/privacy}","received_events_url":"https://api.github.com/users/jwhitlock/received_events","type":"User","site_admin":false},"open_issues":2,"closed_issues":0,"state":"open","created_at":"2015-04-28T13:24:29Z","updated_at":"2015-04-28T13:25:48Z","due_on":null,"closed_at":null},"comments":8,"created_at":"2015-04-10T08:59:56Z","updated_at":"2015-05-09T20:47:11Z","closed_at":null,"body":"As of March 21, 2014, some legacy transaction management features in the Django project have been deprecated and removed from the project: django/django@0f95608.\r\n\r\nI have a Makefile with the following (among other things):\r\n\r\n    COMMON_REQUIREMENTS_FILE = arcadia/config/environments/common/requirements.txt\r\n\r\n    DEVELOPMENT_REQUIREMENTS_FILE = arcadia/config/environments/development/requirements.txt\r\n\r\n    TESTING_DATABASE_NAME = test_arcadia\r\n    TESTING_DATABASE_OWNER = arcadia\r\n    TESTING_SETTINGS_FILE = arcadia.config.environments.testing.settings\r\n\r\n    test:\r\n\tREUSE_DB=1 python manage.py test --settings $(TESTING_SETTINGS_FILE)\r\n\r\n    test-clean:\r\n        sudo su - postgres -c 'psql -c \"DROP DATABASE IF EXISTS $(TESTING_DATABASE_NAME);\"'\r\n        sudo su - postgres -c 'psql -c \"CREATE DATABASE $(TESTING_DATABASE_NAME) WITH OWNER $(TESTING_DATABASE_OWNER);\"'\r\n        pip install -r $(COMMON_REQUIREMENTS_FILE)\r\n        pip install -r $(DEVELOPMENT_REQUIREMENTS_FILE)\r\n        python manage.py makemigrations --settings $(TESTING_SETTINGS_FILE)\r\n        python manage.py migrate --settings $(TESTING_SETTINGS_FILE)\r\n        REUSE_DB=1 python manage.py test --settings $(TESTING_SETTINGS_FILE)\r\n\r\nRunning `make test-clean` produces the following:\r\n\r\n    sudo su - postgres -c 'psql -c \"DROP DATABASE IF EXISTS test_arcadia;\"'\r\n    NOTICE:  database \"test_arcadia\" does not exist, skipping\r\n    DROP DATABASE\r\n    sudo su - postgres -c 'psql -c \"CREATE DATABASE test_arcadia WITH OWNER arcadia;\"'\r\n    CREATE DATABASE\r\n    pip install -r arcadia/config/environments/common/requirements.txt\r\n    Requirement already satisfied (use --upgrade to upgrade): Django==1.8 i /home/james/.virtualenvs/arcadia/lib/python2.7/site-packages (from -r arcadia/config/environments/common/requirements.txt (line 1))\r\n    Requirement already satisfied (use --upgrade to upgrade): psycopg2==2.6 in /home/james/.virtualenvs/arcadia/lib/python2.7/site-packages (from -r arcadia/config/environments/common/requirements.txt (line 2))\r\n    Requirement already satisfied (use --upgrade to upgrade): django-compressor==1.4 in /home/james/.virtualenvs/arcadia/lib/python2.7/site-packages (from -r arcadia/config/environments/common/requirements.txt (line 3))\r\n    Requirement already satisfied (use --upgrade to upgrade): django-appconf>=0.4 in /home/james/.virtualenvs/arcadia/lib/python2.7/site-packages (from django-compressor==1.4->-r arcadia/config/environments/common/requirements.txt (line 3))\r\n    Requirement already satisfied (use --upgrade to upgrade): six in /home/james/.virtualenvs/arcadia/lib/python2.7/site-packages (from django-appconf>=0.4->django-compressor==1.4->-r arcadia/config/environments/common/requirements.txt (line 3))\r\n    pip install -r arcadia/config/environments/development/requirements.txt\r\n    Obtaining file:///home/james/workspace/django-nose (from -r arcadia/config/environments/development/requirements.txt (line 5))\r\n    Requirement already satisfied (use --upgrade to upgrade): django-debug-toolbar==1.3.0 in /home/james/.virtualenvs/arcadia/lib/python2.7/site-packages (from -r arcadia/config/environments/development/requirements.txt (line 1))\r\n    Requirement already satisfied (use --upgrade to upgrade): django-extensions==1.5.2 in /home/james/.virtualenvs/arcadia/lib/python2.7/site-packages (from -r arcadia/config/environments/development/requirements.txt (line 2))\r\n    Requirement already satisfied (use --upgrade to upgrade): nose==1.3.6 in /home/james/.virtualenvs/arcadia/lib/python2.7/site-packages (from -r arcadia/config/environments/development/requirements.txt (line 3))\r\n    Requirement already satisfied (use --upgrade to upgrade): Django>=1.4 in /home/james/.virtualenvs/arcadia/lib/python2.7/site-packages (from django-nose==1.3->-r arcadia/config/environments/development/requirements.txt (line 5))\r\n    Requirement already satisfied (use --upgrade to upgrade): sqlparse in /home/james/.virtualenvs/arcadia/lib/python2.7/site-packages (from django-debug-toolbar==1.3.0->-r arcadia/config/environments/development/requirements.txt (line 1))\r\n    Requirement already satisfied (use --upgrade to upgrade): six>=1.2 in /home/james/.virtualenvs/arcadia/lib/python2.7/site-packages (from django-extensions==1.5.2->-r arcadia/config/environments/development/requirements.txt (line 2))\r\n    Installing collected packages: django-nose\r\n      Running setup.py develop for django-nose\r\n    Successfully installed django-nose-1.3\r\n    python manage.py makemigrations --settings arcadia.config.environments.testing.settings\r\n    No changes detected\r\n    python manage.py migrate --settings arcadia.config.environments.testing.settings\r\n    Operations to perform:\r\n      Synchronize unmigrated apps: members, staticfiles, messages, compressor, authentication,     django_nose\r\n      Apply all migrations: admin, contenttypes, sites, auth, sessions\r\n    Synchronizing apps without migrations:\r\n      Creating tables...\r\n        Running deferred SQL...\r\n      Installing custom SQL...\r\n    Running migrations:\r\n      No migrations to apply.\r\n    REUSE_DB=1 python manage.py test --settings arcadia.config.environments.testing.settings nosetests --verbosity=1\r\n    Traceback (most recent call last):\r\n      File \"manage.py\", line 10, in <module>\r\n        execute_from_command_line(sys.argv)\r\n      File \"/home/james/.virtualenvs/arcadia/local/lib/python2.7/site-packages/django/core/management/__init__.py\", line 338, in execute_from_command_line\r\n        utility.execute()\r\n      File \"/home/james/.virtualenvs/arcadia/local/lib/python2.7/site-packages/django/core/management/__init__.py\", line 330, in execute\r\n        self.fetch_command(subcommand).run_from_argv(self.argv)\r\n      File \"/home/james/.virtualenvs/arcadia/local/lib/python2.7/site-packages/django/core/management/commands/test.py\", line 30, in run_from_argv\r\n        super(Command, self).run_from_argv(argv)\r\n      File \"/home/james/.virtualenvs/arcadia/local/lib/python2.7/site-packages/django/core/management/base.py\", line 390, in run_from_argv\r\n        self.execute(*args, **cmd_options)\r\n      File \"/home/james/.virtualenvs/arcadia/local/lib/python2.7/site-packages/django/core/management/commands/test.py\", line 74, in execute\r\n        super(Command, self).execute(*args, **options)\r\n      File \"/home/james/.virtualenvs/arcadia/local/lib/python2.7/site-packages/django/core/management/base.py\", line 441, in execute\r\n        output = self.handle(*args, **options)\r\n      File \"/home/james/.virtualenvs/arcadia/local/lib/python2.7/site-packages/django/core/management/commands/test.py\", line 90, in handle\r\n        failures = test_runner.run_tests(test_labels)\r\n      File \"/home/james/workspace/django-nose/django_nose/runner.py\", line 349, in run_tests\r\n        result = self.run_suite(nose_argv)\r\n      File \"/home/james/workspace/django-nose/django_nose/runner.py\", line 296, in run_suite\r\n        addplugins=plugins_to_add)\r\n      File \"/home/james/.virtualenvs/arcadia/local/lib/python2.7/site-packages/nose/core.py\", line 121, in __init__\r\n    **extra_args)\r\n      File \"/usr/lib/python2.7/unittest/main.py\", line 95, in __init__\r\n        self.runTests()\r\n      File \"/home/james/.virtualenvs/arcadia/local/lib/python2.7/site-packages/nose/core.py\", line 207, in runTests\r\n        result = self.testRunner.run(self.test)\r\n      File \"/home/james/.virtualenvs/arcadia/local/lib/python2.7/site-packages/nose/core.py\", line 50, in run\r\n        wrapper = self.config.plugins.prepareTest(test)\r\n      File \"/home/james/.virtualenvs/arcadia/local/lib/python2.7/site-packages/nose/plugins/manager.py\", line 99, in __call__\r\n        return self.call(*arg, **kw)\r\n      File \"/home/james/.virtualenvs/arcadia/local/lib/python2.7/site-packages/nose/plugins/manager.py\", line 167, in simple\r\n        result = meth(*arg, **kw)\r\n      File \"/home/james/workspace/django-nose/django_nose/plugin.py\", line 76, in prepareTest\r\n        self.old_names = self.runner.setup_databases()\r\n      File \"/home/james/workspace/django-nose/django_nose/runner.py\", line 521, in setup_databases\r\n        transaction.commit_unless_managed(using=connection.alias)\r\n    AttributeError: 'module' object has no attribute 'commit_unless_managed'\r\n    make: *** [test-clean] Error 1\r\n\r\nRunning `make test` produces the same error:\r\n\r\n    REUSE_DB=1 python manage.py test --settings arcadia.config.environments.testing.settings nosetests --verbosity=1\r\n    Traceback (most recent call last):\r\n      File \"manage.py\", line 10, in <module>\r\n        execute_from_command_line(sys.argv)\r\n      File \"/home/james/.virtualenvs/arcadia/local/lib/python2.7/site-packages/django/core/management/__init__.py\", line 338, in execute_from_command_line\r\n        utility.execute()\r\n      File \"/home/james/.virtualenvs/arcadia/local/lib/python2.7/site-packages/django/core/management/__init__.py\", line 330, in execute\r\n        self.fetch_command(subcommand).run_from_argv(self.argv)\r\n      File \"/home/james/.virtualenvs/arcadia/local/lib/python2.7/site-packages/django/core/management/commands/test.py\", line 30, in run_from_argv\r\n        super(Command, self).run_from_argv(argv)\r\n      File \"/home/james/.virtualenvs/arcadia/local/lib/python2.7/site-packages/django/core/management/base.py\", line 390, in run_from_argv\r\n        self.execute(*args, **cmd_options)\r\n      File \"/home/james/.virtualenvs/arcadia/local/lib/python2.7/site-packages/django/core/management/commands/test.py\", line 74, in execute\r\n        super(Command, self).execute(*args, **options)\r\n      File \"/home/james/.virtualenvs/arcadia/local/lib/python2.7/site-packages/django/core/management/base.py\", line 441, in execute\r\n        output = self.handle(*args, **options)\r\n      File \"/home/james/.virtualenvs/arcadia/local/lib/python2.7/site-packages/django/core/management/commands/test.py\", line 90, in handle\r\n        failures = test_runner.run_tests(test_labels)\r\n      File \"/home/james/workspace/django-nose/django_nose/runner.py\", line 349, in run_tests\r\n        result = self.run_suite(nose_argv)\r\n      File \"/home/james/workspace/django-nose/django_nose/runner.py\", line 296, in run_suite\r\n        addplugins=plugins_to_add)\r\n      File \"/home/james/.virtualenvs/arcadia/local/lib/python2.7/site-packages/nose/core.py\", line 121, in __init__\r\n    **extra_args)\r\n      File \"/usr/lib/python2.7/unittest/main.py\", line 95, in __init__\r\n        self.runTests()\r\n      File \"/home/james/.virtualenvs/arcadia/local/lib/python2.7/site-packages/nose/core.py\", line 207, in runTests\r\n        result = self.testRunner.run(self.test)\r\n      File \"/home/james/.virtualenvs/arcadia/local/lib/python2.7/site-packages/nose/core.py\", line 50, in run\r\n        wrapper = self.config.plugins.prepareTest(test)\r\n      File \"/home/james/.virtualenvs/arcadia/local/lib/python2.7/site-packages/nose/plugins/manager.py\", line 99, in __call__\r\n        return self.call(*arg, **kw)\r\n      File \"/home/james/.virtualenvs/arcadia/local/lib/python2.7/site-packages/nose/plugins/manager.py\", line 167, in simple\r\n        result = meth(*arg, **kw)\r\n      File \"/home/james/workspace/django-nose/django_nose/plugin.py\", line 76, in prepareTest\r\n        self.old_names = self.runner.setup_databases()\r\n      File \"/home/james/workspace/django-nose/django_nose/runner.py\", line 521, in setup_databases\r\n        transaction.commit_unless_managed(using=connection.alias)\r\n    AttributeError: 'module' object has no attribute 'commit_unless_managed'\r\n    make: *** [test] Error 1\r\n\r\nThis error doesn't occur after I remove `sudo su - postgres -c 'psql -c \"CREATE DATABASE $(TESTING_DATABASE_NAME) WITH OWNER $(TESTING_DATABASE_OWNER);` from `test-clean`, but `make test` still causes it to happen.\r\n\r\nRunning `python manage.py test --settings arcadia.config.environments.testing.settings` from the command line also solves the problem.\r\n\r\nHere is the offending line of code:  [django_nose/runner.py#L404](https://github.com/django-nose/django-nose/blob/117e3892a64a67d90a8daaacb07332f05ce7f73e/django_nose/runner.py#L404).\r\n\r\nPlease let me know if I can provide anything else that is helpful."},"comment":{"url":"https://api.github.com/repos/django-nose/django-nose/issues/comments/100543646","html_url":"https://github.com/django-nose/django-nose/issues/197#issuecomment-100543646","issue_url":"https://api.github.com/repos/django-nose/django-nose/issues/197","id":100543646,"user":{"login":"jwhitlock","id":286017,"avatar_url":"https://avatars.githubusercontent.com/u/286017?v=3","gravatar_id":"","url":"https://api.github.com/users/jwhitlock","html_url":"https://github.com/jwhitlock","followers_url":"https://api.github.com/users/jwhitlock/followers","following_url":"https://api.github.com/users/jwhitlock/following{/other_user}","gists_url":"https://api.github.com/users/jwhitlock/gists{/gist_id}","starred_url":"https://api.github.com/users/jwhitlock/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jwhitlock/subscriptions","organizations_url":"https://api.github.com/users/jwhitlock/orgs","repos_url":"https://api.github.com/users/jwhitlock/repos","events_url":"https://api.github.com/users/jwhitlock/events{/privacy}","received_events_url":"https://api.github.com/users/jwhitlock/received_events","type":"User","site_admin":false},"created_at":"2015-05-09T20:47:11Z","updated_at":"2015-05-09T20:47:11Z","body":"My preference (and I guess django-nose policy?) is to support the supported Django versions, and the versions in between.  1.4 is the last Long Term Support (LTS) release, and while 1.8 is the new LTS version, 1.4 will be supported until 1.9 is released.  This means we could technically not support 1.5 and 1.6, but it is easy enough to support them an give the 1.4 users a bridge to get up to 1.8.\r\n\r\nI feel like we need tests that exercise the database in order to productively address these bugs.  See the [Database Testing milestone](https://github.com/django-nose/django-nose/milestones/Database%20Testing) for my rough plan for adding this support.  It's Mother's Day weekend here, so it will be another week before I will be able to personally start on that plan."}}