Ticket #2043 (closed task: migrated)
Revisit loading of test configuration in turbogears.testutil
| Reported by: | Chris Arndt | Owned by: | faide |
|---|---|---|---|
| Priority: | normal | Milestone: | 1.1.x bugfix |
| Component: | Tests | Version: | 1.0.7 |
| Severity: | normal | Keywords: | testutil |
| Cc: |
Description
The code in turbogears.testutil to load the configuartion from test.cfg and from the application's config package is very dodgy and should be improved and refactored.
Problems:
- Code runs on importing the module, which IMHO is not so good. Maybe we should only load the configuration when starting TurboGears in testutil.start_server.
- The code looks through all sub-directories of the current working directory for a Python package named config and, when found, passed this to pkg_resources (via config.update_config), but it doesn't check whether the package is actually on the Python path. This leads to an error when your project directory has a sub-directory (and not below the application's 'package' directory), which contains a config package (which normally is not on the Python path).
- The current code to check whether a potential package directory's filename contains invalid Python identitifier chars is not correct.
Change History
Note: See
TracTickets for help on using
tickets.
Added a fix for the third problem mentioned above and a temporary workaround for the second in r5708.
But we should still rethink the whole test configuration loading approach.