Skip to content

Commit

Permalink
setup: drop test command
Browse files Browse the repository at this point in the history
  • Loading branch information
hattya committed Mar 24, 2024
1 parent b3b6291 commit 4303c87
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 34 deletions.
34 changes: 1 addition & 33 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
#

import os
import sys

from setuptools import setup, Command, Extension
from setuptools import setup, Extension


def sources(path, exts):
Expand All @@ -19,39 +18,8 @@ def sources(path, exts):
yield os.path.normpath(os.path.join(root, f))


class test(Command):

description = 'run unit tests'
user_options = [('failfast', 'f', 'stop on first fail or error')]

boolean_options = ['failfast']

def initialize_options(self):
self.failfast = False

def finalize_options(self):
pass

def run(self):
import unittest

build_ext = self.reinitialize_command('build_ext')
build_ext.inplace = True
self.run_command('build_ext')
# run unittest discover
argv = [sys.argv[0], 'discover', '--start-directory', 'tests']
if self.verbose:
argv.append('--verbose')
if self.failfast:
argv.append('--failfast')
unittest.main(None, argv=argv)


setup(
ext_modules=[Extension('zopfli._zopfli',
include_dirs=[os.path.join('zopfli', '_zopfli', 'zopfli', 'src')],
sources=list(sources('zopfli', ['.c', '.cc', '.cpp'])))],
cmdclass={
'test': test,
},
)
3 changes: 2 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ deps =
scmver[toml] >= 1.7
passenv = *FLAGS, DISTUTILS_*, INCLUDE, LC_*, LIB, MSSdk, Program*, SETUPTOOLS_*
commands =
python setup.py build_ext --inplace
# test
coverage erase
coverage run --source=zopfli setup.py test {posargs:--quiet}
coverage run --source=zopfli -m unittest discover -s tests {posargs}
coverage report
# lint
flake8
Expand Down

0 comments on commit 4303c87

Please sign in to comment.