Comments (2)
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):
from pathlib import Path
import pytz
class ExampleTestCase(TestCase):
def setUp(self):
self.setUpPyfakefs()
info_dir = Path(pytz.__file__).parent / "zoneinfo"
self.fs.add_real_directory(info_dir)
See also this entry in the troubleshooting section of the documentation. It probably would make sense to add this concrete example there.
from pyfakefs.
I'm converting this into a discussion issue - it is probably helpful for others.
from pyfakefs.
Related Issues (20)
- sdist is missing `tox.ini` HOT 3
- pyfakefs 5.3.4 + moto 4.2.13, test failed HOT 1
- Example usage docs using pathlib leads to errors HOT 2
- pyarrow.lib.ArrowKeyError: A type extension with name pandas.period already defined HOT 9
- Infinite loop with multiprocessing HOT 4
- EncodingWarnings raised (3) when using pyfakefs HOT 7
- Adding/removing directory entries does not respect directory ownership HOT 1
- Directory enumeration/search permissions mismatch Unix behavior HOT 3
- Wrong temporary directory created following a reset via `fs.os` HOT 4
- The `io.open` function should not consider file permissions when opening from an existing file descriptor HOT 3
- Patched `os.symlink` mishandles directory descriptors HOT 3
- Missing mock of `os.dup` HOT 4
- `os.getxattr` should raise `OSError(ENODATA)` for non-existent extended attributes HOT 1
- Patched `os.open` does not respect `O_NOFOLLOW` HOT 1
- Faked `os.link` is missing the `follow_symlinks` parameter HOT 1
- Fake `os.open` does not handle the `O_DIRECTORY` flag
- shutil.rmtree failing in OSType.WINDOWS with PermissionError HOT 2
- `os.open(O_DIRECTORY)` should raise `ENOENT` when the file does not exist
- Faked `os.makedirs` differs from the built-in `os.makedirs` and `mkdir -p` HOT 5
- Closing a duplicated fileno invalidates the previous file description
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyfakefs.