test_drawing.py can't run. where is STATIC_FOLDER? #541
Replies: 18 comments 1 reply
-
Please post the error message. |
Beta Was this translation helpful? Give feedback.
-
E AssertionError: assert False ./sqllineage/sqllineage/build/index.html not file. raise FileNotExist Exception |
Beta Was this translation helpful? Give feedback.
-
s there any pre-work required for run pytest --cov i get new 1.5.0 . no build dir also. |
Beta Was this translation helpful? Give feedback.
-
What tool did you use for running test cases before, and is the one you're using now different from the previous one? |
Beta Was this translation helpful? Give feedback.
-
It's best to directly copy the call stack when providing error messages. |
Beta Was this translation helpful? Give feedback.
-
no build/index.html dir. |
Beta Was this translation helpful? Give feedback.
-
你用PyCharm跑测试用例,然后把报错的测试用例的调用堆栈贴出来 |
Beta Was this translation helpful? Give feedback.
-
这个测试用例失败应该不影响你提PR |
Beta Was this translation helpful? Give feedback.
-
没有抛出异常, 返回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 |
Beta Was this translation helpful? Give feedback.
-
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,所以报错。 |
Beta Was this translation helpful? Give feedback.
-
我不知道,没人告诉我可以怎么做。 |
Beta Was this translation helpful? Give feedback.
-
我也忘了我这个目录怎么来的了,你不说我都没关注到这个目录。准备开发环境的过程中生成的,要不你重新安装一遍开发环境 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? |
Beta Was this translation helpful? Give feedback.
-
只是在你的开发环境测试用例失败吧,你直接提交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. |
Beta Was this translation helpful? Give feedback.
-
OK。 if is all OK, i will submit PR |
Beta Was this translation helpful? Give feedback.
-
black & flake8 & mypy是通过git钩子自动执行的 |
Beta Was this translation helpful? Give feedback.
-
收到。我学习怎么配置。目前我的环境没有提交前预检查 |
Beta Was this translation helpful? Give feedback.
-
https://github.com/reata/sqllineage/blob/master/CONTRIBUTING.md |
Beta Was this translation helpful? Give feedback.
-
我把这个issue转成discussion了,因为不是sqllineage本身的bug或者feature request. 使用或者开发的问题,用discussion。discussion里中英文随意。 STATIC_FOLDER是前端的静态文件,是setup.py里EggInfoWithJS这个钩子函数调用nodejs/npm跑出来的。本地保证有node环境,然后 不动前端的code,懒得配node环境的话,直接忽视这个测试用例没问题的。GitHub Action里我是显式指定了actions/setup-node@v3 (参见python-package.yml),所以GitHub Action肯定不会挂的。 |
Beta Was this translation helpful? Give feedback.
-
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
):Beta Was this translation helpful? Give feedback.
All reactions