我在名为pdf2textbox的模块上运行pytests,为此我使用了tox。 python 3.5、3.6和3.7的设置相同:
# tox.ini
...
[testenv]
basepyton =
py35: python3.5
py36: python3.6
py37: python3.7
deps =
check-manifest
pytest
requests
pdfminer2
pytest-cov
commands =
check-manifest
python --version
py.test --cov=pdf2textbox tests
当我运行Tox时,python3.5和python3.6的时间约为58或59秒。但是,python3.7大约需要8分钟:
py36 inst-nodeps: .../.virtualenvs/pdf2textbox/.tox/dist/pdf2textbox-0.2.6.zip
py36 installed: atomicwrites==1.1.5,attrs==18.1.0,certifi==2018.4.16,chardet==3.0.4,check-manifest==0.37,coverage==4.5.1,idna==2.7,more-itertools==4.2.0, pdf2textbox==0.2.6, pdfminer2==20151206,pluggy==0.6.0,py==1.5.4,pytest==3.6.3,pytest-cov==2.5.1, requests==2.19.1, six==1.11.0,urllib3==1.23
py36 runtests: PYTHONHASHSEED='1111111111'
py36 runtests: commands[0] | check-manifest
some files listed as being under source control are missing:
.tox/dist/pdf2textbox-0.2.4.zip
lists of files in version control and sdist match
py36 runtests: commands[1] | python --version
Python 3.6.3
py36 runtests: commands[2] | py.test --cov=pdf2textbox tests
============================ test session starts =============================
platform linux -- Python 3.6.3, pytest-3.6.3, py-1.5.4, pluggy-0.6.0
rootdir: .../.virtualenvs/pdf2textbox, inifile:
plugins: cov-2.5.1
collected 15 items
tests/test_cli_slice_option.py ... [ 20%]
tests/test_convert_pdf.py ........ [ 60%]
tests/test_get_pdf.py ............ [ 86%]
tests/test_types.py .............. [100%]
----------- coverage: platform linux, python 3.6.3-final-0 -----------
Name Stmts Miss Cover
pdf2textbox/__init__.py 1 0 100%
pdf2textbox/pdf2textbox.py 507 201 60%
TOTAL 508 201 60%
**================== 15 passed in 58.93 seconds ==============================**
py37 inst-nodeps: .../.virtualenvs/pdf2textbox/.tox/dist/pdf2textbox-0.2.6.zip
py37 installed: atomicwrites==1.1.5,attrs==18.1.0,certifi==2018.4.16,chardet==3.0.4,check-manifest==0.37,coverage==4.5.1,idna==2.7,more-itertools==4.2.0,pdf2textbox==0.2.6,pdfminer2==20151206,pluggy==0.6.0,py==1.5.4,pytest==3.6.3,pytest-cov==2.5.1,requests==2.19.1,six==1.11.0,urllib3==1.23
py37 runtests: PYTHONHASHSEED='2222222222'
py37 runtests: commands[0] | check-manifest
some files listed as being under source control are missing:
.tox/dist/pdf2textbox-0.2.4.zip
lists of files in version control and sdist match
py37 runtests: commands[1] | python --version
Python 3.7.0b3
py37 runtests: commands[2] | py.test --cov=pdf2textbox tests
========================== test session starts =================================
platform linux -- Python 3.7.0b3, pytest-3.6.3, py-1.5.4, pluggy-0.6.0
rootdir: .../.virtualenvs/pdf2textbox, inifile:
plugins: cov-2.5.1 collected 15 items
tests/test_cli_slice_option.py ... [ 20%]
tests/test_convert_pdf.py ........ [ 60%]
tests/test_get_pdf.py ............ [ 86%]
tests/test_types.py .............. [100%]
----------- coverage: platform linux, python 3.7.0-beta-3 -----------
Name Stmts Miss Cover
pdf2textbox/__init__.py 1 0 100%
pdf2textbox/pdf2textbox.py 507 201 60%
TOTAL 508 201 60%
**=================== 15 passed in 461.68 seconds =============================**
_______________________________ summary _______________________________________
py35: commands succeeded
py36: commands succeeded
py37: commands succeeded
congratulations :)
测试时间:
py35:1分钟
py36:1分钟
py37:8分钟
有人知道为什么会这样吗?