Edgewall Software
Modify

Opened 16 years ago

Closed 14 years ago

Last modified 14 years ago

#7208 closed defect (fixed)

EnvironmentStub missing config data for sqlite::memory:

Reported by: tumma72@… Owned by: Christian Boos
Priority: normal Milestone: 0.12.1
Component: database backend Version:
Severity: minor Keywords: testing
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

While testing using the EnvironmentStub, if one want to make use of the ConnectionManager and a Connector to use for example the to_sql() method, an exception is rosen because the default string for sqlite connection point to sqlite:db/trac.db which doesn't match with the in memory DB. I fixed the problem adding the following line in the trac.test.py file @178:

if not os.path.isabs(self.path):
        self.path = os.path.join(os.getcwd(), self.path)

self.config = Configuration(None)

# Set the connection type in the config as sqlite in memory
self.config.set('trac', 'database', 'sqlite::memory:')

# We have to have a ticket-workflow config for ''lots'' of things to
# work.  So insert the basic-workflow config here.  There may be a
# better solution than this.
load_workflow_config_snippet(self.config, 'basic-workflow.ini')

Attachments (2)

test.py.diff (625 bytes ) - added by tumma72@… 16 years ago.
Diff file for test.py
breaking_env.py (1.5 KB ) - added by tumma72@… 16 years ago.
Script to break the sqlite_backend.py via EnvironmentStub

Download all attachments as: .zip

Change History (8)

by tumma72@…, 16 years ago

Attachment: test.py.diff added

Diff file for test.py

comment:1 by Christian Boos, 16 years ago

Keywords: testing added
Milestone: 0.12
Severity: normalminor

Could you also upload a small test program reproducing the problem?

by tumma72@…, 16 years ago

Attachment: breaking_env.py added

Script to break the sqlite_backend.py via EnvironmentStub

in reply to:  1 comment:2 by anonymous, 16 years ago

Replying to cboos:

Could you also upload a small test program reproducing the problem?

Sure, here you go… with the patch it works, without it breaks :-)

Of course we could debate on the fact that the DatabaseManager._get_connector() is private… but still… ;-)

comment:3 by Remy Blank, 14 years ago

Is this still needed, now that we can run the tests against all database backends?

comment:4 by Christian Boos, 14 years ago

Component: generaldatabase backend
Milestone: next-major-0.1X0.12.1
Owner: changed from Jonas Borgström to Christian Boos

I think this is actually what makes the tests fail in #9470.

comment:5 by Christian Boos, 14 years ago

Resolution: fixed
Status: newclosed

Slightly modified patch applied in r10067.

in reply to:  4 comment:6 by Christian Boos, 14 years ago

this is actually what makes the tests fail in #9470

Actually no, it's a bit more involved than that.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Christian Boos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Christian Boos to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.