Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TypeError: attrib() got an unexpected keyword argument 'convert'

Tags:

python

pytest

This error occurred during automated testing of a python project on the CI server using pytest. I'm using pytest==4.0.2. This error only just started to occur, previous pipelines seem to work fine.

The full error:

File "/usr/local/lib/python3.7/site-packages/_pytest/tmpdir.py", line 35, in TempPathFactory     lambda p: Path(os.path.abspath(six.text_type(p))) TypeError: attrib() got an unexpected keyword argument 'convert' 
like image 411
nitred Avatar asked Oct 01 '19 17:10

nitred


Video Answer


1 Answers

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.

UPDATE: Moving the comment into the answer. This error does not occur on the newer versions of pytest i.e. pytest==5.2.0

like image 112
nitred Avatar answered Oct 06 '22 22:10

nitred