ModuleNotFoundError with pytest

后端 未结 6 724
时光说笑
时光说笑 2021-02-12 11:05

I want my tests folder separate to my application code. My project structure is like so

myproject/
  myproject/
    myproject.py
    moduleone.py
  tests/
    my         


        
6条回答
  •  死守一世寂寞
    2021-02-12 11:43

    Be sure to include . dot in the $PYTHONPATH env var.

    You can use this code fragment to debug such issues:

    import pprint
    import sys
    pprint.pprint(sys.path)
    

    Your question managed to use myproject at three different levels. At least during debugging you might want to use three distinct names, to reduce possible confusion.

提交回复
热议问题