Skip to content

Commit 10fd071

Browse files
authored
Update test output (#67)
* Update test output to include director with 'ō' in name * Set encoding to UTF-8 explicitly * Use csv-diff fork to specify encoding
1 parent 01af048 commit 10fd071

File tree

4 files changed

+8
-3
lines changed

4 files changed

+8
-3
lines changed

.github/workflows/endtoend.yaml

+3-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ jobs:
2525
- name: Install fa-scrapper
2626
run: poetry install
2727
- name: Install csv-diff
28-
run: python3 -m pip install csv-diff
28+
# Install csv-diff with https://github.com/simonw/csv-diff/pull/19
29+
run: python3 -m pip install git+https://github.com/mikecoop83/csv-diff@c3d32f758343a2ba3737d612e6e906fd9d77322b
2930
- name: Run fa-scrapper
3031
env:
3132
TEST_ACCOUNT_ID: ${{ secrets.TEST_ACCOUNT_ID }}
@@ -35,5 +36,5 @@ jobs:
3536
- name: Check output
3637
env:
3738
FA_LANG: ${{ matrix.lang }}
38-
run: csv-diff output.csv testdata/expected-${FA_LANG}.csv
39+
run: csv-diff --encoding "utf-8" output.csv testdata/expected-${FA_LANG}.csv
3940
shell: bash

fa_scraper/fa_scraper.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,9 @@ def save_to_csv(
209209
):
210210
"""Saves films in a csv file"""
211211

212-
with open(filename, "w", newline="") as csvfile:
212+
# Set to UTF-8 to work around Windows error
213+
# "'charmap' codec can't encode character".
214+
with open(filename, "w", encoding="utf-8", newline="") as csvfile:
213215
writer = csv.DictWriter(csvfile, fieldnames=fieldnames)
214216
writer.writeheader()
215217
for d in dicts:

testdata/expected-en.csv

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
Title,Year,Directors,WatchedDate,Rating,Rating10
2+
Attack on Titan: Chronicle,2020,"Masashi Koizuka, Tetsurō Araki",2022-01-03,4.0,8
23
Full Metal Jacket,1987,Stanley Kubrick,2021-11-10,2.0,4
34
The Lion King,1994,"Rob Minkoff, Roger Allers",2021-11-10,3.5,7
45
Mad Max: Fury Road,2015,George Miller,2021-11-10,5.0,10

testdata/expected-es.csv

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
Title,Year,Directors,WatchedDate,Rating,Rating10
2+
Shingeki no Kyojin: Chronicle,2020,"Masashi Koizuka, Tetsurō Araki",2022-01-04,4.0,8
23
La chaqueta metálica,1987,Stanley Kubrick,2021-11-11,2.0,4
34
El rey león,1994,"Rob Minkoff, Roger Allers",2021-11-11,3.5,7
45
Mad Max: Furia en la carretera,2015,George Miller,2021-11-11,5.0,10

0 commit comments

Comments
 (0)