У меня есть простой python код, подобный следующему:
имя файла: test_pytest_openpyxl.py
import openpyxl
def test_1():
print("test_1")
if __name__ == "__main__":
test_1()
python test_pytest_openpyxl.py
оно прошло с / ошибка Однако
pytest test_pytest_openpyxl.py выдал следующие ошибки:
================================================= test session starts ==================================================
platform linux -- Python 3.7.4, pytest-5.3.3, py-1.8.0, pluggy-0.13.1
plugins: arraydiff-0.3, astropy-header-0.1.1, doctestplus-0.5.0, openfiles-0.4.0, remotedata-0.3.2
collected 0 items / 1 error
======================================================== ERRORS ========================================================
_________________________________________ ERROR collecting test_pytest_xml.py __________________________________________
/home/user/anaconda3/lib/python3.7/site-packages/py/_path/local.py:701: in pyimport
__import__(modname)
<frozen importlib._bootstrap>:983: in _find_and_load
???
<frozen importlib._bootstrap>:967: in _find_and_load_unlocked
???
<frozen importlib._bootstrap>:677: in _load_unlocked
???
/home/user/anaconda3/lib/python3.7/site-packages/_pytest/assertion/rewrite.py:143: in exec_module
exec(co, module.__dict__)
C:\Users\v-jonluo\repo\performance\perf_lib\py_lib\gantt_model\pytest\test_pytest_xml.py:1: in <module>
???
/home/user/anaconda3/lib/python3.7/site-packages/openpyxl/__init__.py:6: in <module>
from openpyxl.workbook import Workbook
/home/user/anaconda3/lib/python3.7/site-packages/openpyxl/workbook/__init__.py:5: in <module>
from .workbook import Workbook
/home/user/anaconda3/lib/python3.7/site-packages/openpyxl/workbook/workbook.py:8: in <module>
from openpyxl.worksheet.worksheet import Worksheet
/home/user/anaconda3/lib/python3.7/site-packages/openpyxl/worksheet/worksheet.py:30: in <module>
from openpyxl.cell import Cell, MergedCell
/home/user/anaconda3/lib/python3.7/site-packages/openpyxl/cell/__init__.py:4: in <module>
from .cell import Cell, WriteOnlyCell, MergedCell
/home/user/anaconda3/lib/python3.7/site-packages/openpyxl/cell/cell.py:46: in <module>
from openpyxl.utils.inference import (
/home/user/anaconda3/lib/python3.7/site-packages/openpyxl/utils/inference.py:10: in <module>
from openpyxl.styles import numbers
/home/user/anaconda3/lib/python3.7/site-packages/openpyxl/styles/__init__.py:5: in <module>
from .alignment import Alignment
/home/user/anaconda3/lib/python3.7/site-packages/openpyxl/styles/alignment.py:6: in <module>
from openpyxl.descriptors import Bool, MinMax, Min, Alias, NoneSet
/home/user/anaconda3/lib/python3.7/site-packages/openpyxl/descriptors/__init__.py:5: in <module>
from .sequence import Sequence
/home/user/anaconda3/lib/python3.7/site-packages/openpyxl/descriptors/sequence.py:5: in <module>
from openpyxl.xml.functions import Element
/home/user/anaconda3/lib/python3.7/site-packages/openpyxl/xml/functions.py:31: in <module>
from defusedxml.lxml import fromstring as _fromstring, tostring
/home/user/anaconda3/lib/python3.7/site-packages/defusedxml/lxml.py:29: in <module>
stacklevel=2,
E DeprecationWarning: defusedxml.lxml is no longer supported and will be removed in a future release.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
=================================================== 1 error in 4.19s ===================================================
Среда: Ubuntu 18.04 / Windows 10, Pythion 3.7.4, openpyxl 2.6.2, pytest-5.3. 3, setuptools 45.1.0