You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When using TestCase from from pyfakefs.fake_filesystem_unittest import TestCase calling self.setUpPyfakefs on setUp, trying to create a pytztimezone 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.
The problem here is that pytz uses time zone information data files inside its package to initialize the time zone, and won't find them in the fake fs.
To fix this, you have to map the timezone files into the fake filesystem, something like this (out of my head):
Activity
mrbean-bremen commentedon Dec 18, 2023
The problem here is that
pytzuses time zone information data files inside its package to initialize the time zone, and won't find them in the fake fs.To fix this, you have to map the timezone files into the fake filesystem, something like this (out of my head):
See also this entry in the troubleshooting section of the documentation. It probably would make sense to add this concrete example there.
mrbean-bremen commentedon Dec 18, 2023
I'm converting this into a discussion issue - it is probably helpful for others.