from manoseimas.settings.base import *  # noqa

TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'

CACHES = {
    'default': {
        'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
    }
}

WEBPACK_LOADER.update({
    'DEFAULT': {
        'BUNDLE_DIR_NAME': 'bundles/',
        'STATS_FILE': os.path.join(BUILDOUT_DIR, 'webpack-stats.json'),
    }
})

WEBPACK_COMMAND = ['npm', 'run', 'build:hot-reload']

from manoseimas.settings.base import *  # noqa

TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'

CACHES = {
    'default': {
        'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
    }
}

WEBPACK_LOADER.update({
    'DEFAULT': {
        'BUNDLE_DIR_NAME': 'bundles/',
        'STATS_FILE': os.path.join(BUILDOUT_DIR, 'webpack-stats.json'),
    }
})

WEBPACK_COMMAND = ['npm', 'run', 'build:hot-reload']

# Database name should be taken from read_default_file, but that does not work
# with tests. Without database name running a single test gets 'test_' as
# database name.
DATABASES['default']['NAME'] = 'manoseimas'

Fix annoying database issue when running tests
Fix annoying database issue when running tests

Now database name is taken from 'read_default_file' parameter which points to a
my.cnf configuration, where database name should be defined.

But this does not work when running tests for a single file, database name is
set to 'test_', but when running all tests, then database name is set to
'test_manoseimas'.

Setting database name in settings explicitly fixes this.

  from manoseimas.settings.base import *  # noqa
  
  TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
  
  CACHES = {
      'default': {
          'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
      }
  }
  
  WEBPACK_LOADER.update({
      'DEFAULT': {
          'BUNDLE_DIR_NAME': 'bundles/',
          'STATS_FILE': os.path.join(BUILDOUT_DIR, 'webpack-stats.json'),
      }
  })
  
  WEBPACK_COMMAND = ['npm', 'run', 'build:hot-reload']
  
+ # Database name should be taken from read_default_file, but that does not work
+ # with tests. Without database name running a single test gets 'test_' as
+ # database name.
+ DATABASES['default']['NAME'] = 'manoseimas'
+ 
Fix annoying database issue when running tests
## Code Before:
from manoseimas.settings.base import *  # noqa

TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'

CACHES = {
    'default': {
        'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
    }
}

WEBPACK_LOADER.update({
    'DEFAULT': {
        'BUNDLE_DIR_NAME': 'bundles/',
        'STATS_FILE': os.path.join(BUILDOUT_DIR, 'webpack-stats.json'),
    }
})

WEBPACK_COMMAND = ['npm', 'run', 'build:hot-reload']

## Instruction:
Fix annoying database issue when running tests
## Code After:
from manoseimas.settings.base import *  # noqa

TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'

CACHES = {
    'default': {
        'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
    }
}

WEBPACK_LOADER.update({
    'DEFAULT': {
        'BUNDLE_DIR_NAME': 'bundles/',
        'STATS_FILE': os.path.join(BUILDOUT_DIR, 'webpack-stats.json'),
    }
})

WEBPACK_COMMAND = ['npm', 'run', 'build:hot-reload']

# Database name should be taken from read_default_file, but that does not work
# with tests. Without database name running a single test gets 'test_' as
# database name.
DATABASES['default']['NAME'] = 'manoseimas'
