From 14a3c3d763ea05124a53a5aa2cec1cc48634d93a Mon Sep 17 00:00:00 2001 From: Unrud Date: Sun, 3 Jul 2022 10:14:38 +0200 Subject: [PATCH] Use tox for tests --- .github/workflows/test.yml | 6 +++--- conftest.py | 9 --------- setup.cfg | 23 +++++++++++++++++++---- setup.py | 5 +---- 4 files changed, 23 insertions(+), 20 deletions(-) delete mode 100644 conftest.py diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 88ebec2..2b729a5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,10 +18,10 @@ jobs: - uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} - - name: Install from source - run: python -m pip install --editable .[test,bcrypt] + - name: Install dependencies + run: python -m pip install tox - name: Run tests - run: python -m pytest + run: python -m tox - name: Upload coverage to Coveralls if: github.event_name == 'push' env: diff --git a/conftest.py b/conftest.py deleted file mode 100644 index 1775397..0000000 --- a/conftest.py +++ /dev/null @@ -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") diff --git a/setup.cfg b/setup.cfg index 06753b4..24d6c95 100644 --- a/setup.cfg +++ b/setup.cfg @@ -2,10 +2,25 @@ python-tag = py3 [tool:pytest] -# The "--mypy" argument is ignored in conftest.py if pytest-mypy is not -# installed and the implementation is not cpython -addopts = --flake8 --isort --typeguard-packages=radicale --mypy --cov --cov-report=term --cov-report=xml -r s -norecursedirs = dist .cache .git build Radicale.egg-info .eggs venv +addopts = --typeguard-packages=radicale + +[tox:tox] + +[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] 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 diff --git a/setup.py b/setup.py index cf1502b..e64cdc1 100644 --- a/setup.py +++ b/setup.py @@ -50,10 +50,7 @@ install_requires = ["defusedxml", "passlib", "vobject>=0.9.6", "python-dateutil>=2.7.3", "setuptools; python_version<'3.9'"] # typeguard requires pytest<7 -tests_require = ["pytest<7", "pytest-cov", "pytest-flake8", "pytest-isort", - "typeguard", "waitress", - "pytest-mypy; implementation_name=='cpython'", - "types-setuptools; implementation_name=='cpython'"] +tests_require = ["pytest<7", "typeguard", "waitress"] setup( name="Radicale",