Skip to content

Commit

Permalink
CI: Fail when open()’s default encoding is used
Browse files Browse the repository at this point in the history
The previous few commits have removed all calls to open() that use its
default encoding. That being said, it’s still possible that code added
in the future will contain that same mistake. This commit makes it so
that the CI test job will fail if that mistake is made again.

Unfortunately, it doesn’t look like coverage.py allows you to specify -X
options [1] or warning filters [2] when running your tests [3]. As a
result, the CI test job will also fail if coverage.py uses open()’s
default encoding. Hopefully, coverage.py won’t do that. If it does, then
we can always temporarily revert this commit.

[1]: <https://docs.python.org/3.12/using/cmdline.html#cmdoption-X>
[2]: <https://docs.python.org/3.12/using/cmdline.html#cmdoption-W>
[3]: <https://coverage.readthedocs.io/en/7.4.0/cmd.html#execution-coverage-run>
  • Loading branch information
Jayman2000 committed Jul 19, 2024
1 parent beda2cc commit d562b6b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@ jobs:
- run: pip install .
# https://github.com/AndreMiras/coveralls-python-action/issues/18
- run: echo -e "[run]\nrelative_files = True" > .coveragerc
- run: coverage run -m unittest discover
- run: >-
python
-X warn_default_encoding
-W error::EncodingWarning
-m coverage
run
-m unittest
discover
- name: Coveralls
uses: AndreMiras/coveralls-python-action@develop

0 comments on commit d562b6b

Please sign in to comment.