python

pipenv

Handle timeouts

As of end-Nov 2018, creating a lock file takes really long time, and this leads to TIMEOUT error (and lock file is NOT created)

There are two ways to handle this.

  1. pipenv install --skip-lock This will, as the parameter suggests, will not create the lock file, this avoiding delaying the issue.
  2. Now you can create the Pipfile.lock via pipenv lock, but that would run into the same issue. So setup PIPENV_TIMEOUT environment variable before running the pipenv lock command. The value is in seconds. So for 3 minutes, set it to 180 (default is 120). Guessing how much to set it to is tricky. So if you are unsure, set it to some really high value like 10000

py.test

See the output from print

If the test cases have print() statements, you see those, only in case of failure. But sometime, you want to see they unconditionally (i.e. even when the tests pass)

The way to do this is use -s option. This option disables "per test capturing". Read the docs

logging

formatter :

%(asctime)s %(levelname)-5.5s [%(name)s:%(lineno)s][%(threadName)s] %(message)s

(Reference: Pyramid Logging tutorial)