aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormrbean-bremen <hansemrbean@googlemail.com>2021-07-27 17:26:49 +0200
committermrbean-bremen <mrbean-bremen@users.noreply.github.com>2021-07-27 19:47:32 +0200
commit49d420179b6cb92040b6bdf441791ad5a41bb705 (patch)
treedeb3c0ad3ecbe21e29e63bd39cb845140f4dcf1d
parent29b568299c1a833edb76b0fb03909f3712d32e9c (diff)
downloadpyfakefs-49d420179b6cb92040b6bdf441791ad5a41bb705.tar.gz
Skip failing tests on systems with ASCII locale
- closes #623
-rw-r--r--CHANGES.md2
-rw-r--r--pyfakefs/tests/fake_open_test.py17
2 files changed, 15 insertions, 4 deletions
diff --git a/CHANGES.md b/CHANGES.md
index c11d2c9..f349ead 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -11,6 +11,8 @@ The released versions correspond to PyPi releases.
### Infrastructure
* added test dependency check (see [#608](../../issues/608))
+* skip tests failing with ASCII locale
+ (see [#623](../../issues/623))
## [Version 4.5.0](https://pypi.python.org/pypi/pyfakefs/4.5.0) (2021-06-04)
Adds some support for Python 3.10 and basic type checking.
diff --git a/pyfakefs/tests/fake_open_test.py b/pyfakefs/tests/fake_open_test.py
index 29345ea..9e942f9 100644
--- a/pyfakefs/tests/fake_open_test.py
+++ b/pyfakefs/tests/fake_open_test.py
@@ -93,8 +93,13 @@ class FakeFileOpenTest(FakeFileOpenTestBase):
# by the locale preferred encoding - which under Windows is
# usually not UTF-8, but something like Latin1, depending on the locale
text_fractions = 'Ümläüts'
- with self.open(file_path, 'w') as f:
- f.write(text_fractions)
+ try:
+ with self.open(file_path, 'w') as f:
+ f.write(text_fractions)
+ except UnicodeEncodeError:
+ # see https://github.com/jmcgeheeiv/pyfakefs/issues/623
+ self.skipTest("This test does not work with an ASCII locale")
+
with self.open(file_path) as f:
contents = f.read()
self.assertEqual(contents, text_fractions)
@@ -113,8 +118,12 @@ class FakeFileOpenTest(FakeFileOpenTestBase):
def test_write_str_read_bytes(self):
file_path = self.make_path('foo')
str_contents = 'Äsgül'
- with self.open(file_path, 'w') as f:
- f.write(str_contents)
+ try:
+ with self.open(file_path, 'w') as f:
+ f.write(str_contents)
+ except UnicodeEncodeError:
+ # see https://github.com/jmcgeheeiv/pyfakefs/issues/623
+ self.skipTest("This test does not work with an ASCII locale")
with self.open(file_path, 'rb') as f:
contents = f.read()
self.assertEqual(str_contents, contents.decode(