Opened 11 years ago

Last modified 9 years ago

#3101 defect new

trial.test.test_loader.FileTest.test_directory modifies the twisted installation

Reported by: radix Owned by:
Priority: normal Milestone:
Component: trial Keywords:
Cc: Thijs Triemstra, spiv Branch:
Author:

Description

This makes it fail if you're running the tests on a system-installed Twisted.

Change History (5)

comment:1 Changed 10 years ago by TimAllen

Test_directory wants to test that runner.filenameToModule(path) will work identically whether or not path has a trailing slash. It seems that for this to work, path must be an importable Python package or a sub-package of an importable package. The test reasonably assumes it's currently in an importable package, so constructs a temporary package along-side to use for its tests, which causes problems.

Potential solutions include:

  • Create a dummy directory in $PWD (which should be the writable _trial_temp directory), mess with sys.path to make it importable.
  • Test with a path derived from __file__ which we already know is an importable package, instead of trying to construct a new package at runtime.

I'm not sure which would be better, but both seem like they should be fairly easy.

comment:2 Changed 10 years ago by Thijs Triemstra

Cc: Thijs Triemstra added

comment:3 Changed 10 years ago by radix

I recommend the first solution. I think we use it elsewhere in similar situations in the Twisted test suite.

comment:4 Changed 9 years ago by spiv

Cc: spiv added

FWIW, the first solution sounds good to me too.

comment:5 Changed 9 years ago by <automation>

Owner: Jonathan Lange deleted
Note: See TracTickets for help on using tickets.