#8978 defect closed duplicate (duplicate)

Trial won't run; cwd not part of sys.path

Reported by: Job Evers‐Meltzer Owned by:
Priority: normal Milestone:
Component: trial Keywords:
Cc: Branch:
Author:

Description

I used to be able to run:

trial tests

from the root directory of our repo (https://github.com/lbryio/lbry/)

But after a recent update, I started getting:

 File "[...]/venv/local/lib/python2.7/site-packages/twisted/trial/runner.py", line 119, in _importFromFile
    module = imp.load_source(moduleName, fn, fd)
  File "tests/__init__.py", line 4, in <module>
    from lbrynet.core import log_support
exceptions.ImportError: No module named lbrynet.core

Doing a git bisect, this is the commit that broke things:

https://github.com/twisted/twisted/commit/6e3c5b7c043e9a43927a75acb92fa50cd8e579a2

It appears that before this commit, the cwd is part of sys.path, but after the commit its not.

In the old script, there was this line:

sys.path.insert(0, os.path.abspath(os.getcwd())) https://github.com/twisted/twisted/blob/2dd6d509987b0ea3936e86e77225836b1eaaeaf4/bin/trial#L19

Change History (3)

comment:1 Changed 11 months ago by Jean-Paul Calderone

See <https://twistedmatrix.com/trac/ticket/8972>, this is probably a duplicate.

comment:2 Changed 11 months ago by Craig Rodrigues

Component: coretrial
Keywords: review added; trial removed

comment:3 Changed 11 months ago by Jean-Paul Calderone

Keywords: review removed
Resolution: duplicate
Status: newclosed
Note: See TracTickets for help on using tickets.