title: Getting error TypeError: 'module' object has no attribute '__getitem__'
body: <p>I am trying to write py.test based test cases. my test.py is </p>
  
  <pre><code>!flask/bin/python
  
  import pytest
  import config
  
  
  @pytest.fixture
  def app(request):
  
  SQLALCHEMY_DATABASE_URI = 'postgresql://sanjeev:sanjeev@localhost:5432/app'
  
  config[SQLALCHEMY_DATABASE_URI] 
  db.create_all()
  def fin():
      db.session.remove()
      db.drop_all()
  request.addfinalizer(fin)
  
  def test_foo(app):
      pass 
  </code></pre>
  
  <p>My config.py file looks like</p>
  
  <pre><code>import os
  from sqlalchemy.ext.declarative import declarative_base
  Base = declarative_base()
  
  basedir = os.path.abspath(os.path.dirname(__file__))
  CSRF_ENABLED = True
  SECRET_KEY = 'you-will-never-guess'
  
  SQLALCHEMY_DATABASE_URI = 'postgresql://sanjeev:sanjeev@localhost:5432/app'
  SQLALCHEMY_MIGRATE_REPO = os.path.join(basedir, 'db_repository')
  </code></pre>
  
  <p>But I am getting error TypeError: 'module' object has no attribute '<strong>getitem</strong>'</p>
  
  <p>below is error log trace </p>
  
  <pre><code>                  ERROR at setup of test_foo
  request = &lt;SubRequest 'app' for &lt;Function 'test_foo'&gt;&gt;
  
  @pytest.fixture
  def app(request):
  
  
      SQLALCHEMY_DATABASE_URI = 'postgresql://sanjeev:sanjeev@localhost:5432/app'
      config[SQLALCHEMY_DATABASE_URI]
      TypeError: 'module' object has no attribute '__getitem__'
  
  test.py:20: TypeError
  </code></pre>