FileNotFoundError:[错误2]没有这样的文件或目录:pytest中的“ /abc/xyz.png”

时间:2019-05-25 17:15:55

标签: python pycharm pytest

我在PyCharm中运行脚本进行图像比较时出现pytest错误

FileNotFoundError: [Errno 2] No such file or directory:
  ..\WifiAnalytics\BaseTest.py:50: FileNotFoundError

在此行代码中,我遇到了错误:

def immageComparison(self, ReferenceImage, NewImage):
   with open(ReferenceImage , "rb") as imageFile:

完整代码:

def immageComparison(self, ReferenceImage, NewImage):
    with open(ReferenceImage , "rb") as imageFile:
        str1 = base64.b64encode(imageFile.read())
        # print (str1)

    with open(NewImage, "rb")as imageFile:
        str2 = base64.b64encode(imageFile.read())
        # print(str2)
    if str1 == str2:
        print("True")
        return True
    else:
        print("False")
        return False

打印真实

0 个答案:

没有答案