Commit graph

19 commits

Author SHA1 Message Date
deeplow
b73ce5bf6a
Add large test logic and documentation
Adds a large pool of document that can and should be used prior to a
release to understand effects of the new release over a real-world
scenario.

Documents are stored in an external git LFS repo under
`tests/test_docs_large` and currently it's about 11K documents gathered
from multiple PDF readers and office suite's test sets.

Documentation on how to run the tests is under
`docs/developer/TESTING.md`
2023-08-22 16:11:31 +01:00
deeplow
e2accc2da1
Ignore large tests when doing "make test" 2023-08-22 16:11:24 +01:00
Alex Pyrgiotis
a72a31980d
Run GUI tests on separate processes
Run our GUI tests on separate processes, because the combination of
Ubuntu Focal, Qt5, PySide6, and pytest-qt somehow leads to segfaults,
probably due to stale global state.

Closes #493
2023-08-01 14:43:42 +03:00
Alex Pyrgiotis
f58e31efe6
Run tests sequentially
Run tests sequentially, because in subsequent commits we will add
Qt tests that do not play nice when `pytest` creates new processes [1].

Also, remove the pytest wrapper, whose main task was to decide if tests
can run in parallel [2].

[1]: https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-2393
[2]: https://github.com/freedomofpress/dangerzone/issues/217
2023-07-24 14:22:26 +03:00
deeplow
814d533c3b
Restructure container code
The files in `container/` no longer make sense to have that name since
the "document to pixels" part will run in Qubes OS in its own virtual
machine.

To adapt to this, this PR does the following:
- Moves all the files in `container` to `dangerzone/conversion`
- Splits the old `container/dangerzone.py` into its two components
  `dangerzone/conversion/{doc_to_pixels,pixels_to_pdf}.py` with a
  `common.py` file for shared functions
- Moves the Dockerfile to the project root and adapts it to the new
  container code location
- Updates the CircleCI config to properly cache Docker images.
- Updates our install scripts to properly build Docker images.
- Adds the new conversion module to the container image, so that it can
  be imported as a package.
- Adapts the container isolation provider to use the new way of calling
  the code.

NOTE: We have made zero changes to the conversion code in this commit,
except for necessary imports in order to factor out some common parts.
Any changes necessary for Qubes integration follow in the subsequent
commits.
2023-06-21 11:44:47 +03:00
deeplow
06fe53b0d6
Make 'make test' use the Python interpreter
On Windows this was failing [1] because it did not know to run
./dev_scripts/pytest-wrapper.py in the Python interpreter. The forward
slashes didn't seem to cause issue.

[1]: https://github.com/freedomofpress/dangerzone/actions/runs/3967654249/jobs/6799870096
2023-01-25 16:36:31 +00:00
Alex Pyrgiotis
a8421bcdb7
Fix exclusion of dev_scripts/envs from isort
The previous way of excluding files under `dev_scripts/envs` does not
seem to work. Ditching the glob and excluding the whole path works, so
we can go with that.
2023-01-19 17:27:11 +02:00
Alex Pyrgiotis
f16b42bb18
Ignore dev_scripts/envs for tests/lints
Ignore the `dev_scripts/envs` folder when running tests or linting code,
as it may contain files that are not owned by the current user. In this
case, we've seen that pytest/black etc. fail.

This typically happens when the user has run Dangerzone in a
containerized environment (see #286), and Podman created a directory
with files owned by the user in the nested container.
2023-01-16 18:48:09 +02:00
deeplow
84b8212e5d
Fix test instability: pytest in seq. podman<4.3.0
Instability in the automated tests sometimes would sometimes fail when
running "podman images --format {{.ID}}". It turns out that in versions
prior to podman 4.3.0, podman volumes (stored in
~/.local/share/contaiers) would get corrupted when multiple tests were
run in parallel.

The current solution is to wrap the test command to run sequentially in
versions prior to the fix and in parallel for versions after that.

Fixes #217
2023-01-09 11:54:24 +00:00
Alex Pyrgiotis
a14b4e9620
Fix a minor typo 2022-10-27 13:44:18 +01:00
Alex Pyrgiotis
03c3541bdc
tests: Run Mypy against tests
Run Mypy static checks against our tests. This brings them inline with
the rest of the codebase, and we have an extra level of certainty that
the tests (and unit tests in particular) will not significantly diverge
from the code they are testing.
2022-10-25 19:09:23 +03:00
deeplow
d5eefeab3d
report non-containerized code coverage 2022-09-13 13:17:22 +01:00
deeplow
9e3d404ed8
make test: add to Makefile & enabled parallel runs
parallel pytest via pytest-xdist
2022-09-13 13:08:01 +01:00
deeplow
092456434b
don't type check dev scripts 2022-08-22 12:28:48 +01:00
deeplow
463ff97b97
add type hints to container dz py code 2022-08-22 12:28:44 +01:00
deeplow
ec8bafa27c
add mypy lint check 2022-08-22 11:12:24 +01:00
deeplow
1f8e23f164
make mypy more pedantic
Borrow the mypy configuration from the securedrop-client Makefile
2022-08-22 10:30:40 +01:00
deeplow
75c4ee3d2b
add mypy lint to makefile 2022-08-22 10:30:38 +01:00
deeplow
6fc0e2c15f
add Makefile with linters (black & isort)
- borrowed makefile self-help code from SecureDrop
- considered windows dev env case: GNU make available via Cygwin
2022-08-22 10:03:57 +01:00