slowed tests
See original GitHub issueAdding the whitenoise middleware can greatly slow down your tests. If you have processes static previously and your static directory is full of static files. Then the middleware, on each test method, process the list of files over and over. So your tests are now slowed by a function of how many static files you have.
On startup this is called:
def update_files_dictionary(self, root, prefix):
for directory, _, filenames in os.walk(root, followlinks=True):
for filename in filenames:
path = os.path.join(directory, filename)
url = prefix + os.path.relpath(path, root).replace('\\', '/')
self.files[url] = self.get_static_file(path, url)
And if you have thousands of static files, this will slow it down.
Perhaps this list could be lazy loaded on first call rather than init.
Issue Analytics
- State:
- Created 7 years ago
- Comments:19 (8 by maintainers)
Top Results From Across the Web
5-Step Strategy for Optimizing Slow Tests - Semaphore CI
Slow tests affect development. Engineering teams lose momentum and become frustrated because they can't meet their goals. A slow test suite ...
Read more >the chainsmokers - testing (slowed) - YouTube
the chainsmokers - testing (slowed). 2.2K views 7 months ago. aiden's aesthetics.
Read more >Fast fixes for slow tests: How to unclog your CI pipeline
It's common that slow tests are overloaded—they try to do too many things. By paring down the steps each test has to perform,...
Read more >Slow Tests | DevLead.io
Here are some solutions to these common causes for slow tests: High Latency. You will often experience high latency when the System Under ......
Read more >Debugging Why Your Specs Have Slowed Down - Thoughtbot
Your test suite used to be lightning fast but now it's starting to feel a bit sluggish. Before adding CI parallelization, ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Also perhaps mentioning in the documentation that it’s recommended to disabling file scanning during tests?
I’m new to whitenoise and just saw this issue after running into it.
@evansd’s idea to store the result of walking the directory in a file occurred to me, too, and I think makes a lot of sense:
It seems like this would be an especially good fit e.g. for people using Docker. The file could be generated as part of the Docker build and stored in the Docker image itself (or maybe generated on container startup).
I’m not sure if there’s already an open issue for this feature, but it does relate to the general issue #141 (“Make whitenoise faster”), which is still open.