title: How to (py)test a function that relies on the current time?
body: <p>I have a function with the following structure.</p>
  <pre><code>def foo(*args, **kwargs):
      # ... code
      now = pd.Timestamp('now', tz=0)
      # ... more code
      return result # result depends on &quot;now&quot; variable
  </code></pre>
  <p>I cannot take a timestamp right before or after the execution of <code>foo</code> and use it for comparisons against the return value, because it will differ from the value of <code>now</code> inside the function.</p>