[Twisted-Python] "twistd" in Twisted 16.4.0 can't import modules/packages from current working directory

Glyph Lefkowitz glyph at twistedmatrix.com
Tue Feb 14 15:44:16 MST 2017


> On Feb 12, 2017, at 11:08 AM, Craig Rodrigues <rodrigc at crodrigues.org> wrote:
> 
> On Tue, Feb 7, 2017 at 11:29 AM, Glyph Lefkowitz <glyph at twistedmatrix.com <mailto:glyph at twistedmatrix.com>> wrote:
> 
>> On Feb 7, 2017, at 6:59 AM, Jean-Paul Calderone <exarkun at twistedmatrix.com <mailto:exarkun at twistedmatrix.com>> wrote:
>> 
>> On Fri, Jan 13, 2017 at 1:13 AM, Glyph Lefkowitz <glyph at twistedmatrix.com <mailto:glyph at twistedmatrix.com>> wrote:
>> Thanks for highlighting those.  I've put the link in the other direction as well.
>> 
>> 
>> Craig seems eager to go ahead with reverting this change in behavior.
>> 
>> https://github.com/twisted/twisted/pull/672#issuecomment-275956265 <https://github.com/twisted/twisted/pull/672#issuecomment-275956265>
>> 
>> As far as I can tell, no one has weighed in on the other side.  So I'm inclined to go along with the reversion.
> 
> My 2¢ for the other side is: if trial does this, but twist and twistd don't, then it will be possible to get a passing test run for a plugin that doesn't get loaded.  I think it would be simpler and easier to debug to leave these consistent.
> 
> 
> 
> This is an interesting corner case, but I think the twistd and twist issues should be pursued in
> separate discussions and tickets.
> 
> For trial, I would like to proceed with https://github.com/twisted/twisted/pull/672/ <https://github.com/twisted/twisted/pull/672/> .  With my conversion
> of trial to a console script, the new behavior was unintentional on my part.  Since all the unit tests
> passed, I did not notice.  In this ticket: https://twistedmatrix.com/trac/ticket/8978 <https://twistedmatrix.com/trac/ticket/8978>
> Job-Evers-Meltzer provided a use-case where the new behavior of trial
> broke existing usage.
> 
> trial can be used as a general-purpose tool for running unittest-style tests,
> much like pytest or nose.  The new behavior is disruptive, for minimal benefit,
> so I would like to restore the old behavior.
> 
> I added a unit test for this, so in future, if this breaks again, we will catch it.

There's a lot of controversy around this type of organization of tests; personally, I believe it is a horrible antipattern, others, notably Donald Stufft, (wrongly) regard it as a best practice.

Apropos of the comment I put on 9035, https://twistedmatrix.com/trac/ticket/9035#comment:4 <https://twistedmatrix.com/trac/ticket/9035#comment:4>, would it be acceptable for Job Evers‐Meltzer if the syntax were simply 'trial ./tests/' instead?

-glyph

-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20170214/fdae8a7f/attachment-0002.html>


More information about the Twisted-Python mailing list