Skip to content

Commit f783bce

Browse files
committed
Ensure tests catch bug with missing encoding on write
1 parent ef60105 commit f783bce

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

podgen/tests/test_podcast.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
import unittest
1313
import warnings
14+
import locale
1415

1516
from lxml import etree
1617
import tempfile
@@ -26,6 +27,8 @@
2627
class TestPodcast(unittest.TestCase):
2728

2829
def setUp(self):
30+
self.existing_locale = locale.setlocale(locale.LC_ALL, None)
31+
locale.setlocale(locale.LC_ALL, 'C')
2932

3033
fg = Podcast()
3134

@@ -36,7 +39,8 @@ def setUp(self):
3639

3740
self.name = 'Some Testfeed'
3841

39-
self.author = Person('John Doe', '[email protected]')
42+
# Use character not in ASCII to catch encoding errors
43+
self.author = Person('Jon Døll', '[email protected]')
4044

4145
self.website = 'http://example.com'
4246
self.description = 'This is a cool feed!'
@@ -99,6 +103,9 @@ def noop(*args, **kwargs):
99103
pass
100104
warnings.showwarning = noop
101105

106+
def tearDown(self):
107+
locale.setlocale(locale.LC_ALL, self.existing_locale)
108+
102109
def test_constructor(self):
103110
# Overwrite fg from setup
104111
self.fg = Podcast(

0 commit comments

Comments
 (0)