Use tox for tests

This commit is contained in:
Unrud 2022-07-03 10:14:38 +02:00
parent abcc0c2ef6
commit 14a3c3d763
4 changed files with 23 additions and 20 deletions

View File

@ -18,10 +18,10 @@ jobs:
- uses: actions/setup-python@v2 - uses: actions/setup-python@v2
with: with:
python-version: ${{ matrix.python-version }} python-version: ${{ matrix.python-version }}
- name: Install from source - name: Install dependencies
run: python -m pip install --editable .[test,bcrypt] run: python -m pip install tox
- name: Run tests - name: Run tests
run: python -m pytest run: python -m tox
- name: Upload coverage to Coveralls - name: Upload coverage to Coveralls
if: github.event_name == 'push' if: github.event_name == 'push'
env: env:

View File

@ -1,9 +0,0 @@
import sys
from importlib.util import find_spec
def pytest_addoption(parser, pluginmanager):
# Ignore the "--mypy" argument if pytest-mypy is not installed and
# the implementation is not cpython
if sys.implementation.name != 'cpython' and not find_spec("pytest_mypy"):
parser.addoption("--mypy", action="store_true")

View File

@ -2,10 +2,25 @@
python-tag = py3 python-tag = py3
[tool:pytest] [tool:pytest]
# The "--mypy" argument is ignored in conftest.py if pytest-mypy is not addopts = --typeguard-packages=radicale
# installed and the implementation is not cpython
addopts = --flake8 --isort --typeguard-packages=radicale --mypy --cov --cov-report=term --cov-report=xml -r s [tox:tox]
norecursedirs = dist .cache .git build Radicale.egg-info .eggs venv
[testenv]
extras =
bcrypt
test
deps =
flake8
isort
mypy
types-setuptools
pytest-cov
commands =
flake8 .
isort --check --diff .
mypy .
pytest -r s --cov --cov-report=term --cov-report=xml .
[tool:isort] [tool:isort]
known_standard_library = _dummy_thread,_thread,abc,aifc,argparse,array,ast,asynchat,asyncio,asyncore,atexit,audioop,base64,bdb,binascii,binhex,bisect,builtins,bz2,cProfile,calendar,cgi,cgitb,chunk,cmath,cmd,code,codecs,codeop,collections,colorsys,compileall,concurrent,configparser,contextlib,contextvars,copy,copyreg,crypt,csv,ctypes,curses,dataclasses,datetime,dbm,decimal,difflib,dis,distutils,doctest,dummy_threading,email,encodings,ensurepip,enum,errno,faulthandler,fcntl,filecmp,fileinput,fnmatch,formatter,fpectl,fractions,ftplib,functools,gc,getopt,getpass,gettext,glob,grp,gzip,hashlib,heapq,hmac,html,http,imaplib,imghdr,imp,importlib,inspect,io,ipaddress,itertools,json,keyword,lib2to3,linecache,locale,logging,lzma,macpath,mailbox,mailcap,marshal,math,mimetypes,mmap,modulefinder,msilib,msvcrt,multiprocessing,netrc,nis,nntplib,ntpath,numbers,operator,optparse,os,ossaudiodev,parser,pathlib,pdb,pickle,pickletools,pipes,pkgutil,platform,plistlib,poplib,posix,posixpath,pprint,profile,pstats,pty,pwd,py_compile,pyclbr,pydoc,queue,quopri,random,re,readline,reprlib,resource,rlcompleter,runpy,sched,secrets,select,selectors,shelve,shlex,shutil,signal,site,smtpd,smtplib,sndhdr,socket,socketserver,spwd,sqlite3,sre,sre_compile,sre_constants,sre_parse,ssl,stat,statistics,string,stringprep,struct,subprocess,sunau,symbol,symtable,sys,sysconfig,syslog,tabnanny,tarfile,telnetlib,tempfile,termios,test,textwrap,threading,time,timeit,tkinter,token,tokenize,trace,traceback,tracemalloc,tty,turtle,turtledemo,types,typing,unicodedata,unittest,urllib,uu,uuid,venv,warnings,wave,weakref,webbrowser,winreg,winsound,wsgiref,xdrlib,xml,xmlrpc,zipapp,zipfile,zipimport,zlib known_standard_library = _dummy_thread,_thread,abc,aifc,argparse,array,ast,asynchat,asyncio,asyncore,atexit,audioop,base64,bdb,binascii,binhex,bisect,builtins,bz2,cProfile,calendar,cgi,cgitb,chunk,cmath,cmd,code,codecs,codeop,collections,colorsys,compileall,concurrent,configparser,contextlib,contextvars,copy,copyreg,crypt,csv,ctypes,curses,dataclasses,datetime,dbm,decimal,difflib,dis,distutils,doctest,dummy_threading,email,encodings,ensurepip,enum,errno,faulthandler,fcntl,filecmp,fileinput,fnmatch,formatter,fpectl,fractions,ftplib,functools,gc,getopt,getpass,gettext,glob,grp,gzip,hashlib,heapq,hmac,html,http,imaplib,imghdr,imp,importlib,inspect,io,ipaddress,itertools,json,keyword,lib2to3,linecache,locale,logging,lzma,macpath,mailbox,mailcap,marshal,math,mimetypes,mmap,modulefinder,msilib,msvcrt,multiprocessing,netrc,nis,nntplib,ntpath,numbers,operator,optparse,os,ossaudiodev,parser,pathlib,pdb,pickle,pickletools,pipes,pkgutil,platform,plistlib,poplib,posix,posixpath,pprint,profile,pstats,pty,pwd,py_compile,pyclbr,pydoc,queue,quopri,random,re,readline,reprlib,resource,rlcompleter,runpy,sched,secrets,select,selectors,shelve,shlex,shutil,signal,site,smtpd,smtplib,sndhdr,socket,socketserver,spwd,sqlite3,sre,sre_compile,sre_constants,sre_parse,ssl,stat,statistics,string,stringprep,struct,subprocess,sunau,symbol,symtable,sys,sysconfig,syslog,tabnanny,tarfile,telnetlib,tempfile,termios,test,textwrap,threading,time,timeit,tkinter,token,tokenize,trace,traceback,tracemalloc,tty,turtle,turtledemo,types,typing,unicodedata,unittest,urllib,uu,uuid,venv,warnings,wave,weakref,webbrowser,winreg,winsound,wsgiref,xdrlib,xml,xmlrpc,zipapp,zipfile,zipimport,zlib

View File

@ -50,10 +50,7 @@ install_requires = ["defusedxml", "passlib", "vobject>=0.9.6",
"python-dateutil>=2.7.3", "python-dateutil>=2.7.3",
"setuptools; python_version<'3.9'"] "setuptools; python_version<'3.9'"]
# typeguard requires pytest<7 # typeguard requires pytest<7
tests_require = ["pytest<7", "pytest-cov", "pytest-flake8", "pytest-isort", tests_require = ["pytest<7", "typeguard", "waitress"]
"typeguard", "waitress",
"pytest-mypy; implementation_name=='cpython'",
"types-setuptools; implementation_name=='cpython'"]
setup( setup(
name="Radicale", name="Radicale",