Replace setup.py test with pytest command (#380)

Replace `setup.py test` with pytest command
This commit is contained in:
Alexander Petrov 2020-02-20 09:37:39 +00:00 committed by GitHub
parent e6572f5083
commit 413234ce49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 3 deletions

View File

@ -39,10 +39,13 @@ matrix:
- echo "deb [arch=amd64] https://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list - echo "deb [arch=amd64] https://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list
- curl https://bazel.build/bazel-release.pub.gpg | sudo apt-key add - - curl https://bazel.build/bazel-release.pub.gpg | sudo apt-key add -
- sudo apt-get update && sudo apt-get install bazel make - sudo apt-get update && sudo apt-get install bazel make
- sudo apt install python3-dev
- pip install -U pytest --user
script: make all script: make all
before_install: before_install:
- sudo apt install python3-dev - sudo apt install python3-dev
- pip install -U pytest --user
- go get github.com/axw/gocov/gocov - go get github.com/axw/gocov/gocov
- go get github.com/mattn/goveralls - go get github.com/mattn/goveralls
- go get github.com/fatih/color - go get github.com/fatih/color

View File

@ -16,6 +16,7 @@ import os
from setuptools import setup from setuptools import setup
from setuptools import Extension from setuptools import Extension
from setuptools.command.build_ext import build_ext as BuildExt from setuptools.command.build_ext import build_ext as BuildExt
from setuptools.command.test import test as TestCommand
from subprocess import Popen, PIPE from subprocess import Popen, PIPE
DIR = os.path.abspath(os.path.dirname(__file__)) DIR = os.path.abspath(os.path.dirname(__file__))
@ -45,6 +46,10 @@ class BuildJsonnetExt(BuildExt):
BuildExt.run(self) BuildExt.run(self)
class NoopTestCommand(TestCommand):
def __init__(self, dist):
print("_gojsonnet does not support running tests with 'python setup.py test'. Please run 'pytest'.")
jsonnet_ext = Extension( jsonnet_ext = Extension(
'_gojsonnet', '_gojsonnet',
sources=MODULE_SOURCES, sources=MODULE_SOURCES,
@ -63,7 +68,7 @@ setup(name='gojsonnet',
version=get_version(), version=get_version(),
cmdclass={ cmdclass={
'build_ext': BuildJsonnetExt, 'build_ext': BuildJsonnetExt,
'test': NoopTestCommand,
}, },
ext_modules=[jsonnet_ext], ext_modules=[jsonnet_ext],
test_suite="python._jsonnet_test",
) )

View File

@ -14,8 +14,8 @@ then
else else
c-bindings-tests/run.sh c-bindings-tests/run.sh
$PYTHON_COMMAND setup.py build $PYTHON_COMMAND setup.py build --build-platlib .
$PYTHON_COMMAND setup.py test $PYTHON_COMMAND -m pytest python
fi fi
export IMPLEMENTATION=golang export IMPLEMENTATION=golang