Skip to content

Commit

Permalink
Start transition from nose to pytest
Browse files Browse the repository at this point in the history
  • Loading branch information
grantjenks committed Mar 19, 2019
1 parent 936a086 commit d660358
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 21 deletions.
13 changes: 11 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
sudo: false
language: python
install: pip install -r requirements.txt
script: nosetests -v
install: pip install tox
script: tox
matrix:
include:
- python: 2.7
env: TOXENV=py27
- python: 3.4
env: TOXENV=py34
- python: 3.5
env: TOXENV=py35
- python: 3.6
env: TOXENV=py36
- python: 3.7
dist: xenial
env: TOXENV=py37
- python: pypy
env: TOXENV=pypy
- python: 3.7
dist: xenial
env: TOXENV=lint
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1 +1 @@
include README.rst LICENSE requirements.txt
include README.rst LICENSE
6 changes: 4 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,19 @@ environment:
- PYTHON: "C:\\Python34"
- PYTHON: "C:\\Python35"
- PYTHON: "C:\\Python36"
- PYTHON: "C:\\Python37"
- PYTHON: "C:\\Python27-x64"
- PYTHON: "C:\\Python34-x64"
- PYTHON: "C:\\Python35-x64"
- PYTHON: "C:\\Python36-x64"
- PYTHON: "C:\\Python37-x64"

install:

- "%PYTHON%\\python.exe -m pip install nose mock django==1.11.12"
- "%PYTHON%\\python.exe -m pip install tox"

build: off

test_script:

- "%PYTHON%\\python.exe -m nose -v"
- "%PYTHON%\\python.exe -m tox -e py"
13 changes: 12 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
coverage
django<2
doc8
gj
mock
nose
django<2
pylint
pytest
pytest-cov
pytest-django
sphinx
tox
twine
wheel
19 changes: 9 additions & 10 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import io
from setuptools import setup, find_packages
from setuptools import setup
from setuptools.command.test import test as TestCommand
import sys

import diskcache


class Tox(TestCommand):
def finalize_options(self):
TestCommand.finalize_options(self)
Expand All @@ -13,24 +12,24 @@ def finalize_options(self):
def run_tests(self):
import tox
errno = tox.cmdline(self.test_args)
sys.exit(errno)
exit(errno)


with io.open('README.rst', encoding='UTF-8') as reader:
with open('README.rst') as reader:
readme = reader.read()

setup(
name='diskcache',
name=diskcache.__title__,
version=diskcache.__version__,
description='Disk and file backed cache.',
description='Disk Cache -- Disk and file backed persistent cache.',
long_description=readme,
author='Grant Jenks',
author_email='[email protected]',
url='http://www.grantjenks.com/docs/diskcache/',
packages=find_packages(exclude=('tests', 'docs')),
package_data={'': ['LICENSE', 'README.rst']},
license='Apache 2.0',
packages=['diskcache'],
tests_require=['tox'],
cmdclass={'test': Tox},
license='Apache 2.0',
install_requires=[],
classifiers=(
'Development Status :: 5 - Production/Stable',
Expand Down
32 changes: 27 additions & 5 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,29 @@
[tox]
envlist=py27,py34,py35,py36
envlist=py27,py34,py35,py36,py37,pypy,lint
skip_missing_interpreters=True

[testenv]
deps=nose
mock
django>=1.11,<1.12
commands=nosetests
deps=
django<2
mock
pytest
pytest-django
commands=python -m pytest
setenv =
DJANGO_SETTINGS_MODULE=tests.settings
PYTHONPATH={toxinidir}:{toxinidir}/tests

[pytest]
addopts=
--doctest-modules
--doctest-glob "*.rst"
--ignore tests/benchmark_core.py
--ignore tests/benchmark_djangocache.py
--ignore tests/benchmark_glob.py
--ignore tests/plot.py
norecursedirs=site-packages
testpaths=docs diskcache tests

[testenv:lint]
deps=pylint
commands=pylint diskcache

0 comments on commit d660358

Please sign in to comment.