Revisit mkdir/_ensure_supporting_files in cacheprovider
- cacheprovider: move call to _ensure_supporting_files This makes it less likely to have a race here (which is not critical), but happened previously probably with xdist, causing flaky coverage with `if not readme_path.is_file():` etc checks in `_ensure_supporting_files`, which has been removed in the `features` branch already.
This commit is contained in:
		
							parent
							
								
									7939e5327c
								
							
						
					
					
						commit
						bcdbb6b677
					
				|  | @ -125,6 +125,8 @@ class Cache(object): | ||||||
|         except (IOError, OSError): |         except (IOError, OSError): | ||||||
|             self.warn("could not create cache path {path}", path=path) |             self.warn("could not create cache path {path}", path=path) | ||||||
|             return |             return | ||||||
|  |         if not cache_dir_exists_already: | ||||||
|  |             self._ensure_supporting_files() | ||||||
|         try: |         try: | ||||||
|             f = path.open("wb" if PY2 else "w") |             f = path.open("wb" if PY2 else "w") | ||||||
|         except (IOError, OSError): |         except (IOError, OSError): | ||||||
|  | @ -133,9 +135,6 @@ class Cache(object): | ||||||
|             with f: |             with f: | ||||||
|                 json.dump(value, f, indent=2, sort_keys=True) |                 json.dump(value, f, indent=2, sort_keys=True) | ||||||
| 
 | 
 | ||||||
|             if not cache_dir_exists_already: |  | ||||||
|                 self._ensure_supporting_files() |  | ||||||
| 
 |  | ||||||
|     def _ensure_supporting_files(self): |     def _ensure_supporting_files(self): | ||||||
|         """Create supporting files in the cache dir that are not really part of the cache.""" |         """Create supporting files in the cache dir that are not really part of the cache.""" | ||||||
|         readme_path = self._cachedir / "README.md" |         readme_path = self._cachedir / "README.md" | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue