Skip to content

Commit bb8dc2b

Browse files
committed
CI: Fail when open()’s default encoding is used
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>
1 parent b8b6920 commit bb8dc2b

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

.github/workflows/ci.yaml

+8-1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,13 @@ jobs:
5757
- run: pip install .
5858
# https://github.com/AndreMiras/coveralls-python-action/issues/18
5959
- run: echo -e "[run]\nrelative_files = True" > .coveragerc
60-
- run: coverage run -m unittest discover
60+
- run: >-
61+
python
62+
-X warn_default_encoding
63+
-W error::EncodingWarning
64+
-m coverage
65+
run
66+
-m unittest
67+
discover
6168
- name: Coveralls
6269
uses: AndreMiras/coveralls-python-action@develop

0 commit comments

Comments
 (0)