mirror of
https://github.com/freedomofpress/dangerzone.git
synced 2025-04-28 18:02:38 +02:00

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.
22 lines
514 B
Python
22 lines
514 B
Python
import sys
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
sys.dangerzone_dev = True # type: ignore[attr-defined]
|
|
|
|
SAMPLE_DIRECTORY = "test_docs"
|
|
BASIC_SAMPLE = "sample.pdf"
|
|
test_docs_dir = Path(__file__).parent.joinpath(SAMPLE_DIRECTORY)
|
|
test_docs = [
|
|
p
|
|
for p in test_docs_dir.rglob("*")
|
|
if p.is_file() and not p.name.endswith("-safe.pdf")
|
|
]
|
|
|
|
# Pytest parameter decorators
|
|
for_each_doc = pytest.mark.parametrize("doc", test_docs)
|
|
|
|
|
|
class TestBase:
|
|
sample_doc = str(test_docs_dir.joinpath(BASIC_SAMPLE))
|