Integrating with setuptools / python setup.py test / pytest-runner

Continuation of pytest study. I am trying it by referring to the official document and reverse lookup pytest.

Enables pytest to be executed with the following command. The procedure is as described in here.

python setup.py test

Add the settings to the setup.py file. It also includes a coverage plugin.

setup.py


setup_requires = [
    'pytest-runner',
    ]

tests_require = [
    'pytest-cov',
    'pytest',
    ]

setup( #Partial excerpt
      setup_requires=setup_requires,
      tests_require=tests_require,
      )

Add the settings to the setup.cfg file. We have set options to display coverage and test time.

setup.cfg


[aliases]
test=pytest

[tool:pytest]
addopts = --verbose --durations=0 --cov=app --cov-report=html
testpaths = tests
python_files = *.py

reference

Recommended Posts

Integrating with setuptools / python setup.py test / pytest-runner
Primality test with Python
Primality test with python
Unit test log output with python
[Python] Super easy test with assert statement
Stress Test with Locust written in Python
Test Python non-functional programs with GitLab CI
WebUI test with Python2.6 + Selenium 2.44.0 --profile setting
Generate Japanese test data with Python faker
Post Test 3 (Working with PosgreSQL in Python)
How to do portmanteau test with python
python setup.py test the code using multiprocess
FizzBuzz with Python3
Scraping with Python
Create test data like that with Python (Part 1)
Statistics with python
Scraping with Python
Python with Go
Integrate with Python
AES256 with python
Tested with Python
Make your own module quickly with setuptools (python)
python starts with ()
with syntax (Python)
Python Integrity Test
Bingo with python
Zundokokiyoshi with python
[Small story] Test image generation with Python / OpenCV
ARC037 Baum test politely with Python recursive function
Excel with Python
Microcomputer with Python
Cast with python
Flow of creating your own package with setup.py with python
1st Algorithm Practical Test Solve past questions with python
Serial communication with Python
Primality test by Python
Zip, unzip with python
Python with eclipse + PyDev.
Socket communication with Python
Data analysis with python 2
Scraping with Python (preparation)
Try scraping with Python.
Strengthen with code test ⑦
Sequential search with Python
"Object-oriented" learning with python
Run Python with VBA
Solve AtCoder 167 with python
Serial communication with python
[Python] Use JSON with Python
Strengthen with code test ⑨
Strengthen with code test ③
Learn Python with ChemTHEATER
Run prepDE.py with python3
Collecting tweets with Python
3. 3. AI programming with Python
Kernel Method with Python
Non-blocking with Python + uWSGI
Scraping with Python + PhantomJS
Python basics 8 numpy test
Python test package memo
Posting tweets with python