Edgewall Software
Modify

Ticket #7208 (closed defect: fixed)

Opened 4 years ago

Last modified 17 months ago

EnvironmentStub missing config data for sqlite::memory:

Reported by: tumma72@… Owned by: cboos
Priority: normal Milestone: 0.12.1
Component: database backend Version:
Severity: minor Keywords: testing
Cc:
Release Notes:
API 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

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

Download all attachments as: .zip

Change History

Changed 4 years ago by tumma72@…

Diff file for test.py

comment:1 follow-up: Changed 4 years ago by cboos

  • Keywords testing added
  • Milestone set to 0.12
  • Severity changed from normal to minor

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

Changed 4 years ago by tumma72@…

Script to break the sqlite_backend.py via EnvironmentStub?

comment:2 in reply to: ↑ 1 Changed 4 years ago by anonymous

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 Changed 20 months ago by rblank

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

comment:4 follow-up: Changed 20 months ago by cboos

  • Component changed from general to database backend
  • Milestone changed from next-major-0.1X to 0.12.1
  • Owner changed from jonas to cboos

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

comment:5 Changed 17 months ago by cboos

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

Slightly modified patch applied in r10067.

comment:6 in reply to: ↑ 4 Changed 17 months ago by cboos

this is actually what makes the tests fail in #9470

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

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
to The owner will be changed from cboos. Next status will be 'closed'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.