pytest seems to have the package attrs as a dependency. attrs==19.2.0 was released around 2019-10-01 17:00 UTC. This seems to cause the problem above.
Switching back to attrs==19.1.0 fixes the problem. Just do the following:
pip install attrs==19.1.0
NOTE: I expect that the issue will be resolved either by attrs or pytest soon by releasing a new version. So this fix should only be temporary.
From the comments: This error does not occur on the newer versions of pytest i.e. pytest==5.2.0