ImportError: No module named base

后端 未结 3 1673
栀梦
栀梦 2021-01-13 15:33

I\'m trying to implement PageObject pattern for my first Login test. While running it I\'m receiving the following error:

>> py.test -v test_login.py 
         


        
相关标签:
3条回答
  • 2021-01-13 15:39

    Your base module is located in the ui module. Hence line:

    from base import BasePage
    

    should be:

    from ui.base import BasePage
    
    0 讨论(0)
  • 2021-01-13 15:43

    I was just a beginner when this error struck. So, what I did was:

    from models.post import Post
    
    0 讨论(0)
  • 2021-01-13 15:54

    i was just a beginner when this error struck what i did was instead of:

    from models.post import Post
    

    i did the following after installing post as package:

    from post import Post
    

    it worked for me

    0 讨论(0)
提交回复
热议问题