Closed delphisharp closed 8 months ago
Please post the error message.
# 200
mock_request("GET", "/")
assert container.status.startswith(str(HTTPStatus.OK.value))
E AssertionError: assert False E + where False = <built-in method startswith of str object at 0x7fd0f48940b0>('200') E + where <built-in method startswith of str object at 0x7fd0f48940b0> = '404 Not Found'.startswith E + where '404 Not Found' = <class 'tests.core.test_drawing.response'>.status E + and '200' = str(200) E + where 200 = <HTTPStatus.OK: 200>.value E + where <HTTPStatus.OK: 200> = HTTPStatus.OK
./sqllineage/sqllineage/build/index.html not file. raise FileNotExist Exception
s there any pre-work required for run pytest --cov
“build” dir not exist ,
It should be obvious that there is no error in the directory. As long as you run the test, you will encounter problems.
i get new 1.5.0 . no build dir also.
What tool did you use for running test cases before, and is the one you're using now different from the previous one?
It's best to directly copy the call stack when providing error messages.
no build/index.html dir. use pycharm or vscode or pytest --cov . same result
你用PyCharm跑测试用例,然后把报错的测试用例的调用堆栈贴出来 You run test cases using PyCharm, then copy and paste the call stack of the failed test case.
这个测试用例失败应该不影响你提PR This test case failure shouldn't impact your pull request.
没有抛出异常, 返回404,Assert 判断的是200,导致无法通过测试。
为什么是404, 是因为 build/index.html 没找到文件,导致内部异常。
from http import HTTPStatus
from io import StringIO
from sqllineage.drawing import app
container = namedtuple("response", ["status", "header"])
def start_response(status, header):
container.status = status
container.header = header
def mock_request(method, path, body=None):
if isinstance(body, dict):
body = json.dumps(body)
environ = {"REQUEST_METHOD": method, "PATH_INFO": path}
if body:
with StringIO() as f:
length = f.write(body)
f.seek(0)
environ["CONTENT_LENGTH"] = length
environ["wsgi.input"] = f
app(environ, start_response)
else:
app(environ, start_response)
# 200
mock_request("GET", "/")
print(container.status)
assert container.status.startswith(str(HTTPStatus.OK.value))
404 Not Found
Traceback (most recent call last):
File "xxx/sqllineage_github/sqllineage/2.py", line 33, in
line 66:
with open(static_fname, "rb") as f:
text = f.read()
return self.handle_200_text(start_response, mimetype, text)
line 101
except (SystemExit, IsADirectoryError, FileNotFoundError, PermissionError):
return self.handle_404(start_response)
except (SQLLineageException, RuntimeError) as e:
return self.handle_400(start_response, str(e))
/sqllineage_github/sqllineage/sqllineage/drawing.py
因为没有文件, 所以返回404, 然后又检查是不是200,所以报错。
这个测试用例失败应该不影响你提PR This test case failure shouldn't impact your pull request.
我不知道,没人告诉我可以怎么做。 格式不对不能通过, 我不清楚 test case 过不去能不能提交。 如果这个测试用例可以不管,那我整理下 再次push
我也忘了我这个目录怎么来的了,你不说我都没关注到这个目录。准备开发环境的过程中生成的,要不你重新安装一遍开发环境
I also forgot how this directory was created. I didn't even pay attention to it. It was generated during the process of setting up the development environment. How about reinstalling the development environment to recreate it?
只是在你的开发环境测试用例失败吧,你直接提交PR,页面上应该不会失败,你又没动相关代码
If the test case fails only in your development environment, you can go ahead and submit the pull request. It shouldn't fail on the web page since you haven't made any changes to the relevant code.
OK。 I execute it manually again black . --check --diff flake8 bandit -r sqllineage mypy pytest --cov
if is all OK, i will submit PR
black & flake8 & mypy是通过git钩子自动执行的 Black, Flake8, and Mypy are automatically executed through Git hooks.
收到。我学习怎么配置。目前我的环境没有提交前预检查 receive. I learned how to configure it. Currently my environment does not have pre-commit pre-checks
Describe the bug I want to submit a pull, but ./sqllineage/tests/core/test_drawing.py test fail. line 42:
point to ./sqllineage/sqllineage/build , but not found in disk.
please tell me how do it.
Python version (available via
python --version
)SQLLineage version (available via
sqllineage --version
):