what's the migration path for existing users .... can they just run some re-setup script to upgrade?
On Mon, Dec 21, 2009 at 3:15 PM, Steve Howard <[email protected]> wrote: > Update to Django 1.1.1. I want to use a new feature for my RESTful interface > prototyping (direct inclusion of URL patterns in URLconfs). > > The one obstacle this presented was that Django 1.1.1 changes the DB > connection object to accept DB config information in its constructor, rather > than reading it from django.conf.settings on-demand. This was a problem > because we change stuff in django.conf.settings on the fly to do our fancy > test DB stuff -- basically, we initialize a SQLite DB once, copy it off, and > then copy it between test cases, rather than clearing and reconstructing the > initial DB. I did measurements and it turns out all that jazz wasn't really > saving us much time at all, so I just got rid of it all. Django's testing > stuff has improved and v1.1 even has some new tricks for using transactions > to accomplish the above with a dramatic speedup, so we ought to look into > using that in the future. > > Signed-off-by: Steve Howard <[email protected]> > > --- autotest/frontend/afe/frontend_test_utils.py 2009-12-18 > 02:10:21.000000000 -0800 > +++ autotest/frontend/afe/frontend_test_utils.py 2009-12-18 > 14:32:48.000000000 -0800 > @@ -6,32 +6,6 @@ > from autotest_lib.client.common_lib.test_utils import mock > > class FrontendTestMixin(object): > - _test_db_initialized = False > - > - def _initialize_test_db(self): > - if self._test_db_initialized: > - return > - > - temp_fd, test_db_file = tempfile.mkstemp(suffix='.frontend_test') > - FrontendTestMixin._test_db_file = test_db_file > - os.close(temp_fd) > - > - def cleanup_test_db(): > - os.remove(test_db_file) > - atexit.register(cleanup_test_db) > - > - setup_test_environment.set_test_database(test_db_file) > - setup_test_environment.set_up() > - FrontendTestMixin._test_db_backup = ( > - setup_test_environment.backup_test_database()) > - FrontendTestMixin._test_db_initialized = True > - > - > - def _open_test_db(self): > - self._initialize_test_db() > - setup_test_environment.restore_test_database(self._test_db_backup) > - > - > def _fill_in_test_data(self): > """Populate the test database with some hosts and labels.""" > acl_group = models.AclGroup.objects.create(name='my_acl') > @@ -91,7 +65,7 @@ > > def _frontend_common_setup(self, fill_data=True): > self.god = mock.mock_god() > - self._open_test_db() > + setup_test_environment.set_up() > self._setup_dummy_user() > if fill_data: > self._fill_in_test_data() > --- autotest/frontend/setup_test_environment.py 2009-12-18 14:32:48.000000000 > -0800 > +++ autotest/frontend/setup_test_environment.py 2009-12-18 14:32:48.000000000 > -0800 > @@ -14,27 +14,6 @@ > from django.db import connection > from autotest_lib.frontend.afe import readonly_connection > > -def set_test_database(database): > - settings.DATABASE_NAME = database > - destroy_test_database() > - > - > -def backup_test_database(): > - temp_fd, backup_path = tempfile.mkstemp(suffix='.test_db_backup') > - os.close(temp_fd) > - shutil.copyfile(settings.DATABASE_NAME, backup_path) > - return backup_path > - > - > -def restore_test_database(backup_path): > - connection.close() > - shutil.copyfile(backup_path, settings.DATABASE_NAME) > - > - > -def cleanup_database_backup(backup_path): > - os.remove(backup_path) > - > - > def run_syncdb(verbosity=0): > management.call_command('syncdb', verbosity=verbosity, interactive=False) > > --- autotest/scheduler/monitor_db_functional_test.py 2009-12-18 > 14:32:48.000000000 -0800 > +++ autotest/scheduler/monitor_db_functional_test.py 2009-12-18 > 14:32:48.000000000 -0800 > @@ -316,6 +316,7 @@ > > > def tearDown(self): > + self._database.disconnect() > self._frontend_common_teardown() > > > @@ -332,7 +333,6 @@ > > self._database = ( > database_connection.TranslatingDatabase.get_test_database( > - file_path=self._test_db_file, > translators=_DB_TRANSLATORS)) > self._database.connect(db_type='django') > self.god.stub_with(monitor_db, '_db', self._database) > --- autotest/scheduler/monitor_db_unittest.py 2009-12-18 02:24:44.000000000 > -0800 > +++ autotest/scheduler/monitor_db_unittest.py 2009-12-18 14:32:48.000000000 > -0800 > @@ -14,6 +14,7 @@ > from autotest_lib.frontend.afe import models > from autotest_lib.scheduler import monitor_db, drone_manager, email_manager > from autotest_lib.scheduler import scheduler_config, gc_stats > +from autotest_lib.scheduler import monitor_db_functional_test > > _DEBUG = False > > @@ -91,14 +92,16 @@ > monitor_db.DBObject._clear_instance_cache() > > self._database = ( > - database_connection.DatabaseConnection.get_test_database( > - self._test_db_file)) > - self._database.connect() > + database_connection.TranslatingDatabase.get_test_database( > + translators=monitor_db_functional_test._DB_TRANSLATORS)) > + self._database.connect(db_type='django') > self._database.debug = _DEBUG > > - monitor_db._db = self._database > - monitor_db._drone_manager._results_dir = '/test/path' > - monitor_db._drone_manager._temporary_directory = '/test/path/tmp' > + self.god.stub_with(monitor_db, '_db', self._database) > + self.god.stub_with(monitor_db._drone_manager, '_results_dir', > + '/test/path') > + self.god.stub_with(monitor_db._drone_manager, '_temporary_directory', > + '/test/path/tmp') > > > def setUp(self): > --- autotest/utils/build_externals.py 2009-12-18 14:32:48.000000000 -0800 > +++ autotest/utils/build_externals.py 2009-12-18 14:32:48.000000000 -0800 > @@ -548,6 +548,8 @@ > if self.hex_sum != checksum.hexdigest(): > logging.warning('Bad checksum for %s fetched from %s.', > self.name, url) > + logging.warning('Got %s', checksum.hexdigest()) > + logging.warning('Expected %s', self.hex_sum) > os.unlink(local_path) > continue > logging.info('Good checksum.') > @@ -638,10 +640,10 @@ > > > class DjangoPackage(ExternalPackage): > - version = '1.0.4' > + version = '1.1.1' > local_filename = 'Django-%s.tar.gz' % version > urls = ('http://www.djangoproject.com/download/%s/tarball/' % version,) > - hex_sum = 'a8b9f33adb007146b8b57f22f0f38467f0d2693a' > + hex_sum = '441c54f0e90730bf4a55432b64519169b1e6ef20' > > _build_and_install = ExternalPackage._build_and_install_from_package > _build_and_install_current_dir = ( > _______________________________________________ > Autotest mailing list > [email protected] > http://test.kernel.org/cgi-bin/mailman/listinfo/autotest > _______________________________________________ Autotest mailing list [email protected] http://test.kernel.org/cgi-bin/mailman/listinfo/autotest
