Describe the bug
When using TestCase from from pyfakefs.fake_filesystem_unittest import TestCase calling self.setUpPyfakefs on setUp, trying to create a pytz timezone object will always result in ÙnknownTimeZoneError` no matter the timezone string.
In contrast, omitting the call to self.setUpPyfakefs or using TestCase from unittest does not result in this error.
How To Reproduce
from pyfakefs.fake_filesystem_unittest import TestCase
from pytz import timezone
class ExampleTestCase(TestCase):
def setUp(self):
self.setUpPyfakefs()
def test_timezone(self):
timezone("Europe/Copenhagen")
# raises pytz.exceptions.UnknownTimeZoneError: 'Europe/Copenhagen'
However not setting up the fake fs (or equivalently, using TestCase from unittest) does not yield this error
from pyfakefs.fake_filesystem_unittest import TestCase
from pytz import timezone
class ExampleTestCase(TestCase):
def test_timezone(self):
timezone("Europe/Copenhagen")
# test passes
Your environment
python -c "import platform; print(platform.platform())"
>>> Linux-6.5.0-14-generic-x86_64-with-glibc2.38
python -c "import sys; print('Python', sys.version)"
>>> Python 3.11.5 (main, Sep 11 2023, 13:54:46) [GCC 11.2.0]
python -c "from pyfakefs import __version__; print('pyfakefs', __version__)"
>>> pyfakefs 5.2.4
python -c "import pytest; print('pytest', pytest.__version__)"
>>> pytest 7.4.3
pip freeze | grep "^pytz"
>>> pytz==2023.3.post1
I'd be interested in helping out on a solution to this if required!
Thanks a lot!
Describe the bug
When using
TestCasefrom frompyfakefs.fake_filesystem_unittest import TestCasecallingself.setUpPyfakefsonsetUp, trying to create apytztimezoneobject will always result in ÙnknownTimeZoneError` no matter the timezone string.In contrast, omitting the call to
self.setUpPyfakefsor usingTestCasefromunittestdoes not result in this error.How To Reproduce
However not setting up the fake fs (or equivalently, using
TestCasefromunittest) does not yield this errorYour environment
I'd be interested in helping out on a solution to this if required!
Thanks a lot!