mirror of
https://github.com/freedomofpress/dangerzone.git
synced 2025-04-28 18:02:38 +02:00
Avoid DUMMY_CONVERSION env var treated as bool in CI
`DUMMY_CONVERSION: True` is treated as a boolean value in YAML[1]. As a result, during GitHub CI the environment variable setup during tests is formatted as `DUMMY_CONVERSION=true`. The value is used[2] in tests and passed as the `condition` to the `pytest.mark.skipif`[3] decorator. The `skipif` `condition` can be either a `bool` or `str`. When it is a `str` (our case, as we use `os.environ.get()`), it is treated as a condition string[4] by pytest. Since the condition string is `eval()`ed[5] by pytest, trying to evaluate `true` results in: > Failed: Error evaluating 'skipif' condition > true > NameError: name 'true' is not defined To avoid the implicit conversion to a JSON boolean, or marking the "True" value as a string literal, use the value `1` instead. [1]: https://yaml.org/type/bool.html [2]:9bb1993e77/tests/isolation_provider/base.py (L25)
[3]: https://docs.pytest.org/en/stable/reference/reference.html#pytest-mark-skipif-ref [4]: https://docs.pytest.org/en/stable/historical-notes.html#string-conditions [5]:f75dd87eb7/src/_pytest/skipping.py (L117)
This commit is contained in:
parent
9bb1993e77
commit
a4b20ae101
1 changed files with 2 additions and 2 deletions
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
|
@ -10,7 +10,7 @@ jobs:
|
|||
windows:
|
||||
runs-on: windows-latest
|
||||
env:
|
||||
DUMMY_CONVERSION: True
|
||||
DUMMY_CONVERSION: 1
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-python@v4
|
||||
|
@ -31,7 +31,7 @@ jobs:
|
|||
macOS:
|
||||
runs-on: macos-latest
|
||||
env:
|
||||
DUMMY_CONVERSION: True
|
||||
DUMMY_CONVERSION: 1
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-python@v4
|
||||
|
|
Loading…
Reference in a new issue