Skip to content

Commit

Permalink
Fix import profile for cinder code
Browse files Browse the repository at this point in the history
Reviewed By: AndreasBackx

Differential Revision: D44199561

fbshipit-source-id: 02b54eb3de5057b3f638ef06507ac40c7bf32ddb
  • Loading branch information
kuecks authored and facebook-github-bot committed Mar 20, 2023
1 parent d8b0c58 commit f2d8c6e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion testslide/import_profiler.py
Expand Up @@ -3,10 +3,19 @@
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

import time
from types import TracebackType
from typing import Any, Dict, List, Optional, Tuple

# In Cinder tests, imports are lazy. We use time.time() while profiling the imports.
# If the first time we call time.time() is inside the profiling, then we will import
# it there, which means we will profile the time import itself. This causes an
# infinite loop. Wrapping imports in Cinder eagerly imports it.
# Place any required imports here.
try:
import time
except Exception:
pass


class ImportedModule:
"""
Expand Down

0 comments on commit f2d8c6e

Please sign in to comment.