Commit 596c3275 authored by Laurent Peuch's avatar Laurent Peuch
Browse files

refactor(qa): simplify files presence testing a lot

parent 5471ccc8f406
......@@ -21,29 +21,18 @@ for number, cube in enumerate(all_cubes):
# deprecation warnings ?
try:
tox_content = cube.files.get("tox.ini", ref="branch/default").decode().decode("Utf-8")
has_tox = True
cube_files = {x["name"] for x in cube.repository_tree()}
except (gitlab.GitlabHttpError, gitlab.GitlabGetError):
has_tox = False
tox_content = None
# we don't care about empty repositories
continue
try:
cube.files.get(".gitlab-ci.yml", ref="branch/default")
has_gitlab_ci = True
except (gitlab.GitlabHttpError, gitlab.GitlabGetError):
has_gitlab_ci = False
has_tox = "tox.ini" in cube_files
has_gitlab_ci = ".gitlab-ci.yml" in cube_files
has_readme_rst = bool({"README.rst", "README.md"} & cube_files) # set intersection
try:
cube.files.get("README.rst", ref="branch/default")
has_readme_rst = True
except (gitlab.GitlabHttpError, gitlab.GitlabGetError):
try:
cube.files.get("README.md", ref="branch/default")
has_readme_rst = True
except (gitlab.GitlabHttpError, gitlab.GitlabGetError):
has_readme_rst = False
if has_tox:
tox_content = cube.files.get("tox.ini", ref="branch/default").decode().decode("Utf-8")
if tox_content is not None:
with tempfile.TemporaryDirectory() as temporary_directory_path:
# TODO pyproject.toml
tox_path = os.path.join(temporary_directory_path, "tox.ini")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment