Ticket #16478: 16478.diff

File 16478.diff, 4.5 KB (added by aaugustin, 4 years ago)
  • docs/ref/settings.txt

     
    590590This is an Oracle-specific setting.
    591591
    592592The username to use when connecting to the Oracle database that will be used
    593 when running tests.
     593when running tests. If not provided, Django will use ``'test_' + USER``.
    594594
     595.. setting:: TEST_PASSWD
     596
     597TEST_PASSWD
     598~~~~~~~~~~~
     599
     600Default: ``None``
     601
     602This is an Oracle-specific setting.
     603
     604The password to use when connecting to the Oracle database that will be used
     605when running tests. If not provided, Django will use a hardcoded default value.
     606
     607.. setting:: TEST_TBLSPACE
     608
     609TEST_TBLSPACE
     610~~~~~~~~~~~~~
     611
     612Default: ``None``
     613
     614This is an Oracle-specific setting.
     615
     616The name of the tablespace that will be used when running tests. If not
     617provided, Django will use ``'test_' + NAME``.
     618
     619.. setting:: TEST_TBLSPACE_FILE
     620
     621TEST_TBLSPACE_FILE
     622~~~~~~~~~~~~~~~~~~
     623
     624Default: ``None``
     625
     626This is an Oracle-specific setting.
     627
     628The location of the file that will store the tablespace that will be used when
     629running tests. If not provided, Django will use ``TEST_TBLSPACE + '.dbf'``.
     630
     631.. setting:: TEST_TBLSPACE_TMP
     632
     633TEST_TBLSPACE_TMP
     634~~~~~~~~~~~~~~~~~
     635
     636Default: ``None``
     637
     638This is an Oracle-specific setting.
     639
     640The name of the temporary tablespace that will be used when running tests. If
     641not provided, Django will use ``'test_' + NAME + '_temp'``.
     642
     643.. setting:: TEST_TBLSPACE_TMP_FILE
     644
     645TEST_TBLSPACE_TMP_FILE
     646~~~~~~~~~~~~~~~~~~~~~~
     647
     648Default: ``None``
     649
     650This is an Oracle-specific setting.
     651
     652The location of the file that will store the temporary tablespace that will be
     653used when running tests. If not provided, Django will use ``TEST_TBLSPACE_TMP +
     654'.dbf'``.
     655
    595656.. setting:: DATABASE_ROUTERS
    596657
    597658DATABASE_ROUTERS
  • django/db/backends/oracle/creation.py

     
    4949        TEST_USER = self._test_database_user()
    5050        TEST_PASSWD = self._test_database_passwd()
    5151        TEST_TBLSPACE = self._test_database_tblspace()
     52        TEST_TBLSPACE_FILE = self._test_database_tblspace_file()
    5253        TEST_TBLSPACE_TMP = self._test_database_tblspace_tmp()
     54        TEST_TBLSPACE_TMP_FILE = self._test_database_tblspace_tmp_file()
    5355
    5456        parameters = {
    5557            'dbname': TEST_NAME,
    5658            'user': TEST_USER,
    5759            'password': TEST_PASSWD,
    5860            'tblspace': TEST_TBLSPACE,
     61            'tblspace_file': TEST_TBLSPACE_FILE,
    5962            'tblspace_temp': TEST_TBLSPACE_TMP,
     63            'tblspace_temp_file': TEST_TBLSPACE_TMP_FILE,
    6064        }
    6165
    6266        self.remember['user'] = self.connection.settings_dict['USER']
     
    151155            print "_create_test_db(): dbname = %s" % parameters['dbname']
    152156        statements = [
    153157            """CREATE TABLESPACE %(tblspace)s
    154                DATAFILE '%(tblspace)s.dbf' SIZE 20M
     158               DATAFILE '%(tblspace_file)s' SIZE 20M
    155159               REUSE AUTOEXTEND ON NEXT 10M MAXSIZE 200M
    156160            """,
    157161            """CREATE TEMPORARY TABLESPACE %(tblspace_temp)s
    158                TEMPFILE '%(tblspace_temp)s.dbf' SIZE 20M
     162               TEMPFILE '%(tblspace_temp_file)s' SIZE 20M
    159163               REUSE AUTOEXTEND ON NEXT 10M MAXSIZE 100M
    160164            """,
    161165        ]
     
    245249            pass
    246250        return name
    247251
     252    def _test_database_tblspace_file(self):
     253        name = self._test_database_tblspace() + '.dbf'
     254        try:
     255            if self.connection.settings_dict['TEST_TBLSPACE_FILE']:
     256                name = self.connection.settings_dict['TEST_TBLSPACE_FILE']
     257        except KeyError:
     258            pass
     259        return name
     260
    248261    def _test_database_tblspace_tmp(self):
    249262        name = TEST_DATABASE_PREFIX + self.connection.settings_dict['NAME'] + '_temp'
    250263        try:
     
    254267            pass
    255268        return name
    256269
     270    def _test_database_tblspace_tmp_file(self):
     271        name = self._test_database_tblspace_tmp() + '.dbf'
     272        try:
     273            if self.connection.settings_dict['TEST_TBLSPACE_TMP_FILE']:
     274                name = self.connection.settings_dict['TEST_TBLSPACE_TMP_FILE']
     275        except KeyError:
     276            pass
     277        return name
     278
    257279    def _get_test_db_name(self):
    258280        """
    259281        We need to return the 'production' DB name to get the test DB creation
Back to Top