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 #1821 (closed defect: fixed)

Opened 9 years ago

Last modified 9 years ago

[PATCH] testutil guesses wrong module name

Reported by: ctrochalakis Owned by: anonymous
Priority: normal Milestone: 1.0.x bugfix
Component: TurboGears Version: 1.0.4.4
Severity: normal Keywords: tests
Cc: dimitris@…, Felix.Schwarz

Description

When testutil wants to update the global configuration with test.cfg, it's trying to guess the module name (code line 37). It seems that the endswith('config') is a weak test for that purpose: It might match something completely irrelevant.

We use mercurial as our vcs. Mercurial happens to have a .hg/store/data/transifex/config/ dir in the .hg directory. if os.walk(pwd) returns that dir before the correct transifex/config dir the whole thing breaks causing tests to be completely unusable.

This is not always reproducible, it depends on the order os.walk returns directories.

# Override config of all applications with test.cfg
if os.path.exists(os.path.join(cwd, "test.cfg")):
    modulename = None
    for w in os.walk(cwd):
        if w[0].endswith("config"):
            config_dir = w[0].replace(cwd, "")[1:]
            modulename = "%s.app" % config_dir.replace(os.sep, ".")
            break
    update_config(configfile=os.path.join(cwd, "test.cfg"),
        modulename=modulename)

Attachments

cooperate_with_dot_directories Download (672 bytes) - added by Felix.Schwarz 9 years ago.
Patch was produced using Mercurial queues, so please apply with "patch -p1"

Change History

comment:1 Changed 9 years ago by Felix.Schwarz

  • Summary changed from testutil guesses wrong module name to [PATCH] testutil guesses wrong module name

I experienced the same issue today. I'm not sure how to really fix this (or even if we should bother fixing this 'the right way' given that TG2 will probably use a different mechanism) but I built a patch which fixes this issue that testutil gets invalid module names such as '.hg.store.data.transifex.config'.

Python module names must not start with '.' therefore I just exclude all directories with do start with a dot.

Changed 9 years ago by Felix.Schwarz

Patch was produced using Mercurial queues, so please apply with "patch -p1"

comment:2 Changed 9 years ago by Felix.Schwarz

  • Cc Felix.Schwarz added

comment:3 Changed 9 years ago by chrisz

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

Fixed in r4741.

Note: See TracTickets for help on using tickets.