Skip to content

Conversation

@apyrgio
Copy link
Contributor

@apyrgio apyrgio commented Dec 14, 2022

Fix some failing CI tests, that started happening due to some upstream changes on Poetry and Debian Bookworm.

Closes #292

Copy link
Contributor

@deeplow deeplow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Looks good overall. I have just added some minor comments.

Suite: bionic
X-Python3-Version: >= 3.6
X-Python3-Version: >= 3.6
Setup-Env-Vars: DEB_BUILD_OPTIONS=nocheck
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about adding a comment about the fact that this disables testing on package building? nocheck might not be an obvious indication of this. Of course on can always search online or check the commit message.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I can add a message like:

# Do not trigger testing when we build the package. Assume that the user
# has tested the package already. For more info, see:
# https://github.com/freedomofpress/dangerzone/issues/292#issuecomment-1349967888

pip install poetry
poetry install # FIXME --dev-only once poetry 1.2.0 is out https://github.com/python-poetry/poetry/issues/2572
apt-get install -y make python3 python3-poetry --no-install-recommends
poetry install --only dev --no-root
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that a lot of dependencies are still installed this way -- beyond just the linting ones. This already solves the issue, but we can shorten the install time and bandwidth by moving lint dependencies into a group of their own in pyproject.toml:

For example, moving them into:

[tool.poetry.group.lint.dependencies]
black = "*"
isort = "*"
mypy = "*"
PySide2-stubs = "*"

Then we install with this line poetry install --only lint.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, with the --only dev or --only lint, I don't think it needs --no-root since it only installs the group.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good thinking, I'll try it and report back.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works great, so I'm including a fix for it.

aliases:
- &provide-podman
name: Provide Podman in Ubuntu Focal
command: ./install/linux/install-podman-ubuntu-focal.sh --repo-only
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since no longer needed, should we simplify the script by removing the --repo-only parameter?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that it's an Ubuntu Focal script that we will drop soon, I wouldn't bother to be honest. Plus you never know when it will prove handy again :-/

@deeplow
Copy link
Contributor

deeplow commented Dec 15, 2022

Looks great. Feel free to merge.

Create two separate groups for Poetry dependencies:

1. test: Dependencies required for testing Dangerzone.
2. lint: Dependencies required for linting the code with `make lint`.
Fix the failing run-lint test by switching to Debian Bookworm for this
step, and installing Poetry 1.2.2 from the official repos. This way, we
circumvent a bug [1] in Poetry 1.3 (released on PyPI) and we greatly
simplify this step [2].

[1]: python-poetry/poetry#7184
[2]: #292 (comment)
Debian has removed the python-all package from its Bookworm repos, which
breaks our CI tests. Looking into why python-all is required in the
first place, we found that it's an artificial stdeb requirement [1],
prior to 0.9.1 versions

The only platform affected by this issue is Ubuntu Focal, so our
solution is to install python-all specifically for that platform.

Finally, we further simplify our build tasks [2] (on Debian-like
distros) by not letting dh-python run tests when building the packages.
Running the tests has some issues after all:

1. It requires installing all the runtime dependencies of Dangerzone,
   since it uses `python -m unittest discover` underneath.
2. It doesn't aid in the stability of the package, since unittest cannot
   run test cases for PyTest.

[1]: stdeb/stdeb#153
[2]: #292 (comment)
Fix the failing convert-test-docs step, by pinning Poetry to version
1.2.2. This way, we avoid a bug in Poetry 1.3 [1], which was recently
released on PyPI.

[1]: python-poetry/poetry#7184

Closes #292
@apyrgio apyrgio merged commit fc313d8 into main Dec 15, 2022
@deeplow deeplow deleted the 292-fix-tests branch May 11, 2023 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix failing CI tests

3 participants