Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #2041 (closed defect: fixed)

Opened 11 years ago

Last modified 11 years ago

test.cfg has become the default configuration file over dev.cfg

Reported by: kvdb Owned by: faide
Priority: normal Milestone: 1.1b2
Component: TurboGears Version: 1.1 HEAD
Severity: normal Keywords: needs feedback


If I start a project using the quickstart generated ./start-project.py and there's no test.cfg in that directory. It picks up dev.cfg, where a MySQL database is configured. And that works fine.

Now when I also have test.cfg present, that has the default SQLite database configured, and I ./start-project.py (without parameters, just like the description above), I get errors on database accesses like:

  File "/home/kvdb/ivy/env/ivy_tg1.1_r5706/lib/python2.5/site-packages/SQLAlchemy-0.5.0rc4-py2.5.egg/sqlalchemy/engine/base.py", line 909, in _handle_dbapi_exception
    raise exc.DBAPIError.instance(statement, parameters, e, connection_invalidated=is_disconnect)
OperationalError: (OperationalError) no such table: item u'SELECT count(1) AS count_1 \nFROM item \nWHERE item.active = ?' [1]

When I replace the SQLite connectionstring in test.cfg with the MySQL one, things work fine again. Strange, because ./start-project.py should not pickup test.cfg by default.

I use TG1.1 r5706.

Change History

comment:1 Changed 11 years ago by Chris Arndt

  • Keywords needs feedback added

I suspect that you import turbogears.testutil somewhere in your project. Could you run the following to confirm:

python -v start-mytest.py 2>&1 | grep grep testutil

If this outputs something, then testutil is imported, which it shouldn't, at least not in a quickstarted project. It doesn't give any output when I try it with a fresh project from r5707.

comment:2 Changed 11 years ago by Chris Arndt

I can't reproduce you behaviour with r5707. If I change test.cfg to contain the line

sqlalchemy.dburi = 'sqlite:///testdata.sqlite'

and start the project with python start-<project>.py, data still gets written to devdata.sqlite defined in dev.cfg and no testdata.sqlite gets created.

Please provide feedback or we will close this ticket as "worksforme". The code in testutil to load test.cfg is a bit dodgy and I will open another ticket for this.

comment:3 Changed 11 years ago by kvdb

  • Status changed from new to closed
  • Resolution set to fixed

Chris, thanks for you suggestions. I get the 'testutil' output you mentioned, so I think the unittests (that import the testutil) are 'leaking' into my project. I suppose digging some more into my code will fix it. Thank you.

And please do open that other ticket, as I think it's a bit strange that 'import testutil' automatically loads test.cfg.

comment:4 Changed 11 years ago by Chris Arndt

The testutil ticket is #2043.

Note: See TracTickets for help on using tickets.